public string GetRecipicientsEmail(string _emno) { List <string> lstRole = new List <string>(); vw_employment emp = GetSelectedObject <vw_employment>(new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = _emno } }); if (emp != null) { for (int i = 0; i < lstAlarmSubs.Count; i++) { PropertyInfo prop = emp.GetType().GetProperty(lstAlarmSubs[i].attr); if (prop != null) { if (prop.GetValue(emp, null).ToString() == lstAlarmSubs[i].atva.Trim()) { lstRole.Add("[" + lstAlarmSubs[i].alpf + "]"); } } } } string strRole = lstRole.ToArray().ToString(); StSystemConfig sysCfg = (StSystemConfig)Parameter.CURRENT_SYSTEM_CONFIG; string strReci = string.Empty; if (sysCfg.ScSBAD == "Y") { var q = (from p in lstUserRoleAD where strRole.Contains("[" + p.alpf + "]") == true select p).ToList(); for (int i = 0; i < q.Count; i++) { string email = q[i].cota1.Trim() == string.Empty ? q[i].cota2.Trim() : q[i].cota1.Trim(); if (email != string.Empty) { strReci += (strReci.Trim() == string.Empty) ? "" : "," + email; } } } else { var q = (from p in lstUserRoleNonAD where strRole.Contains("[" + p.alpf + "]") == true select p).ToList(); for (int i = 0; i < q.Count; i++) { string email = q[i].cota1.Trim() == string.Empty ? q[i].cota2.Trim() : q[i].cota1.Trim(); if (email != string.Empty) { strReci += (strReci.Trim() == string.Empty) ? "" : "," + email; } } } return(strReci); }
public double GetlmbyEmp(vw_employment empInfo, string _ltcd, HRMS_Limit_Scope _scope, HRMS_Limit_Type _limitType) { try { double lmbyEmpHours = -1; double lmbyYearHours = -1; double lmbyOtherHours = -1; double lmbyEmpCarryHours = -1; double lmbyYearCarryHours = -1; double lmbyOtherCarryHours = -1; //针对员工的设定 var q = (from p in gDB.tlvlealmts where p.lmsp == _scope.ToString() && (p.ltcd == _ltcd || (_ltcd == "ALL")) && p.lmby == HRMS_Limit_By.E.ToString() && p.lmva == empInfo.emno select p).ToList <tlvlealmt>(); for (int i = 0; i < q.Count; i++) { lmbyEmpHours = q[i].mxlh.Value; lmbyEmpCarryHours = q[i].mxch.Value; break; } //针对服务年数的设定 q = (from p in gDB.tlvlealmts where p.lmsp == _scope.ToString() && (p.ltcd == _ltcd || (_ltcd == "ALL")) && p.lmby == HRMS_Limit_By.Y.ToString() && p.lmva == empInfo.yearservice.ToString() select p).ToList <tlvlealmt>(); for (int i = 0; i < q.Count; i++) { lmbyYearHours = q[i].mxlh.Value; lmbyYearCarryHours = q[i].mxch.Value; break; } //针对其他项目的设定 q = (from p in gDB.tlvlealmts join s in gDB.tstdefcfgs on p.lmby equals s.dfnm where (p.ltcd == _ltcd || (_ltcd == "ALL")) && p.lmby != HRMS_Limit_By.E.ToString() && p.lmby != HRMS_Limit_By.Y.ToString() && p.lmsp == _scope.ToString() //&& p.lmva == empInfo.GetType().GetProperty(s.fieldname).GetValue(empInfo, null).ToString() select p).ToList <tlvlealmt>(); var q1 = (from p in q where p.lmva == empInfo.GetType().GetProperty(p.tstdefcfg.finm).GetValue(empInfo, null).ToString().Trim() select p).ToList(); for (int i = 0; i < q1.Count; i++) { lmbyOtherHours = q1[i].mxlh.Value; lmbyOtherCarryHours = q1[i].mxch.Value; break; } double r = 0; switch (_limitType) { case HRMS_Limit_Type.LeaveHours: r = ((lmbyEmpHours == -1 ? 0 : lmbyEmpHours) + (lmbyYearHours == -1 ? 0 : lmbyYearHours) + (lmbyOtherHours == -1 ? 0 : lmbyOtherHours)); break; case HRMS_Limit_Type.LeaveCarryforwardHours: r = ((lmbyEmpCarryHours == -1 ? 0 : lmbyEmpCarryHours) + (lmbyYearCarryHours == -1 ? 0 : lmbyYearCarryHours) + (lmbyOtherCarryHours == -1 ? 0 : lmbyOtherCarryHours)); break; default: r = 0; break; } return(r == 0 ? -1 : r); } catch (UtilException ex) { throw ex; } catch (Exception ex) { throw new UtilException(ex.Message, ex); } }
public string GetRecipicientsBoard(string _emno) { //List<string> lstRole = new List<string>(); vw_employment emp = GetSelectedObject <vw_employment>(new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "emno", ColumnValue = _emno } }); string strRole = string.Empty; if (emp != null) { for (int i = 0; i < lstAlarmSubs.Count; i++) { if (lstAlarmSubs[i].attr == "*") { //订阅全部员工的消息 strRole += (strRole == string.Empty ? "" : ",") + "[" + lstAlarmSubs[i].alpf + "]"; } else { PropertyInfo prop = emp.GetType().GetProperty(lstAlarmSubs[i].attr); if (prop != null) { object v = prop.GetValue(emp, null); if (v != null) { if (v.ToString() == lstAlarmSubs[i].atva.Trim()) { strRole += (strRole == string.Empty ? "" : ",") + "[" + lstAlarmSubs[i].alpf + "]"; } } } } } } StSystemConfig sysCfg = (StSystemConfig)Parameter.CURRENT_SYSTEM_CONFIG; string strReci = string.Empty; if (sysCfg.ScSBAD == "Y") { var q = (from p in lstUserRole where strRole.Contains("[" + p.alpf + "]") == true select p).ToList(); for (int i = 0; i < q.Count; i++) { if (q[i].sfid != null && q[i].sfid.Trim() != string.Empty) { strReci += (strReci.Trim() == string.Empty ? "" : ",") + q[i].sfid; } } } else { var q = (from p in lstUser where strRole.Contains("[" + p.alpf + "]") == true select p).ToList(); for (int i = 0; i < q.Count; i++) { if (q[i].sfid != null && q[i].sfid.Trim() != string.Empty) { strReci += (strReci.Trim() == string.Empty ? "" : ",") + q[i].sfid; } } } return(strReci); }