public void DepartmentHistoryAdd(T_HR_DEPARTMENTHISTORY entity) { using (DepartmentHistoryBLL bll = new DepartmentHistoryBLL()) { bll.DepartmentHistoryAdd(entity); } }
public DepartmentHistoryForm(T_HR_DEPARTMENTHISTORY companydepart, string companyName) { InitializeComponent(); InitControlEvent(); Department = companydepart; //公司名称 txtCompanyName.Text = companyName; //绑定部门字典 client.GetDepartmentDictionaryAllAsync(); this.IsEnabled = false; }
private TreeViewItem GetParentItemFromChild1(TreeViewItem item, string parentType, string parentID) { TreeViewItem tmpItem = null; if (item.Tag != null && item.Tag.ToString() == parentType) { switch (parentType) { case "0": T_HR_COMPANYHISTORY tmpOrg = item.DataContext as T_HR_COMPANYHISTORY; if (tmpOrg != null) { if (tmpOrg.COMPANYID == parentID) { return(item); } } break; case "1": T_HR_DEPARTMENTHISTORY tmpDep = item.DataContext as T_HR_DEPARTMENTHISTORY; if (tmpDep != null) { if (tmpDep.DEPARTMENTID == parentID) { return(item); } } break; } } if (item.Items != null && item.Items.Count > 0) { foreach (TreeViewItem childitem in item.Items) { tmpItem = GetParentItemFromChild1(childitem, parentType, parentID); if (tmpItem != null) { break; } } } return(tmpItem); }
public void Audit() { T_HR_DEPARTMENTHISTORY depHis = new T_HR_DEPARTMENTHISTORY(); depHis.RECORDSID = Guid.NewGuid().ToString(); depHis.DEPARTMENTID = Department.DEPARTMENTID; depHis.T_HR_DEPARTMENTDICTIONARY = Department.T_HR_DEPARTMENTDICTIONARY; depHis.COMPANYID = Department.T_HR_COMPANY.COMPANYID; depHis.DEPARTMENTFUNCTION = Department.DEPARTMENTFUNCTION; depHis.EDITSTATE = Department.EDITSTATE; if (Department.EDITSTATE == Convert.ToInt32(EditStates.PendingCanceled).ToString()) { depHis.CANCELDATE = DateTime.Now; } depHis.REUSEDATE = DateTime.Now; depHis.CREATEDATE = Department.CREATEDATE; depHis.CREATEUSERID = Department.CREATEUSERID; depHis.UPDATEDATE = DateTime.Now; depHis.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; client.DepartmentHistoryAddAsync(depHis); }
/// <summary> /// 变更公司部门 /// </summary> /// <param name="entity">公司部门实例</param> public void DepartmentUpdate(T_HR_DEPARTMENT entity) { try { var temp = dal.GetObjects().FirstOrDefault(s => s.T_HR_COMPANY.COMPANYID == entity.T_HR_COMPANY.COMPANYID && s.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTCODE == entity.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTCODE && s.DEPARTMENTID != entity.DEPARTMENTID); if (temp != null) { throw new Exception("Repetition"); } var ents = from ent in dal.GetObjects() where ent.DEPARTMENTID == entity.DEPARTMENTID select ent; if (ents.Count() > 0) { var ent = ents.FirstOrDefault(); Utility.CloneEntity <T_HR_DEPARTMENT>(entity, ent); if (entity.T_HR_DEPARTMENTDICTIONARY != null) { ent.T_HR_DEPARTMENTDICTIONARYReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_DEPARTMENTDICTIONARY", "DEPARTMENTDICTIONARYID", entity.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID); } if (entity.T_HR_COMPANY != null) { ent.T_HR_COMPANYReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_COMPANY", "COMPANYID", entity.T_HR_COMPANY.COMPANYID); } //如果审核状态为审核通过则添加部门历史 if (entity.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString()) { T_HR_DEPARTMENTHISTORY departmentHis = new T_HR_DEPARTMENTHISTORY(); departmentHis.RECORDSID = Guid.NewGuid().ToString(); departmentHis.DEPARTMENTID = entity.DEPARTMENTID; departmentHis.DEPARTMENTFUNCTION = entity.DEPARTMENTFUNCTION; departmentHis.EDITSTATE = entity.EDITSTATE; departmentHis.COMPANYID = entity.T_HR_COMPANY.COMPANYID; departmentHis.CREATEUSERID = entity.CREATEUSERID; departmentHis.CREATEDATE = entity.CREATEDATE; departmentHis.OWNERCOMPANYID = entity.OWNERCOMPANYID; departmentHis.OWNERDEPARTMENTID = entity.OWNERDEPARTMENTID; departmentHis.OWNERID = entity.OWNERDEPARTMENTID; departmentHis.OWNERPOSTID = entity.OWNERPOSTID; departmentHis.UPDATEDATE = entity.UPDATEDATE; departmentHis.UPDATEUSERID = entity.UPDATEUSERID; if (entity.T_HR_DEPARTMENTDICTIONARY != null) { departmentHis.T_HR_DEPARTMENTDICTIONARYReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_DEPARTMENTDICTIONARY", "DEPARTMENTDICTIONARYID", entity.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTDICTIONARYID); } departmentHis.REUSEDATE = DateTime.Now; if (entity.EDITSTATE == Convert.ToInt32(EditStates.PendingCanceled).ToString()) { departmentHis.CANCELDATE = DateTime.Now; } //DataContext.AddObject("T_HR_DEPARTMENTHISTORY", departmentHis); dal.AddToContext(departmentHis); } dal.SaveContextChanges(); //DataContext.SaveChanges(); CacheManager.RemoveCache("T_HR_DEPARTMENT"); //WorkflowUtility.CallWorkflow("部门变更审核工作流", ent); } } catch (Exception ex) { throw (ex); } }