| | |
| | | //读取类 到 控件 |
| | | private void ShowData(long sItemID) |
| | | { |
| | | //DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View(); |
| | | //if (oDeptHlp.GetInfoByID(sItemID)) |
| | | //{ |
| | | // txtHNumber.Text = oDeptHlp.omodel.HNumber.ToString(); |
| | | // txtHHelpCode.Text = oDeptHlp.omodel.HHelpCode.ToString(); |
| | | // txtHName.Text = oDeptHlp.omodel.HName.ToString(); |
| | | // txtHEmpID.Tag = Convert.ToInt64(oDeptHlp.omodel.HEmpID.ToString()); |
| | | // if (oEmp.GetInfoByID(oDeptHlp.omodel.HEmpID)) |
| | | // { |
| | | // txtHEmpID.Text = oEmp.omodel.HName; |
| | | // txtHEmpID.Tag = oEmp.omodel.HItemID.ToString(); |
| | | // } |
| | | // else |
| | | // { |
| | | // txtHEmpID.Text = ""; |
| | | // } |
| | | // txtHNumber.Text = oDeptHlp.omodel.HNumber.ToString(); |
| | | // txtHRemark.Text = oDeptHlp.omodel.HRemark; |
| | | // txtHBarCode.Text = oDeptHlp.omodel.HBarCode; |
| | | // if (oDeptHlp.omodel.HStopflag) |
| | | // chkHStopflag.Checked = true; |
| | | // else |
| | | // chkHStopflag.Checked = false; |
| | | // HItemID = oDeptHlp.omodel.HItemID; |
| | | //} |
| | | DAL.ClsGy_ORGANIZATIONS_View oORGANIZATIONS = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | if (oORGANIZATIONS.GetInfoByID(sItemID)) |
| | | { |
| | | txtHNumber.Text = oORGANIZATIONS.omodel.HNumber.ToString(); |
| | | txtHName.Text = oORGANIZATIONS.omodel.HName.ToString(); |
| | | txtHNumber.Text = oORGANIZATIONS.omodel.HNumber.ToString(); |
| | | txtHRemark.Text = oORGANIZATIONS.omodel.HRemark; |
| | | HItemID = oORGANIZATIONS.omodel.HItemID; |
| | | } |
| | | } |
| | | //写入类 从控件 |
| | | private bool WriteClass() |
| | |
| | | return false; |
| | | } |
| | | //检查父级是否存在 |
| | | string sParent; |
| | | sParent = DBUtility.ClsPub.GetParentCode(txtHNumber.Text.Trim()); |
| | | if (sParent.Trim() == "") |
| | | { |
| | | oDept.oModel.HParentID = 0; |
| | | } |
| | | else |
| | | { |
| | | if (oDept.HavParentCode(sParent.Trim(), HItemID)) |
| | | { |
| | | oDept.oModel.HParentID = oDept.oModel.HItemID; |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("上级代码不存在或被禁用!", "提示"); |
| | | return false; |
| | | } |
| | | } |
| | | //string sParent; |
| | | //sParent = DBUtility.ClsPub.GetParentCode(txtHNumber.Text.Trim()); |
| | | //if (sParent.Trim() == "") |
| | | //{ |
| | | // oDept.oModel.HParentID = 0; |
| | | //} |
| | | //else |
| | | //{ |
| | | // if (oDept.HavParentCode(sParent.Trim(), HItemID)) |
| | | // { |
| | | // oDept.oModel.HParentID = oDept.oModel.HItemID; |
| | | // } |
| | | // else |
| | | // { |
| | | // MessageBox.Show("上级代码不存在或被禁用!", "提示"); |
| | | // return false; |
| | | // } |
| | | //} |
| | | //得到短代码 |
| | | string sShortNumber; |
| | | sShortNumber = DBUtility.ClsPub.GetShortNumber(txtHNumber.Text.Trim()); |
| | |
| | | return false; |
| | | } |
| | | //保存原代码 |
| | | if (oDeptHlp.GetInfoByID(HItemID)) |
| | | { |
| | | oDept.HOldNumber = oDeptHlp.omodel.HNumber; |
| | | //是否新代码是自己子项目的 子项目 |
| | | if (sParent.Length >= oDept.HOldNumber.Length) |
| | | { |
| | | if (sParent.Substring(0, oDept.HOldNumber.ToString().Length) == oDept.HOldNumber.Trim()) |
| | | { |
| | | MessageBox.Show("新代码不能是自己的下级的子项目!", "提示"); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | oDept.HOldNumber = ""; |
| | | } |
| | | //if (oDeptHlp.GetInfoByID(HItemID)) |
| | | //{ |
| | | // oDept.HOldNumber = oDeptHlp.omodel.HNumber; |
| | | // //是否新代码是自己子项目的 子项目 |
| | | // if (sParent.Length >= oDept.HOldNumber.Length) |
| | | // { |
| | | // if (sParent.Substring(0, oDept.HOldNumber.ToString().Length) == oDept.HOldNumber.Trim()) |
| | | // { |
| | | // MessageBox.Show("新代码不能是自己的下级的子项目!", "提示"); |
| | | // return false; |
| | | // } |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // oDept.HOldNumber = ""; |
| | | //} |
| | | //写入信息 |
| | | oDept.oModel.HShortNumber = sShortNumber; |
| | | oDept.oModel.HEndFlag = true; |