Exemplo n.º 1
0
        /// <summary>
        /// 批量添加员工薪资结算岗位
        /// </summary>
        /// <param name="obj"> 薪资结算岗位实例集合</param>
        public bool BalancePostsLotsofUpdate(T_HR_EMPLOYEESALARYPOSTASIGN asign, List <T_HR_BALANCEPOSTDETAIL> objs)
        {
            bool isReturn = true;

            try
            {
                var ents = from ent in dal.GetObjects <T_HR_BALANCEPOSTDETAIL>()
                           where ent.BALANCEPOSTASIGNID == asign.EMPLOYEESALARYPOSTASIGNID
                           select ent;
                //UpdateCheckState("T_HR_EMPLOYEESALARYPOSTASIGN", "EMPLOYEESALARYPOSTASIGNID", asign.EMPLOYEESALARYPOSTASIGNID, "1");
                int addCount = 0;
                foreach (T_HR_BALANCEPOSTDETAIL obj in objs)
                {
                    var exist = from ent in ents
                                where ent.BALANCEPOSTDETAIL == obj.BALANCEPOSTDETAIL
                                select ent;
                    if (exist.Count() == 0)
                    {
                        obj.CREATEDATE = DateTime.Now;
                        obj.EDITSTATE  = "0";
                        dal.AddToContext(obj);
                        addCount++;
                    }
                    else
                    {
                        //修改
                        T_HR_BALANCEPOSTDETAIL old = exist.FirstOrDefault();
                        Utility.CloneEntity <T_HR_BALANCEPOSTDETAIL>(obj, old);
                        old.UPDATEDATE = DateTime.Now;
                        dal.UpdateFromContext(old);
                        addCount++;
                    }
                }
                //删除没传递过来的数据
                int delCount = 0;
                foreach (T_HR_BALANCEPOSTDETAIL obj in ents)
                {
                    var exist = from ent in objs
                                where ent.BALANCEPOSTDETAIL == obj.BALANCEPOSTDETAIL
                                select ent;
                    if (exist.Count() == 0)
                    {
                        obj.CREATEDATE = DateTime.Now;
                        dal.DeleteFromContext(obj);
                        delCount++;
                    }
                }

                if (addCount > 0 || delCount > 0)
                {
                    return(dal.SaveContextChanges() > 0 ? true : false);
                }
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug("BalancePostsLotsofADD:" + ex.Message);
                throw ex;
            }
            return(isReturn);
        }
        private void dgIssunanceObj_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            T_HR_BALANCEPOSTDETAIL detail = (T_HR_BALANCEPOSTDETAIL)e.Row.DataContext;


            TextBlock attendancetbl = dgIssunanceObj.Columns[4].GetCellContent(e.Row).FindName("attendancetbl") as TextBlock;
            TextBlock salarytbl     = dgIssunanceObj.Columns[5].GetCellContent(e.Row).FindName("salarytbl") as TextBlock;

            int index = e.Row.GetIndex();
            var cell  = dgIssunanceObj.Columns[0].GetCellContent(e.Row) as TextBlock;

            cell.Text = (index + 1).ToString();

            if (detail.ATTENDANCESET == "1")
            {
                attendancetbl.Text = "是";
            }
            else
            {
                attendancetbl.Text = "否";
            }
            if (detail.SALARYSET == "1")
            {
                salarytbl.Text = "是";
            }
            else
            {
                salarytbl.Text = "否";
            }
        }
        void personnerClient_GetEmployeesPostBriefByEmployeeIDCompleted(object sender, GetEmployeesPostBriefByEmployeeIDCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            if (e.Error != null && !string.IsNullOrEmpty(e.Error.Message))
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
            }
            else
            {
                List <V_EMPLOYEEDETAIL> employees = new List <V_EMPLOYEEDETAIL>();
                if (e.Result != null)
                {
                    employees = e.Result.ToList();
                }
                foreach (var ent in employees)
                {
                    ExtOrgObj objPerson = new ExtOrgObj();
                    objPerson.ObjectID   = ent.EMPLOYEEID;
                    objPerson.ObjectName = ent.EMPLOYEENAME;
                    objPerson.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel;
                    var ExistEnts = from ext in entall
                                    where ext.ObjectID == objPerson.ObjectID &&
                                    ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel
                                    select ext;
                    if (ExistEnts.Count() == 0)
                    {
                        T_HR_BALANCEPOSTDETAIL detail = new T_HR_BALANCEPOSTDETAIL();
                        detail.BALANCEPOSTDETAIL  = Guid.NewGuid().ToString();
                        detail.BALANCEPOSTASIGNID = EmployeeAddBalancePost.EMPLOYEESALARYPOSTASIGNID;
                        detail.EMPLOYEEID         = ent.EMPLOYEEID;
                        detail.EMPLOYEENAME       = ent.EMPLOYEENAME;

                        var ents = from ent1 in ent.EMPLOYEEPOSTS
                                   where ent1.ISAGENCY == "0"
                                   select ent1;
                        if (ents.Count() > 0)
                        {
                            detail.EMPLOYEEPOSTID         = ents.FirstOrDefault().POSTID;
                            detail.EMPLOYEEPOSTNAME       = ents.FirstOrDefault().PostName;
                            detail.EMPLOYEEDEPARTMENTID   = ents.FirstOrDefault().DepartmentID;
                            detail.EMPLOYEEDEPARTMENTNAME = ents.FirstOrDefault().DepartmentName;
                            detail.EMPLOYEECOMPANYID      = ents.FirstOrDefault().CompanyID;
                            detail.EMPLOYEECOMPANYNAME    = ents.FirstOrDefault().CompanyName;
                        }
                        //detail.EDITSTATE = "0";
                        detail.CREATEUSERID     = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        detail.UPDATEDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        detail.CREATEDATE       = DateTime.Now;
                        detail.UPDATEDATE       = DateTime.Now;
                        EmployeeBalanceInfoList.Add(detail);
                        objPerson.ObjectName = ent.EMPLOYEENAME + "-" + detail.EMPLOYEEPOSTNAME + "-" + detail.EMPLOYEEDEPARTMENTNAME + "-" + detail.EMPLOYEECOMPANYNAME;
                        entall.Add(objPerson);
                    }
                }
                issuanceExtOrgObj = entall;
                //BindData();
            }
        }
        void personnerClient_GetEmployeesPostBriefByEmployeeIDCompleted(object sender, GetEmployeesPostBriefByEmployeeIDCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            if (e.Error != null && !string.IsNullOrEmpty(e.Error.Message))
            {
                ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
            }
            else
            {
                List<V_EMPLOYEEDETAIL> employees = new List<V_EMPLOYEEDETAIL>();
                if (e.Result != null)
                {
                    employees = e.Result.ToList();
                }
                foreach (var ent in employees)
                {
                    ExtOrgObj objPerson = new ExtOrgObj();
                    objPerson.ObjectID = ent.EMPLOYEEID;
                    objPerson.ObjectName = ent.EMPLOYEENAME;
                    objPerson.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel;
                    var ExistEnts = from ext in entall
                                    where ext.ObjectID == objPerson.ObjectID
                                    && ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Personnel
                                    select ext;
                    if (ExistEnts.Count() == 0)
                    {
                        
                        T_HR_BALANCEPOSTDETAIL detail = new T_HR_BALANCEPOSTDETAIL();
                        detail.BALANCEPOSTDETAIL = Guid.NewGuid().ToString();
                        detail.BALANCEPOSTASIGNID = EmployeeAddBalancePost.EMPLOYEESALARYPOSTASIGNID;
                        detail.EMPLOYEEID = ent.EMPLOYEEID;
                        detail.EMPLOYEENAME = ent.EMPLOYEENAME;
                        
                        var ents = from ent1 in ent.EMPLOYEEPOSTS
                                   where ent1.ISAGENCY =="0"
                                   select ent1;
                        if (ents.Count() > 0)
                        {
                            detail.EMPLOYEEPOSTID = ents.FirstOrDefault().POSTID;
                            detail.EMPLOYEEPOSTNAME = ents.FirstOrDefault().PostName;
                            detail.EMPLOYEEDEPARTMENTID = ents.FirstOrDefault().DepartmentID;
                            detail.EMPLOYEEDEPARTMENTNAME = ents.FirstOrDefault().DepartmentName;
                            detail.EMPLOYEECOMPANYID = ents.FirstOrDefault().CompanyID;
                            detail.EMPLOYEECOMPANYNAME = ents.FirstOrDefault().CompanyName;
                        }
                        //detail.EDITSTATE = "0";
                        detail.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        detail.UPDATEDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                        detail.CREATEDATE = DateTime.Now;
                        detail.UPDATEDATE = DateTime.Now;
                        EmployeeBalanceInfoList.Add(detail);
                        objPerson.ObjectName = ent.EMPLOYEENAME + "-"+ detail.EMPLOYEEPOSTNAME+"-"+ detail.EMPLOYEEDEPARTMENTNAME+"-"+ detail.EMPLOYEECOMPANYNAME;
                        entall.Add(objPerson);
                    }
                }
                issuanceExtOrgObj = entall;
                //BindData();
 
            }
            
        }
Exemplo n.º 5
0
        public void UpdateEmployeeSalaryInfo(T_HR_EMPLOYEESALARYPOSTASIGN asign)
        {
            try
            {
                var balancePost = from c in dal.GetObjects <T_HR_BALANCEPOSTDETAIL>()
                                  where c.BALANCEPOSTASIGNID == asign.EMPLOYEESALARYPOSTASIGNID
                                  //&& c.SALARYSET =="1"
                                  select c;
                var entPosts = from p in dal.GetObjects <T_HR_POST>()
                               where p.POSTID == asign.BALANCEPOSTID
                               select p;
                string payCompanyId = string.Empty;
                if (entPosts.Count() > 0)
                {
                    T_HR_POST post = entPosts.FirstOrDefault();
                    if (post != null)
                    {
                        payCompanyId = post.OWNERCOMPANYID;
                    }
                    else
                    {
                        SMT.Foundation.Log.Tracer.Debug("UpdateEmployeeSalaryInfo获取岗位信息为空:");
                    }
                }
                else
                {
                    SMT.Foundation.Log.Tracer.Debug("UpdateEmployeeSalaryInfo获取岗位信息为空22222");
                }
                List <string> employeeIDs = new List <string>();
                //岗位ID集合
                List <string> SalarypostIDs     = new List <string>();
                List <string> AttendancepostIDs = new List <string>();
                if (balancePost.Count() > 0)
                {
                    foreach (var ent in balancePost)
                    {
                        employeeIDs.Add(ent.EMPLOYEEID);
                        if (ent.SALARYSET == "1")
                        {
                            //只有薪资岗位设置了才修改员工薪资档案中的结算岗位信息
                            SalarypostIDs.Add(ent.EMPLOYEEPOSTID);
                        }
                        if (ent.ATTENDANCESET == "1")
                        {
                            //考勤结算对应的岗位ID
                            AttendancepostIDs.Add(ent.EMPLOYEEPOSTID);
                        }
                        ent.EDITSTATE = "1";
                        dal.UpdateFromContext(ent);
                    }
                    #region 将原来的记录设置为失效

                    var balancePost1 = from c in dal.GetObjects <T_HR_BALANCEPOSTDETAIL>()
                                       //where employeeIDs.Contains(c.EMPLOYEEID)
                                       where SalarypostIDs.Contains(c.EMPLOYEEPOSTID) ||
                                       AttendancepostIDs.Contains(c.EMPLOYEEPOSTID)
                                       //&& c.SALARYSET == "1"
                                       select c;
                    //foreach (var id in employeeIDs)
                    //{
                    //    var entemployees = from ent in balancePost1
                    //                       where ent.EMPLOYEEID == id
                    //                       && ent.EDITSTATE == "1"
                    //                       orderby ent.CREATEDATE descending
                    //                       select ent;
                    //    if (entemployees.Count() > 0)
                    //    {
                    //        T_HR_BALANCEPOSTDETAIL updateDetail = entemployees.FirstOrDefault();
                    //        updateDetail.EDITSTATE = "0";
                    //        dal.UpdateFromContext(updateDetail);
                    //        SMT.Foundation.Log.Tracer.Debug(updateDetail.EMPLOYEENAME + updateDetail.BALANCEPOSTDETAIL + "已修改");
                    //    }
                    //}
                    foreach (var id in SalarypostIDs)
                    {
                        var entemployees = from ent in balancePost1
                                           where ent.EMPLOYEEPOSTID == id &&
                                           ent.EDITSTATE == "1"
                                           orderby ent.CREATEDATE descending
                                           select ent;
                        if (entemployees.Count() > 0)
                        {
                            T_HR_BALANCEPOSTDETAIL updateDetail = entemployees.FirstOrDefault();
                            updateDetail.EDITSTATE = "0";
                            dal.UpdateFromContext(updateDetail);
                            SMT.Foundation.Log.Tracer.Debug(updateDetail.EMPLOYEENAME + updateDetail.BALANCEPOSTDETAIL + "已修改");
                        }
                    }
                    //考勤设置对应的岗位ID
                    foreach (var id in AttendancepostIDs)
                    {
                        var entemployees = from ent in balancePost1
                                           where ent.EMPLOYEEPOSTID == id &&
                                           ent.EDITSTATE == "1"
                                           orderby ent.CREATEDATE descending
                                           select ent;
                        if (entemployees.Count() > 0)
                        {
                            T_HR_BALANCEPOSTDETAIL updateDetail = entemployees.FirstOrDefault();
                            updateDetail.EDITSTATE = "0";
                            dal.UpdateFromContext(updateDetail);
                            SMT.Foundation.Log.Tracer.Debug(updateDetail.EMPLOYEENAME + updateDetail.BALANCEPOSTDETAIL + "已修改");
                        }
                    }
                    #endregion
                }
                //var Salarys = from ent in dal.GetObjects<T_HR_SALARYARCHIVE>()
                //              where employeeIDs.Contains(ent.EMPLOYEEID)
                //              && ent.CHECKSTATE == "2"
                //              orderby ent.CREATEDATE descending
                //              select ent;
                //有薪资岗位设置才进行员工岗位变更操作
                if (SalarypostIDs.Count() > 0)
                {
                    var entEmployeePosts = from ent in dal.GetObjects <T_HR_EMPLOYEEPOST>().Include("T_HR_POST").Include("T_HR_EMPLOYEE")
                                           where SalarypostIDs.Contains(ent.T_HR_POST.POSTID) &&
                                           ent.CHECKSTATE == "2" && ent.ISAGENCY == "0" &&
                                           ent.EDITSTATE == "1"
                                           select ent;
                    List <string> postEmployeeIDs = new List <string>();
                    foreach (var a in entEmployeePosts)
                    {
                        postEmployeeIDs.Add(a.T_HR_EMPLOYEE.EMPLOYEEID);
                    }

                    //var Salarys = from ent in dal.GetObjects<T_HR_SALARYARCHIVE>()
                    //              where SalarypostIDs.Contains(ent.EMPLOYEEPOSTID)
                    //              && ent.CHECKSTATE == "2"
                    //              orderby ent.CREATEDATE descending
                    //              select ent;
                    var Salarys = from ent in dal.GetObjects <T_HR_SALARYARCHIVE>()
                                  where postEmployeeIDs.Contains(ent.EMPLOYEEID) &&
                                  ent.CHECKSTATE == "2"
                                  orderby ent.CREATEDATE descending
                                  select ent;
                    List <T_HR_SALARYARCHIVE> updateSalary = new List <T_HR_SALARYARCHIVE>();
                    if (Salarys.Count() > 0)
                    {
                        foreach (var ent in Salarys)
                        {
                            var entFirst = from a in Salarys
                                           where a.EMPLOYEEID == ent.EMPLOYEEID
                                           orderby a.CREATEDATE descending
                                           select a;
                            if (entFirst.Count() > 0)
                            {
                                T_HR_SALARYARCHIVE archive = entFirst.FirstOrDefault();
                                if (updateSalary.Count() == 0)
                                {
                                    updateSalary.Add(archive);
                                }
                                else
                                {
                                    var exists = from b in updateSalary
                                                 where b.SALARYARCHIVEID == archive.SALARYARCHIVEID
                                                 select b;
                                    if (exists.Count() == 0)
                                    {
                                        updateSalary.Add(archive);
                                    }
                                }
                            }
                        }
                    }
                    if (updateSalary.Count() > 0)
                    {
                        foreach (var ent in updateSalary)
                        {
                            SMT.Foundation.Log.Tracer.Debug(ent.EMPLOYEENAME + "原来结算岗位为:" + ent.BALANCEPOSTNAME + "岗位ID:" + ent.BALANCEPOSTID);
                            ent.BALANCEPOSTID   = asign.BALANCEPOSTID;
                            ent.BALANCEPOSTNAME = asign.BALANCEPOSTNAME;
                            if (!string.IsNullOrEmpty(payCompanyId))
                            {
                                ent.PAYCOMPANY = payCompanyId;
                            }
                            ent.OWNERCOMPANYID = asign.OWNERCOMPANYID;
                            dal.UpdateFromContext(ent);
                            SMT.Foundation.Log.Tracer.Debug(ent.EMPLOYEENAME + "修改为:" + ent.BALANCEPOSTNAME);
                        }
                    }
                }
                int i = dal.SaveContextChanges();
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug("UpdateEmployeeSalaryInfo执行时出错:" + ex.ToString());
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 检查是有其它员工没有分配薪资结算岗位
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="details"></param>
        /// <returns></returns>
        public string CheckEmployeeBalancePost(T_HR_EMPLOYEESALARYPOSTASIGN obj, List <T_HR_BALANCEPOSTDETAIL> details, ref string strCheck)
        {
            string str = string.Empty;

            try
            {
                //岗位ID
                List <string> listPosts = new List <string>();
                foreach (var ent in details)
                {
                    listPosts.Add(ent.EMPLOYEEPOSTID);
                }
                //生效的薪资结算或考勤结算变更
                var oldPosts = from ent in dal.GetObjects <T_HR_BALANCEPOSTDETAIL>()
                               where listPosts.Contains(ent.EMPLOYEEPOSTID) && ent.EDITSTATE == "1"
                               select ent;
                List <string> listOldAsigns = new List <string>();
                foreach (var ent in oldPosts)
                {
                    if (!listOldAsigns.Contains(ent.BALANCEPOSTASIGNID))
                    {
                        listOldAsigns.Add(ent.BALANCEPOSTASIGNID);
                    }
                }
                var oldAsings = from ent in dal.GetObjects <T_HR_EMPLOYEESALARYPOSTASIGN>()
                                where ent.EDITSTATE == "1" && listOldAsigns.Contains(ent.EMPLOYEESALARYPOSTASIGNID)
                                select ent;
                if (oldPosts.Count() > 0)
                {
                    foreach (var ent in oldPosts)
                    {
                        var existNew = from a in details
                                       where a.EMPLOYEEPOSTID == ent.EMPLOYEEPOSTID
                                       select a;
                        if (existNew.Count() > 0)
                        {
                            T_HR_BALANCEPOSTDETAIL newDetail = existNew.FirstOrDefault();
                            var existOldAsign = from b in oldAsings
                                                where b.EMPLOYEESALARYPOSTASIGNID == ent.BALANCEPOSTASIGNID
                                                select b;
                            if (existOldAsign.Count() > 0)
                            {
                                T_HR_EMPLOYEESALARYPOSTASIGN oldPostAsign = existOldAsign.FirstOrDefault();
                                if (ent.SALARYSET == "1")
                                {
                                    if (newDetail.SALARYSET == "1")
                                    {
                                        if (oldPostAsign.BALANCEPOSTNAME != obj.BALANCEPOSTNAME)
                                        {
                                            strCheck += "岗位:" + ent.EMPLOYEEPOSTNAME + "原来薪资结算岗位为:" + oldPostAsign.BALANCEPOSTNAME + ",现变更为:" + obj.BALANCEPOSTNAME + "。";
                                        }
                                    }
                                    else
                                    {
                                        strCheck += "岗位:" + ent.EMPLOYEEPOSTNAME + "原来薪资结算岗位为:" + oldPostAsign.BALANCEPOSTNAME + ",现变更为不设置。";
                                    }
                                }
                                else
                                {
                                    if (newDetail.SALARYSET == "1")
                                    {
                                        strCheck += "岗位:" + ent.EMPLOYEEPOSTNAME + "原来薪资结算岗位没有设置,现变更为:" + obj.BALANCEPOSTNAME + "。";
                                    }
                                }

                                if (ent.ATTENDANCESET == "1")
                                {
                                    if (newDetail.SALARYSET == "1")
                                    {
                                        if (oldPostAsign.BALANCEPOSTNAME != obj.BALANCEPOSTNAME)
                                        {
                                            strCheck += "岗位:" + ent.EMPLOYEEPOSTNAME + "原来考勤结算岗位为:" + oldPostAsign.BALANCEPOSTNAME + ",现变更为:" + obj.BALANCEPOSTNAME + "。";
                                        }
                                    }
                                    else
                                    {
                                        strCheck += "岗位:" + ent.EMPLOYEEPOSTNAME + "原来考勤结算岗位为:" + oldPostAsign.BALANCEPOSTNAME + ",现变更为不设置。";
                                    }
                                }
                                else
                                {
                                    if (newDetail.SALARYSET == "1")
                                    {
                                        strCheck += "岗位:" + ent.EMPLOYEEPOSTNAME + "原来考勤结算岗位没有设置,现变更为:" + obj.BALANCEPOSTNAME + "。";
                                    }
                                }

                                //strCheck += ent.EMPLOYEEPOSTNAME + "原来结算岗位为:" + oldPostAsign.BALANCEPOSTNAME + "。现变更为:" + obj.BALANCEPOSTNAME+"。";
                            }
                        }
                    }
                }
                #region 注释掉以前的员工判断,现在改成了结算岗位


                //var entEmployees = from ent in dal.GetObjects<T_HR_EMPLOYEE>()
                //                   where (ent.EMPLOYEESTATE == "0" || ent.EMPLOYEESTATE == "1" || ent.EMPLOYEESTATE == "3")
                //                   && ent.OWNERCOMPANYID == obj.OWNERCOMPANYID
                //                   select ent;
                //List<string> noIds = new List<string>();
                //List<string> DetailIds = new List<string>();
                //if (entEmployees.Count() > 0)
                //{
                //    foreach (var ent in entEmployees)
                //    {
                //        noIds.Add(ent.EMPLOYEEID);
                //    }
                //    foreach (var ent in details)
                //    {
                //        DetailIds.Add(ent.EMPLOYEEID);
                //    }
                //    if (noIds.Count() > 0)
                //    {
                //        //获取已存在的记录
                //        var entArchives = from ent in dal.GetObjects<T_HR_SALARYARCHIVE>()
                //                          where  DetailIds.Contains(ent.EMPLOYEEID) && ent.CHECKSTATE =="2"
                //                          select ent;
                //        if (entArchives.Count() > 0)
                //        {
                //            List<string> listPosts = new List<string>();
                //            foreach (var ent in entArchives)
                //            {
                //                listPosts.Add(ent.BALANCEPOSTID);
                //            }
                //            var entPosts = from e in dal.GetObjects<T_HR_POST>().Include("T_HR_POSTDICTIONARY")
                //                           where listPosts.Contains(e.POSTID)
                //                           select e;
                //            foreach (var ent in DetailIds)
                //            {
                //                var single = entArchives.Where(s => s.EMPLOYEEID == ent);
                //                if (single != null)
                //                {
                //                    var employeeArchive = single.OrderByDescending(s=>s.CREATEDATE).FirstOrDefault();
                //                    if (employeeArchive != null)
                //                    {
                //                        string postName = string.Empty;
                //                        if (employeeArchive.BALANCEPOSTID != null)
                //                        {
                //                            T_HR_POST post = entPosts.Where(s => s.POSTID == employeeArchive.BALANCEPOSTID).FirstOrDefault();
                //                            if (post != null)
                //                            {
                //                                if (post.T_HR_POSTDICTIONARY != null)
                //                                {
                //                                    postName = post.T_HR_POSTDICTIONARY.POSTNAME;
                //                                }
                //                            }
                //                            string strEmployee = employeeArchive.EMPLOYEENAME + "-原来的结算岗位为:" + postName;
                //                            if (strCheck.IndexOf(strEmployee) == -1)
                //                            {
                //                                strCheck += strEmployee + ",";
                //                            }
                //                        }
                //                    }
                //                }

                //            }
                //            if (!string.IsNullOrEmpty(strCheck))
                //            {
                //                if (strCheck.IndexOf(",") > -1)
                //                {
                //                    if (strCheck.LastIndexOf(",") == strCheck.Length - 1)
                //                    {
                //                        strCheck = strCheck.Substring(0, strCheck.Length - 1);
                //                    }
                //                }
                //                //strCheck = strCheck.Substring(0, strCheck.Length-1);
                //            }
                //        }
                //        List<string> noChanges = new List<string>();
                //        foreach (var ent in noIds)
                //        {
                //            var noEmployees = from ent1 in details
                //                              where ent1.EMPLOYEEID == ent
                //                              select ent1;
                //            if (noEmployees.Count() == 0)
                //            {
                //                noChanges.Add(ent);
                //            }
                //        }
                //        //没在岗位变更的员工
                //        var entDetails = from ent in entEmployees
                //                         where noChanges.Contains(ent.EMPLOYEEID)
                //                         select ent;
                //        ////存在且生效的数据
                //        var entExists = from ent in dal.GetObjects<T_HR_BALANCEPOSTDETAIL>()
                //                        where noChanges.Contains(ent.EMPLOYEEID)
                //                        && ent.EDITSTATE == "1"
                //                        select ent;

                //        if (entDetails.Count() > 0)
                //        {
                //            foreach (var ent in entDetails)
                //            {
                //                var exist = from a in entExists
                //                            where a.EMPLOYEEID == ent.EMPLOYEEID
                //                            select a;
                //                if (exist.Count() == 0)
                //                {
                //                    if (str.IndexOf(ent.EMPLOYEECNAME) == -1)
                //                    {
                //                        str += ent.EMPLOYEECNAME + ",";
                //                    }
                //                }
                //            }
                //            if (!string.IsNullOrEmpty(str))
                //            {
                //                if (str.IndexOf(",") > -1)
                //                {
                //                    if (str.LastIndexOf(",") == str.Length - 1)
                //                    {
                //                        str = str.Substring(0, str.Length - 1);
                //                    }
                //                }
                //                if (!string.IsNullOrEmpty(str))
                //                {
                //                    str += "。薪资结算岗位没有变更,是否保存";
                //                }
                //            }
                //        }
                //    }
                //}
                #endregion
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug("CheckEmployeeBalancePost:" + ex.Message);
                str = "error";
            }
            return(str);
        }
Exemplo n.º 7
0
 private void AddIssuanObj()
 {
     StrCompanyIDsList.Clear();
     StrDepartmentIDsList.Clear();
     StrPositionIDsList.Clear();
     entall = new List<ExtOrgObj>();
     SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup lookup = new SMT.SaaS.FrameworkUI.OrganizationControl.OrganizationLookup();
     lookup.SelectedObjType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post;
     lookup.SelectedClick += (obj, ev) =>
     {
         List<ExtOrgObj> ent = lookup.SelectedObj as List<ExtOrgObj>;
         if (ent != null && ent.Count > 0)
         {
             //issuanceExtOrgObj = ent;
             foreach (var h in ent)
             {   
                 if (h.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Post)//岗位
                 {
                     var entPosts = from entc in StrPositionIDsList
                                    where entc == h.ObjectID
                                    select entc;
                     if (entPosts.Count() == 0)
                     {
                         StrPositionIDsList.Add(h.ObjectID);
                     }
                 }
                 SMT.Saas.Tools.OrganizationWS.T_HR_POST ent1 = h.ObjectInstance as SMT.Saas.Tools.OrganizationWS.T_HR_POST;
                 
                 if (ent1 == null)
                 {
                     //Utility.ShowCustomMessage(MessageTypes.Message, "员工岗位", "当前选取的岗位为空");
                     ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "当前选取的岗位为空",
                 Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                     return;
                 }
                 string postID = string.Empty;
                 string postName = string.Empty;
                 string departID = string.Empty;
                 string departName = string.Empty;
                 string companyID = string.Empty;
                 string companyName = string.Empty;
                 postID = ent1.POSTID;
                 postName = ent1.T_HR_POSTDICTIONARY.POSTNAME;
                 if (ent1.T_HR_DEPARTMENT != null)
                 {
                     departID = ent1.T_HR_DEPARTMENT.DEPARTMENTID; 
                     if (ent1.T_HR_DEPARTMENT.T_HR_DEPARTMENTDICTIONARY != null)
                     {
                          departName =  ent1.T_HR_DEPARTMENT.T_HR_DEPARTMENTDICTIONARY.DEPARTMENTNAME;
                     }
                     if (ent1.T_HR_DEPARTMENT.T_HR_COMPANY != null)
                     {
                         companyID = ent1.T_HR_DEPARTMENT.T_HR_COMPANY.COMPANYID;
                         
                         if (!string.IsNullOrEmpty(ent1.T_HR_DEPARTMENT.T_HR_COMPANY.BRIEFNAME))
                         {
                             companyName = ent1.T_HR_DEPARTMENT.T_HR_COMPANY.BRIEFNAME;
                         }
                         else
                         {
                             companyName = ent1.T_HR_DEPARTMENT.T_HR_COMPANY.CNAME;
                         }
                     }
                 }
                 //ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "开始添加明细记录",
                 //Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                 T_HR_BALANCEPOSTDETAIL detail = new T_HR_BALANCEPOSTDETAIL();
                 detail.BALANCEPOSTDETAIL = Guid.NewGuid().ToString();
                 detail.BALANCEPOSTASIGNID = EmployeeAddBalancePost.EMPLOYEESALARYPOSTASIGNID;
                 detail.EMPLOYEEID = "";
                 detail.EMPLOYEENAME = "";
                 detail.EMPLOYEEPOSTID = postID;
                 detail.EMPLOYEEPOSTNAME = postName;
                 detail.EMPLOYEEDEPARTMENTID = departID;
                 detail.EMPLOYEEDEPARTMENTNAME = departName;
                 detail.EMPLOYEECOMPANYID = companyID;
                 detail.EMPLOYEECOMPANYNAME = companyName;
                 detail.SALARYSET = "0";
                 detail.ATTENDANCESET = "0";
                 //detail.EDITSTATE = "0";
                 detail.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                 detail.UPDATEDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                 detail.CREATEDATE = DateTime.Now;
                 detail.UPDATEDATE = DateTime.Now;
                 var exist = from a in EmployeeBalanceInfoList
                             where a.EMPLOYEEPOSTID == postID
                             select a;
                 if (exist.Count() == 0)
                 {
                     EmployeeBalanceInfoList.Add(detail);
                 }
                 
             }
             //RefreshUI(RefreshedTypes.ShowProgressBar);
             //personnerClient.GetEmployeeIDsByParasByBalancePostAsync(StrCompanyIDsList, StrDepartmentIDsList, StrPositionIDsList);
             
         }
         BindData(EmployeeBalanceInfoList.ToList());
         
     };
     lookup.MultiSelected = true;
     lookup.SelectSameGradeOnly = true;
     lookup.Show();
 }