public override void SubmitEditableChange(EmployeeInfo emp, Dictionary <string, object>[] Rows, EditableInfo ei) { string sSql = ""; foreach (Dictionary <string, object> row in Rows) { string sStatus = Cvt.ToString(row["__status"]); if (!string.IsNullOrEmpty(sStatus)) { changeStatus nStatus = (changeStatus)Enum.Parse(typeof(changeStatus), sStatus, true); BuildSubmitSql(emp, nStatus, ei, row, true, ref sSql); } } ExecCommandWithTransaction(sSql); }
public static EmployeeInfo LoadEmployeeInfo(string sUserName) { DataTable tbl = Common.DAL.GetUseInfo (sUserName); if (tbl.Rows.Count > 0) { DataRow dataRow = tbl.Rows[0]; EmployeeInfo empInfo = new EmployeeInfo(); empInfo._Employee = Cvt.ToInt64(dataRow["_Employee"]); empInfo.Use_AD_Login = Cvt.ToBoolean(dataRow["Use_AD_Login"]); empInfo.Change_Pwd_When_Next_Login = Cvt.ToBoolean(dataRow["Change_Pwd_When_Next_Login"]); empInfo.AD_Account = Cvt.ToString(dataRow["AD_Account"]); empInfo._Status = (Status)Enum.Parse(typeof(Status), Cvt.ToString(dataRow["_Status"]), true); empInfo.Name = Cvt.ToString(dataRow["Name"]); empInfo.HashPassword = Cvt.ToString(dataRow["Password"]); empInfo.Language = Cvt.ToString(dataRow["Language"]); empInfo.Login_Attempt = Cvt.ToInt32(dataRow["Login_Attempt"]); empInfo.Update_Time = Cvt.ToDateTime(dataRow["Update_Time"]); //mysql数据库中此字段名为Gravatar,已更改 empInfo._Attachment_Gravatar = Cvt.ToInt64(dataRow["_Attachment_Gravatar"]); empInfo.Fullname = Cvt.ToString(dataRow["Fullname"]); empInfo.Description = Cvt.ToString(dataRow["Description"]); empInfo.Email_Address = Cvt.ToString(dataRow["Email_Address"]); empInfo.Telphone_Number = Cvt.ToString(dataRow["Telphone_Number"]); empInfo.Login_Time = Cvt.ToDateTime(dataRow["Login_Time"]); empInfo.lastLoginFrom_IP = Cvt.ToString(dataRow["From_IP"]); empInfo.lastLoginFrom_MAC = Cvt.ToString(dataRow["From_MAC"]); empInfo.lastLoginFrom_Host = Cvt.ToString(dataRow["From_Host"]); empInfo.lastLoginResult = (LoginResult)Enum.Parse(typeof(LoginResult), Cvt.ToNumString(dataRow["_Login_Result"], "1"), true);; return(empInfo); } return(null); }
public static void LoadGolbalConfig() { try { gMaxLogin_Attempt = Cvt.ToInt32(ConfigurationManager.AppSettings["MaxLogin_Attempt"]); gLock_Minutes_After_Max_Login_Attempt = Cvt.ToInt32(ConfigurationManager.AppSettings["Lock_Minutes_After_Max_Login_Attempt"]); gMust_Login = Cvt.ToBoolean(ConfigurationManager.AppSettings["Must_Login"]); gDefault_Language = ConfigurationManager.AppSettings["Default_Language"]; gHome_Page_Title = ConfigurationManager.AppSettings["Home_Page_Title"]; gLogo_Picture = ConfigurationManager.AppSettings["Logo_Picture"]; gLADPUrl = ConfigurationManager.AppSettings["LADPUrl"]; gLADPUser = ConfigurationManager.AppSettings["LADPUser"]; gLADPPwd = ConfigurationManager.AppSettings["LADPPwd"]; string sMailServerType = ConfigurationManager.AppSettings["MailServerType"]; gMailServerAddress = ConfigurationManager.AppSettings["MailServerAddress"]; gMailServerUser = ConfigurationManager.AppSettings["MailServerUser"]; gMailServerPassword = ConfigurationManager.AppSettings["MailServerPassword"]; DataTable tbl = Common.DAL.GetPreferencesSetttings(); foreach (DataRow row in tbl.Rows) { string sKey = Cvt.ToString(row["key"]).Trim(), sValue = Cvt.ToString(row["value"]).Trim(); if (sKey.Length > 0 && sValue.Length > 0) { if (sKey.Equals("Max_Login_Attempt", StringComparison.OrdinalIgnoreCase)) { gMaxLogin_Attempt = Cvt.ToInt32(sValue); } else if (sKey.Equals("Lock_Minute_After_Max_Login_Attempt", StringComparison.OrdinalIgnoreCase)) { gLock_Minutes_After_Max_Login_Attempt = Cvt.ToInt32(sValue); } else if (sKey.Equals("Must_Login", StringComparison.OrdinalIgnoreCase)) { gMust_Login = Cvt.ToBoolean(sValue); } else if (sKey.Equals("Default_Language", StringComparison.OrdinalIgnoreCase)) { gDefault_Language = sValue; } else if (sKey.Equals("Home_Page_Title", StringComparison.OrdinalIgnoreCase)) { gDefault_Language = sValue; } else if (sKey.Equals("Logo_Picture", StringComparison.OrdinalIgnoreCase)) { gLogo_Picture = sValue; } else if (sKey.Equals("LADPUrl", StringComparison.OrdinalIgnoreCase)) { gLADPUrl = sValue; } else if (sKey.Equals("LADPUser", StringComparison.OrdinalIgnoreCase)) { gLADPUser = sValue; } else if (sKey.Equals("LADPPwd", StringComparison.OrdinalIgnoreCase)) { gLADPPwd = sValue; } else if (sKey.Equals("MailServerType", StringComparison.OrdinalIgnoreCase)) { sMailServerType = sValue; } else if (sKey.Equals("MailServerAddress", StringComparison.OrdinalIgnoreCase)) { gMailServerAddress = sValue; } else if (sKey.Equals("MailServerUser", StringComparison.OrdinalIgnoreCase)) { gMailServerUser = sValue; } else if (sKey.Equals("MailServerPassword", StringComparison.OrdinalIgnoreCase)) { gMailServerPassword = sValue; } } } if (!string.IsNullOrEmpty(sMailServerType)) { gMailServerType = (MailServerType)Enum.Parse(typeof(MailServerType), sMailServerType, true); } if (!string.IsNullOrEmpty(gLADPPwd)) { gLADPPwd = Common.DecryptDES(gLADPPwd, rgbIV, rgbKey); } if (!string.IsNullOrEmpty(gMailServerPassword)) { gMailServerPassword = Common.DecryptDES(gMailServerPassword, rgbIV, rgbKey); } } catch (Exception) { } }