void SalaryLevelForm_Loaded(object sender, RoutedEventArgs e) { InitParas(); if (string.IsNullOrEmpty(salaryLevelID)) { salaryLevel = new T_HR_SALARYLEVEL(); salaryLevel.SALARYLEVELID = Guid.NewGuid().ToString(); this.DataContext = salaryLevel; } else { client.GetSalaryLevelByIDAsync(salaryLevelID); } }
void btnEdit_Click(object sender, RoutedEventArgs e) { //loadbar.Start(); //var lowLevel = salaryLevelDicts.Max(s => Convert.ToInt32(s.DICTIONARYVALUE)); //client.GenerateSalaryLevelAsync(lowLevel, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); if (DtGrid.SelectedItems.Count > 0) { T_HR_SALARYLEVEL tmplevel = DtGrid.SelectedItems[0] as T_HR_SALARYLEVEL; Form.Salary.SalaryLevelForm form = new SMT.HRM.UI.Form.Salary.SalaryLevelForm(FormTypes.Edit, tmplevel.SALARYLEVELID); EntityBrowser browser = new EntityBrowser(form); form.MinHeight = 220; form.MinWidth = 550; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); } else { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("SELECTERROR", "EDIT")); return; } }
private void LookUp_FindClick(object sender, EventArgs e) { Dictionary <string, string> cols = new Dictionary <string, string>(); cols.Add("POSTLEVEL", "T_HR_POSTLEVELDISTINCTION.POSTLEVEL"); cols.Add("SALARYLEVEL", "SALARYLEVEL"); LookupForm lookup = new LookupForm(EntityNames.SalaryLevel, typeof(List <T_HR_SALARYLEVEL>), cols); lookup.SelectedClick += (o, ev) => { T_HR_SALARYLEVEL ent = lookup.SelectedObj as T_HR_SALARYLEVEL; if (ent != null) { lkSalaryLevel.DataContext = ent; SalaryStandard.T_HR_SALARYLEVEL = new T_HR_SALARYLEVEL(); SalaryStandard.T_HR_SALARYLEVEL.SALARYLEVELID = ent.SALARYLEVELID; } }; lookup.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); }
public void SalaryLevelADD(T_HR_SALARYLEVEL obj) { using (SalaryLevelBLL bll = new SalaryLevelBLL()) { bll.SalaryLevelADD(obj); } }
/// <summary> /// 批量生成薪资标准 /// </summary> /// <param name="solution"></param> /// <param name="postLevels"></param> /// <param name="standModel"></param> /// <returns></returns> public string CreateSalaryStandBatch(T_HR_SALARYSOLUTION solution, Dictionary <string, string> postLevels, T_HR_SALARYSTANDARD standModel) { try { // 检查方案是否已经使用 var tmpArchives = from ac in dal.GetObjects <T_HR_SALARYARCHIVE>() where ac.SALARYSOLUTIONID == solution.SALARYSOLUTIONID select ac; if (tmpArchives.Count() > 0) { Tracer.Debug("方案已经在使用中,无法重新生成薪资标准"); return("SALARYSOLUTIONINUSED"); } // 薪资方案的体系ID string salarySystemID = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMID; //薪资体系名 string salarySystemName = solution.T_HR_SALARYSYSTEM.SALARYSYSTEMNAME; // 岗位级别名 string postLevelName = ""; EmployeeSalaryRecordBLL bll = new EmployeeSalaryRecordBLL(); SalaryStandardItemBLL itemBLL = new SalaryStandardItemBLL(); //薪资方案所属的薪资体系 List <T_HR_SALARYLEVEL> salarylevelList = new List <T_HR_SALARYLEVEL>(); //薪资方案的薪资项集合 List <V_SALARYITEM> salaryItems = new List <V_SALARYITEM>(); salarylevelList = (from c in dal.GetObjects <T_HR_SALARYLEVEL>().Include("T_HR_POSTLEVELDISTINCTION") where c.T_HR_POSTLEVELDISTINCTION.T_HR_SALARYSYSTEM.SALARYSYSTEMID == salarySystemID select c).OrderBy(m => m.SALARYLEVEL).OrderBy(x => x.T_HR_POSTLEVELDISTINCTION.POSTLEVEL).ToList(); //salaryItems = (from n in DataContext.T_HR_SALARYITEM // join m in DataContext.T_HR_SALARYSOLUTIONITEM on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID // where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID // select n).ToList(); salaryItems = (from n in dal.GetObjects <T_HR_SALARYITEM>() join m in dal.GetObjects <T_HR_SALARYSOLUTIONITEM>() on n.SALARYITEMID equals m.T_HR_SALARYITEM.SALARYITEMID where m.T_HR_SALARYSOLUTION.SALARYSOLUTIONID == solution.SALARYSOLUTIONID select new V_SALARYITEM { T_HR_SALARYITEM = n, ORDERNUMBER = m.ORDERNUMBER } ).ToList(); //方案所属地区差异补贴 List <T_HR_AREAALLOWANCE> areaAllowance = new List <T_HR_AREAALLOWANCE>(); areaAllowance = (from c in dal.GetObjects <T_HR_AREAALLOWANCE>() join b in dal.GetObjects <T_HR_SALARYSOLUTION>().Include("T_HR_AREADIFFERENCE") on c.T_HR_AREADIFFERENCE.AREADIFFERENCEID equals b.T_HR_AREADIFFERENCE.AREADIFFERENCEID where b.SALARYSOLUTIONID == solution.SALARYSOLUTIONID select c).ToList(); //新增前删除原有的标准 SalaryStandardBLL standBLL = new SalaryStandardBLL(); standBLL.SalaryStandardDeleteBySolutionID(solution.SALARYSOLUTIONID); //var enttt = from ccc in salarylevelList where ccc.SALARYSUM>0 select ccc; int num = 0; #region 薪资标准排序算法 int numsign = 0; int recordsign = 0; for (int x = 0; x < salarylevelList.Count; x++) { if (numsign == 0) { recordsign = x; } if ((x + 1 < salarylevelList.Count && salarylevelList[x].T_HR_POSTLEVELDISTINCTION.POSTLEVEL != salarylevelList[x + 1].T_HR_POSTLEVELDISTINCTION.POSTLEVEL) || x == salarylevelList.Count - 1) { numsign++; for (int i = recordsign; i < recordsign + numsign; i++) { for (int j = i + 1; j < recordsign + numsign; j++) { //if (salarylevelList[i].T_HR_POSTLEVELDISTINCTION.POSTLEVEL > 0) break; if (Convert.ToDecimal(salarylevelList[i].SALARYLEVEL) > Convert.ToDecimal(salarylevelList[j].SALARYLEVEL)) { T_HR_SALARYLEVEL t = null; t = salarylevelList[i]; salarylevelList[i] = salarylevelList[j]; salarylevelList[j] = t; } } } numsign = 0; } else { numsign++; } } #endregion //dal.BeginTransaction(); foreach (var sl in salarylevelList) { // 薪资体系的每条记录都对应一个标准 根据sl生成薪资标准 T_HR_SALARYSTANDARD stand = new T_HR_SALARYSTANDARD(); //薪资标准的薪资项集合 List <T_HR_SALARYSTANDARDITEM> standSalaryitems = new List <T_HR_SALARYSTANDARDITEM>(); //获取岗位级别名 var ent = from c in postLevels join b in salarylevelList on c.Value equals b.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString() where b.SALARYLEVELID == sl.SALARYLEVELID select c.Key; if (ent.Count() > 0) { postLevelName = ent.FirstOrDefault().ToString(); } //薪资标准名= 薪资体系名+岗位级别名+"-"+薪资级别名 stand.SALARYSTANDARDNAME = salarySystemName + postLevelName + "-" + sl.SALARYLEVEL.ToString(); stand.SALARYSTANDARDID = Guid.NewGuid().ToString(); // stand.T_HR_SALARYLEVEL = new T_HR_SALARYLEVEL(); stand.T_HR_SALARYLEVELReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYLEVEL", "SALARYLEVELID", sl.SALARYLEVELID); // stand.T_HR_SALARYLEVEL.SALARYLEVELID = sl.SALARYLEVELID; stand.SALARYSOLUTIONID = solution.SALARYSOLUTIONID; stand.CHECKSTATE = Convert.ToInt32(CheckStates.Approved).ToString(); stand.BASESALARY = sl.SALARYSUM; stand.CREATEDATE = System.DateTime.Now; //有关权限的字段 stand.CREATECOMPANYID = standModel.CREATECOMPANYID; stand.CREATEDEPARTMENTID = standModel.CREATEDEPARTMENTID; stand.CREATEPOSTID = standModel.CREATEPOSTID; stand.CREATEUSERID = standModel.CREATEUSERID; stand.OWNERCOMPANYID = standModel.OWNERCOMPANYID; stand.OWNERDEPARTMENTID = standModel.OWNERDEPARTMENTID; stand.OWNERID = standModel.OWNERID; stand.OWNERPOSTID = standModel.OWNERPOSTID; //增加排序号 stand.PERSONALSIRATIO = num; num++; //标准对应的地区差异补贴(和岗位级别有关) decimal?allowance = 0; if (areaAllowance != null) { allowance = (from al in areaAllowance where al.POSTLEVEL == sl.T_HR_POSTLEVELDISTINCTION.POSTLEVEL.ToString() select al.ALLOWANCE).FirstOrDefault(); } //计算标准的基础数据 decimal?BasicData = sl.SALARYSUM; //按照方案的薪资项集合生成薪资标准的薪资项 foreach (var item in salaryItems) { T_HR_SALARYSTANDARDITEM standItem = new T_HR_SALARYSTANDARDITEM(); standItem.STANDRECORDITEMID = Guid.NewGuid().ToString(); standItem.T_HR_SALARYITEMReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYITEM", "SALARYITEMID", item.T_HR_SALARYITEM.SALARYITEMID); // standItem.T_HR_SALARYITEM.SALARYITEMID = item.T_HR_SALARYITEM.SALARYITEMID; standItem.CREATEUSERID = solution.CREATEUSERID; standItem.T_HR_SALARYSTANDARDReference.EntityKey = new System.Data.EntityKey(qualifiedEntitySetName + "T_HR_SALARYSTANDARD", "SALARYSTANDARDID", stand.SALARYSTANDARDID); // standItem.T_HR_SALARYSTANDARD.SALARYSTANDARDID = stand.SALARYSTANDARDID; standItem.CREATEDATE = System.DateTime.Now; standItem.ORDERNUMBER = item.ORDERNUMBER; //计算类型是手动输入的 金额是薪资项设置是输入的值 if (item.T_HR_SALARYITEM.CALCULATORTYPE == "1" || (item.T_HR_SALARYITEM.CALCULATORTYPE == "4" && item.T_HR_SALARYITEM.GUERDONSUM != null)) { standItem.SUM = item.T_HR_SALARYITEM.GUERDONSUM.ToString(); } //计算类型是公式计算 而且不是在生成薪资时计算 else if (item.T_HR_SALARYITEM.CALCULATORTYPE == "3" && item.T_HR_SALARYITEM.ISAUTOGENERATE == "0") { standItem.SUM = bll.AutoCalculateItem(item.T_HR_SALARYITEM.SALARYITEMID, Convert.ToDecimal(BasicData), allowance.ToString()).ToString(); } //地区差异补贴 else if (item.T_HR_SALARYITEM.ENTITYCOLUMNCODE == "AREADIFALLOWANCE") { standItem.SUM = allowance.ToString(); } standSalaryitems.Add(standItem); } //SalaryStandardAdd(stand); //itemBLL.SalaryStandardItemsAdd(standSalaryitems); AddSalaryStanderAndItems(stand, standSalaryitems); } //dal.CommitTransaction(); return("SAVESUCCESSED"); } catch (Exception ex) { //dal.RollbackTransaction(); SMT.Foundation.Log.Tracer.Debug(ex.Message); return(ex.Message); } }