コード例 #1
0
 public void PostHistoryAdd(T_HR_POSTHISTORY entity)
 {
     using (PostHistoryBLL bll = new PostHistoryBLL())
     {
         bll.PostHistoryAdd(entity);
     }
 }
コード例 #2
0
ファイル: PostHistoryForm.xaml.cs プロジェクト: JuRogn/OA
 public PostHistoryForm(T_HR_POSTHISTORY posHis,string companyName,string departName)
 {
     InitializeComponent();
     InitControlEvent();
     Post = posHis;
     //公司名称
     txtCpyName.Text = companyName;
     txtDepartName.Text = departName;
     //绑定部门字典
     client.GetPostDictionaryAllAsync();
     this.IsEnabled = false;
 }
コード例 #3
0
ファイル: PostHistoryForm.xaml.cs プロジェクト: jjg0519/OA
 public PostHistoryForm(T_HR_POSTHISTORY posHis, string companyName, string departName)
 {
     InitializeComponent();
     InitControlEvent();
     Post = posHis;
     //公司名称
     txtCpyName.Text    = companyName;
     txtDepartName.Text = departName;
     //绑定部门字典
     client.GetPostDictionaryAllAsync();
     this.IsEnabled = false;
 }
コード例 #4
0
        private void treeOrganization_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (treeOrganization.Items.Count <= 0)
            {
                return;
            }
            Container.Children.Clear();
            TreeViewItem           selectedItem = treeOrganization.SelectedItem as TreeViewItem;
            T_HR_COMPANYHISTORY    Company;
            T_HR_DEPARTMENTHISTORY Orgdepart;

            if (selectedItem == null)
            {
                loadbar.Stop();
                return;
            }
            switch (selectedItem.Tag.ToString())
            {
            case "0":
                Company = selectedItem.DataContext as T_HR_COMPANYHISTORY;
                CompanyHistoryForm orgForm = new CompanyHistoryForm(Company);
                Container.Children.Add(orgForm);
                break;

            case "1":
                Orgdepart = selectedItem.DataContext as T_HR_DEPARTMENTHISTORY;
                Company   = selectedItem.GetParentTreeViewItem().DataContext as T_HR_COMPANYHISTORY;
                if (Company != null)
                {
                    DepartmentHistoryForm depForm = new DepartmentHistoryForm(Orgdepart, Company.CNAME);
                    Container.Children.Add(depForm);
                }
                break;

            case "2":
                T_HR_POSTHISTORY Post = selectedItem.DataContext as T_HR_POSTHISTORY;
                Company   = selectedItem.GetParentTreeViewItem().GetParentTreeViewItem().DataContext as T_HR_COMPANYHISTORY;
                Orgdepart = selectedItem.GetParentTreeViewItem().DataContext as T_HR_DEPARTMENTHISTORY;
                if (Company != null && Orgdepart != null)
                {
                    PostHistoryForm posForm = new PostHistoryForm(Post, Company.CNAME, Orgdepart.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME);
                    Container.Children.Add(posForm);
                }
                break;
            }
            loadbar.Stop();
        }
コード例 #5
0
 public void PostHistoryAdd(T_HR_POSTHISTORY entity)
 {
     using (PostHistoryBLL bll = new PostHistoryBLL())
     {
         bll.PostHistoryAdd(entity);
     }
 }
コード例 #6
0
ファイル: PostBLL.cs プロジェクト: jjg0519/OA
        /// <summary>
        /// 修改岗位
        /// </summary>
        /// <param name="entity">岗位信息实例</param>
        public void PostUpdate(T_HR_POST entity, ref string strMsg)
        {
            try
            {
                string checkState = Convert.ToInt32(CheckStates.Approved).ToString();
                string editState  = Convert.ToInt32(EditStates.Actived).ToString();
                var    temp       = dal.GetObjects().FirstOrDefault(s => s.T_HR_DEPARTMENT.DEPARTMENTID == entity.T_HR_DEPARTMENT.DEPARTMENTID &&
                                                                    s.T_HR_POSTDICTIONARY.POSTCODE == entity.T_HR_POSTDICTIONARY.POSTCODE && s.POSTID != entity.POSTID &&
                                                                    s.CHECKSTATE == checkState && s.EDITSTATE == editState);
                if (temp != null)
                {
                    // throw new Exception("Repetition");
                    strMsg = "Repetition";
                    return;
                }
                var ents = from ent in dal.GetObjects()
                           where ent.POSTID == entity.POSTID
                           select ent;
                if (ents.Count() > 0)
                {
                    var ent = ents.FirstOrDefault();
                    Utility.CloneEntity <T_HR_POST>(entity, ent);
                    ////岗位编置有变动就需要发起工作流
                    //if (ent.POSTNUMBER.GetValueOrDefault() != ent.POSTNUMBER.GetValueOrDefault())
                    //{
                    //    WorkflowUtility.CallWorkflow("岗位编制变更申请工作流", ent);
                    //}

                    //岗位字典
                    ent.T_HR_POSTDICTIONARY                    = new T_HR_POSTDICTIONARY();
                    ent.T_HR_POSTDICTIONARY.EntityKey          = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTDICTIONARY", "POSTDICTIONARYID", entity.T_HR_POSTDICTIONARY.POSTDICTIONARYID);
                    ent.T_HR_POSTDICTIONARYReference.EntityKey =
                        new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTDICTIONARY", "POSTDICTIONARYID", entity.T_HR_POSTDICTIONARY.POSTDICTIONARYID);
                    //部门
                    ent.T_HR_DEPARTMENT           = new T_HR_DEPARTMENT();
                    ent.T_HR_DEPARTMENT.EntityKey =
                        new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_DEPARTMENT", "DEPARTMENTID", entity.T_HR_DEPARTMENT.DEPARTMENTID);

                    ent.T_HR_DEPARTMENTReference.EntityKey =
                        new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_DEPARTMENT", "DEPARTMENTID", entity.T_HR_DEPARTMENT.DEPARTMENTID);
                    ent.UPDATEDATE = System.DateTime.Now;
                    Update(ent);
                    //DataContext.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Modified);

                    //DataContext.SaveChanges();
                    //如果审核状态为审核通过则添加岗位历史
                    if (entity.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString())
                    {
                        PostHistoryBLL   phbll   = new PostHistoryBLL();
                        T_HR_POSTHISTORY postHis = new T_HR_POSTHISTORY();
                        postHis.RECORDSID = Guid.NewGuid().ToString();
                        //postHis = Utility.CloneObject<T_HR_POSTHISTORY>(entity);
                        postHis.CHANGEPOST        = entity.CHANGEPOST;
                        postHis.COMPANYID         = entity.COMPANYID;
                        postHis.CREATEUSERID      = entity.CREATEUSERID;
                        postHis.CREATEDATE        = entity.CREATEDATE;
                        postHis.DEPARTMENTNAME    = entity.DEPARTMENTNAME;
                        postHis.FATHERPOSTID      = entity.FATHERPOSTID;
                        postHis.OWNERCOMPANYID    = entity.OWNERCOMPANYID;
                        postHis.OWNERDEPARTMENTID = entity.OWNERDEPARTMENTID;
                        postHis.OWNERID           = entity.OWNERID;
                        postHis.OWNERPOSTID       = entity.OWNERPOSTID;
                        postHis.POSTFUNCTION      = entity.POSTFUNCTION;
                        postHis.POSTGOAL          = entity.POSTGOAL;
                        postHis.POSTID            = entity.POSTID;
                        postHis.POSTNUMBER        = entity.POSTNUMBER;
                        postHis.UNDERNUMBER       = entity.UNDERNUMBER;
                        postHis.UPDATEDATE        = entity.UPDATEDATE;
                        postHis.UPDATEUSERID      = entity.UPDATEUSERID;
                        postHis.PROMOTEDIRECTION  = entity.PROMOTEDIRECTION;
                        postHis.DEPARTMENTID      = entity.T_HR_DEPARTMENT.DEPARTMENTID;
                        //if (entity.T_HR_POSTDICTIONARY != null)
                        //{
                        //    postHis.T_HR_POSTDICTIONARYReference.EntityKey =
                        // new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTDICTIONARY", "POSTDICTIONARYID", entity.T_HR_POSTDICTIONARY.POSTDICTIONARYID);
                        //}
                        postHis.T_HR_POSTDICTIONARY = new T_HR_POSTDICTIONARY();
                        postHis.T_HR_POSTDICTIONARY.POSTDICTIONARYID = entity.T_HR_POSTDICTIONARY.POSTDICTIONARYID;
                        postHis.REUSEDATE = DateTime.Now;
                        if (entity.EDITSTATE == Convert.ToInt32(EditStates.PendingCanceled).ToString())
                        {
                            postHis.CANCELDATE = DateTime.Now;
                        }
                        //  DataContext.AddObject("T_HR_POSTHISTORY", postHis);
                        phbll.PostHistoryAdd(postHis);
                        new CompanyBLL().EditVersion("岗位");
                    }

                    //   DataContext.SaveChanges();
                    //WorkflowUtility.CallWorkflow("岗位变更申请审核工作流", ent);
                }
            }
            catch (Exception ex)
            {
                strMsg = ex.Message;
                SMT.Foundation.Log.Tracer.Debug(System.DateTime.Now.ToString() + " PostUpdate:" + ex.Message);
                throw ex;
            }
        }
コード例 #7
0
ファイル: 缓存 PostBLL.cs プロジェクト: jjg0519/OA
        /// <summary>
        /// 修改岗位
        /// </summary>
        /// <param name="entity">岗位信息实例</param>
        public void PostUpdate(T_HR_POST entity)
        {
            try
            {
                var temp = dal.GetObjects().FirstOrDefault(s => s.T_HR_DEPARTMENT.DEPARTMENTID == entity.T_HR_DEPARTMENT.DEPARTMENTID &&
                                                           s.T_HR_POSTDICTIONARY.POSTCODE == entity.T_HR_POSTDICTIONARY.POSTCODE && s.POSTID != entity.POSTID);
                if (temp != null)
                {
                    throw new Exception("Repetition");
                }
                var ents = from ent in dal.GetObjects()
                           where ent.POSTID == entity.POSTID
                           select ent;
                if (ents.Count() > 0)
                {
                    var ent = ents.FirstOrDefault();
                    Utility.CloneEntity <T_HR_POST>(entity, ent);
                    ////岗位编置有变动就需要发起工作流
                    //if (ent.POSTNUMBER.GetValueOrDefault() != ent.POSTNUMBER.GetValueOrDefault())
                    //{
                    //    WorkflowUtility.CallWorkflow("岗位编制变更申请工作流", ent);
                    //}

                    //岗位字典
                    ent.T_HR_POSTDICTIONARYReference.EntityKey =
                        new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTDICTIONARY", "POSTDICTIONARYID", entity.T_HR_POSTDICTIONARY.POSTDICTIONARYID);
                    //部门
                    ent.T_HR_DEPARTMENTReference.EntityKey =
                        new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_DEPARTMENT", "DEPARTMENTID", entity.T_HR_DEPARTMENT.DEPARTMENTID);

                    //如果审核状态为审核通过则添加岗位历史
                    if (entity.CHECKSTATE == Convert.ToInt32(CheckStates.Approved).ToString())
                    {
                        T_HR_POSTHISTORY postHis = new T_HR_POSTHISTORY();
                        postHis.RECORDSID = Guid.NewGuid().ToString();
                        //postHis = Utility.CloneObject<T_HR_POSTHISTORY>(entity);
                        postHis.CHANGEPOST        = entity.CHANGEPOST;
                        postHis.COMPANYID         = entity.COMPANYID;
                        postHis.CREATEUSERID      = entity.CREATEUSERID;
                        postHis.CREATEDATE        = entity.CREATEDATE;
                        postHis.DEPARTMENTNAME    = entity.DEPARTMENTNAME;
                        postHis.FATHERPOSTID      = entity.FATHERPOSTID;
                        postHis.OWNERCOMPANYID    = entity.OWNERCOMPANYID;
                        postHis.OWNERDEPARTMENTID = entity.OWNERDEPARTMENTID;
                        postHis.OWNERID           = entity.OWNERID;
                        postHis.OWNERPOSTID       = entity.OWNERPOSTID;
                        postHis.POSTFUNCTION      = entity.POSTFUNCTION;
                        postHis.POSTGOAL          = entity.POSTGOAL;
                        postHis.POSTID            = entity.POSTID;
                        postHis.POSTNUMBER        = entity.POSTNUMBER;
                        postHis.UNDERNUMBER       = entity.UNDERNUMBER;
                        postHis.UPDATEDATE        = entity.UPDATEDATE;
                        postHis.UPDATEUSERID      = entity.UPDATEUSERID;
                        postHis.PROMOTEDIRECTION  = entity.PROMOTEDIRECTION;
                        postHis.DEPARTMENTID      = entity.T_HR_DEPARTMENT.DEPARTMENTID;
                        if (entity.T_HR_POSTDICTIONARY != null)
                        {
                            postHis.T_HR_POSTDICTIONARYReference.EntityKey =
                                new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_POSTDICTIONARY", "POSTDICTIONARYID", entity.T_HR_POSTDICTIONARY.POSTDICTIONARYID);
                        }
                        postHis.REUSEDATE = DateTime.Now;
                        if (entity.EDITSTATE == Convert.ToInt32(EditStates.PendingCanceled).ToString())
                        {
                            postHis.CANCELDATE = DateTime.Now;
                        }
                        //DataContext.AddObject("T_HR_POSTHISTORY", postHis);
                        dal.AddToContext(postHis);
                    }
                    dal.SaveContextChanges();
                    //DataContext.SaveChanges();
                    CacheManagerMem.RemoveCache("T_HR_POST");
                    //WorkflowUtility.CallWorkflow("岗位变更申请审核工作流", ent);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }