/// <summary> /// 删除指定的带薪假设置(物理删除,待定) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnDelete_Click(object sender, RoutedEventArgs e) { string strID = ""; if (dgFreeLeaveDaySetList.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "DELETE"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (dgFreeLeaveDaySetList.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "DELETE"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } foreach (object ovj in dgFreeLeaveDaySetList.SelectedItems) { T_HR_FREELEAVEDAYSET ent = ovj as T_HR_FREELEAVEDAYSET; string Result = ""; if (ent != null) { strID = ent.FREELEAVEDAYSETID.ToString(); ComfirmWindow delComfirm = new ComfirmWindow(); delComfirm.OnSelectionBoxClosed += (obj, result) => { clientAtt.RemoveFreeLeaveDaySetAsync(strID); }; delComfirm.SelectionBox(Utility.GetResourceStr("DELETECONFIRM"), Utility.GetResourceStr("DELETEALTER"), ComfirmWindow.titlename, Result); } } }
/// <summary> /// 弹出表单子窗口,以便编辑带薪假设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnEdit_Click(object sender, RoutedEventArgs e) { string strFreeLeaveDaySetID = string.Empty; if (dgFreeLeaveDaySetList.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (dgFreeLeaveDaySetList.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } T_HR_FREELEAVEDAYSET ent = dgFreeLeaveDaySetList.SelectedItems[0] as T_HR_FREELEAVEDAYSET; strFreeLeaveDaySetID = ent.FREELEAVEDAYSETID.ToString(); FreeLeaveDaySetForm formFreeLeaveDaySet = new FreeLeaveDaySetForm(FormTypes.Edit, strFreeLeaveDaySetID, null); EntityBrowser entBrowser = new EntityBrowser(formFreeLeaveDaySet); entBrowser.FormType = FormTypes.Edit; entBrowser.ReloadDataEvent += new EntityBrowser.refreshGridView(entBrowser_ReloadDataEvent); entBrowser.Show <string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); }
/// <summary> /// 表单初始化 /// </summary> private void InitForm() { entFreeLeaveDaySet = new T_HR_FREELEAVEDAYSET(); entFreeLeaveDaySet.FREELEAVEDAYSETID = System.Guid.NewGuid().ToString().ToUpper(); if (LeaveTypeSet == null) { LeaveTypeSet = new T_HR_LEAVETYPESET(); } entFreeLeaveDaySet.T_HR_LEAVETYPESET = LeaveTypeSet; //权限控制 entFreeLeaveDaySet.OWNERCOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; entFreeLeaveDaySet.OWNERDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; entFreeLeaveDaySet.OWNERPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID; entFreeLeaveDaySet.OWNERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; //2010年2月11日, 11:37:35,目前暂未实现登录部分,人员相关数据为假定值 entFreeLeaveDaySet.CREATEDATE = DateTime.Now; entFreeLeaveDaySet.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; entFreeLeaveDaySet.UPDATEDATE = System.DateTime.Now; entFreeLeaveDaySet.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; //页面初始化加载的临时数据 entFreeLeaveDaySet.MINIMONTH = decimal.Parse("0"); entFreeLeaveDaySet.MAXMONTH = decimal.Parse("0"); entFreeLeaveDaySet.LEAVEDAYS = decimal.Parse("0"); entFreeLeaveDaySet.ISPERFECTATTENDANCEFACTOR = "1";//默认为否 entFreeLeaveDaySet.OFFESTTYPE = "0"; this.DataContext = entFreeLeaveDaySet; }
public string ModifyFreeLeaveDaySet(T_HR_FREELEAVEDAYSET entRd) { using (FreeLeaveDaySetBLL bllFreeLeaveDaySet = new FreeLeaveDaySetBLL()) { return bllFreeLeaveDaySet.ModifyFreeLeaveDaySet(entRd); } }
/// <summary> /// 初始化五四三八数据 /// </summary> public void InitYouth() { try { var ents = from ent in dal.GetObjects <T_HR_ATTENDANCESOLUTION>() where ent.CHECKSTATE == "2" orderby ent.CREATEDATE ascending select ent; SMT.Foundation.Log.Tracer.Debug("总数量为:" + ents.Count().ToString()); int intCount = 0; foreach (var ent in ents) { //if (ent.ATTENDANCESOLUTIONID == "1214E853-3536-456F-BBC9-66A059A903A6") //{ // continue; //} #region 八 T_HR_LEAVETYPESET typeset = new T_HR_LEAVETYPESET(); typeset.LEAVETYPESETID = Guid.NewGuid().ToString(); typeset.LEAVETYPENAME = ent.ATTENDANCESOLUTIONNAME + "三八妇女节"; typeset.LEAVETYPEVALUE = "13"; typeset.ISFREELEAVEDAY = "2"; typeset.MAXDAYS = (decimal)0.53; typeset.FINETYPE = "1"; typeset.SEXRESTRICT = "0"; typeset.ENTRYRESTRICT = "1"; typeset.OWNERCOMPANYID = ent.OWNERCOMPANYID; typeset.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; typeset.OWNERPOSTID = ent.OWNERPOSTID; typeset.OWNERID = ent.OWNERID; typeset.CREATEDATE = DateTime.Now; typeset.UPDATEDATE = DateTime.Now; typeset.UPDATEUSERID = ent.OWNERID; typeset.CREATECOMPANYID = ent.OWNERCOMPANYID; typeset.CREATEDEPARTMENTID = ent.OWNERDEPARTMENTID; typeset.CREATEPOSTID = ent.OWNERPOSTID; typeset.CREATEUSERID = ent.OWNERID; typeset.REMARK = "系统产生三八妇女节"; var entExist = from ent1 in dal.GetObjects <T_HR_LEAVETYPESET>() where ent1.LEAVETYPEVALUE == "13" && ent1.OWNERCOMPANYID == ent.OWNERCOMPANYID select ent1; LeaveTypeSetBLL bllLeaveTypeSet = new LeaveTypeSetBLL(); if (entExist.Count() == 0) { string aaa = bllLeaveTypeSet.AddLeaveTypeSet(typeset); if (aaa == "{SAVESUCCESSED}") { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "产生了三八节"); } else { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "没有产生三八节"); continue; } } else { typeset = entExist.FirstOrDefault(); } //int iii = dal.Add(typeset); //if (iii > 0) //{ // SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME +"产生了三八节"); //} //dal.SaveContextChanges(); //dal.AddToContext(typeset); T_HR_FREELEAVEDAYSET freeTypeSet = new T_HR_FREELEAVEDAYSET(); freeTypeSet.FREELEAVEDAYSETID = Guid.NewGuid().ToString(); freeTypeSet.T_HR_LEAVETYPESET = typeset; //freeTypeSet.T_HR_LEAVETYPESETReference.EntityKey = //new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_HR_LEAVETYPESET", "LEAVETYPESETID", typeset.LEAVETYPESETID); freeTypeSet.MINIMONTH = 0; freeTypeSet.MAXMONTH = 9999; freeTypeSet.LEAVEDAYS = (decimal)0.53; freeTypeSet.ISPERFECTATTENDANCEFACTOR = "1"; freeTypeSet.OFFESTTYPE = "1"; freeTypeSet.OWNERCOMPANYID = ent.OWNERCOMPANYID; freeTypeSet.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; freeTypeSet.OWNERPOSTID = ent.OWNERPOSTID; freeTypeSet.OWNERID = ent.OWNERID; freeTypeSet.CREATEDATE = DateTime.Now; freeTypeSet.UPDATEDATE = DateTime.Now; freeTypeSet.UPDATEUSERID = ent.OWNERID; freeTypeSet.CREATECOMPANYID = ent.OWNERCOMPANYID; freeTypeSet.CREATEDEPARTMENTID = ent.OWNERDEPARTMENTID; freeTypeSet.CREATEPOSTID = ent.OWNERPOSTID; freeTypeSet.CREATEUSERID = ent.OWNERID; freeTypeSet.REMARK = "系统产生三八妇女节带薪假"; //dal.AddToContext(freeTypeSet); FreeLeaveDaySetBLL bllFreeLeaveDaySet = new FreeLeaveDaySetBLL(); string aa2 = bllFreeLeaveDaySet.AddFreeLeaveDaySet(freeTypeSet); if (aa2 == "{SAVESUCCESSED}") { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "产生了带薪假三八节"); } else { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "没有产生带薪假三八节"); continue; } T_HR_ATTENDFREELEAVE attendFree = new T_HR_ATTENDFREELEAVE(); attendFree.ATTENDFREELEAVEID = Guid.NewGuid().ToString(); var entSol = from ent11 in dal.GetObjects <T_HR_ATTENDANCESOLUTION>() where ent11.ATTENDANCESOLUTIONID == ent.ATTENDANCESOLUTIONID select ent11; attendFree.T_HR_ATTENDANCESOLUTION = entSol.FirstOrDefault(); var entSet = from ent11 in dal.GetObjects <T_HR_LEAVETYPESET>() where ent11.LEAVETYPESETID == typeset.LEAVETYPESETID select ent11; attendFree.T_HR_LEAVETYPESET = entSet.FirstOrDefault(); attendFree.REMARK = "自动产生三八节"; attendFree.CREATEDATE = DateTime.Now; attendFree.UPDATEDATE = DateTime.Now; attendFree.CREATEUSERID = ent.OWNERID; attendFree.UPDATEUSERID = ent.OWNERID; string bbb = AddAttendFreeLeave(attendFree); if (bbb == "{SAVESUCCESSED}") { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "产生了三八节,和考勤方案关联了"); } else { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "没有@@@@@@产生三八节,和考勤方案关联了"); continue; } #endregion #region 五四 T_HR_LEAVETYPESET typesetYouth = new T_HR_LEAVETYPESET(); typesetYouth.LEAVETYPESETID = Guid.NewGuid().ToString(); typesetYouth.LEAVETYPENAME = ent.ATTENDANCESOLUTIONNAME + "五四青年节"; typesetYouth.LEAVETYPEVALUE = "12"; typesetYouth.ISFREELEAVEDAY = "2"; typesetYouth.MAXDAYS = (decimal)0.53; typesetYouth.FINETYPE = "1"; typesetYouth.SEXRESTRICT = "2"; typesetYouth.ENTRYRESTRICT = "1"; typesetYouth.OWNERCOMPANYID = ent.OWNERCOMPANYID; typesetYouth.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; typesetYouth.OWNERPOSTID = ent.OWNERPOSTID; typesetYouth.OWNERID = ent.OWNERID; typesetYouth.CREATEDATE = DateTime.Now; typesetYouth.UPDATEDATE = DateTime.Now; typesetYouth.UPDATEUSERID = ent.OWNERID; typesetYouth.CREATECOMPANYID = ent.OWNERCOMPANYID; typesetYouth.CREATEDEPARTMENTID = ent.OWNERDEPARTMENTID; typesetYouth.CREATEPOSTID = ent.OWNERPOSTID; typesetYouth.CREATEUSERID = ent.OWNERID; typesetYouth.REMARK = "系统产生五四青年节"; //dal.AddToContext(typesetYouth); var entExistYouth = from ent1 in dal.GetObjects <T_HR_LEAVETYPESET>() where ent1.LEAVETYPEVALUE == "12" && ent1.OWNERCOMPANYID == ent.OWNERCOMPANYID select ent1; if (entExistYouth.Count() == 0) { string bbb1 = bllLeaveTypeSet.AddLeaveTypeSet(typesetYouth); if (bbb1 == "{SAVESUCCESSED}") { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "产生了五四青年节"); } else { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "没有####产生五四青年节"); continue; } } else { typesetYouth = entExistYouth.FirstOrDefault(); } T_HR_FREELEAVEDAYSET freeTypeSetYouth = new T_HR_FREELEAVEDAYSET(); freeTypeSetYouth.FREELEAVEDAYSETID = Guid.NewGuid().ToString(); freeTypeSetYouth.T_HR_LEAVETYPESET = typesetYouth; //freeTypeSetYouth.T_HR_LEAVETYPESETReference.EntityKey = //new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_HR_LEAVETYPESET", "LEAVETYPESETID", typesetYouth.LEAVETYPESETID); freeTypeSetYouth.MINIMONTH = 0; freeTypeSetYouth.MAXMONTH = 9999; freeTypeSetYouth.LEAVEDAYS = (decimal)0.53; freeTypeSetYouth.ISPERFECTATTENDANCEFACTOR = "1"; freeTypeSetYouth.OFFESTTYPE = "1"; freeTypeSetYouth.OWNERCOMPANYID = ent.OWNERCOMPANYID; freeTypeSetYouth.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; freeTypeSetYouth.OWNERPOSTID = ent.OWNERPOSTID; freeTypeSetYouth.OWNERID = ent.OWNERID; freeTypeSetYouth.CREATEDATE = DateTime.Now; freeTypeSetYouth.UPDATEDATE = DateTime.Now; freeTypeSetYouth.UPDATEUSERID = ent.OWNERID; freeTypeSetYouth.CREATECOMPANYID = ent.OWNERCOMPANYID; freeTypeSetYouth.CREATEDEPARTMENTID = ent.OWNERDEPARTMENTID; freeTypeSetYouth.CREATEPOSTID = ent.OWNERPOSTID; freeTypeSetYouth.CREATEUSERID = ent.OWNERID; freeTypeSetYouth.REMARK = "系统产生五四青年节带薪假"; //dal.AddToContext(freeTypeSetYouth); string bb2 = bllFreeLeaveDaySet.AddFreeLeaveDaySet(freeTypeSetYouth); if (bb2 == "{SAVESUCCESSED}") { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "产生了带薪假五四青年节"); } else { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "没有&&&产生带薪假五四青年节"); continue; } T_HR_ATTENDFREELEAVE attendFreeYouth = new T_HR_ATTENDFREELEAVE(); attendFreeYouth.ATTENDFREELEAVEID = Guid.NewGuid().ToString(); attendFreeYouth.T_HR_ATTENDANCESOLUTION = ent; attendFreeYouth.T_HR_LEAVETYPESET = typesetYouth; //attendFreeYouth.T_HR_LEAVETYPESETReference.EntityKey = // new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_HR_LEAVETYPESET", "LEAVETYPESETID", typesetYouth.LEAVETYPESETID); attendFreeYouth.REMARK = "自动产生五四青年节"; attendFreeYouth.CREATEDATE = DateTime.Now; attendFreeYouth.UPDATEDATE = DateTime.Now; attendFreeYouth.CREATEUSERID = ent.OWNERID; attendFreeYouth.UPDATEUSERID = ent.OWNERID; string cc = AddAttendFreeLeave(attendFreeYouth); if (cc == "{SAVESUCCESSED}") { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "产生了五四节,和考勤方案关联了"); } else { SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "没有********了五四节,和考勤方案关联了"); continue; } #endregion SMT.Foundation.Log.Tracer.Debug(ent.ATTENDANCESOLUTIONNAME + "执行完了"); intCount += 1; SMT.Foundation.Log.Tracer.Debug("执行了:" + intCount.ToString()); } } catch (Exception ex) { SMT.Foundation.Log.Tracer.Debug("初始化五四三八出现错误" + ex.ToString()); } }