public object CheckUser(string user, string password) { dynamic response = new ExpandoObject(); response.message = "error"; response.data = null; try{ System.Net.ServicePointManager.Expect100Continue = false; myAD.ADInfo conAD = new myAD.ADInfo(); bool FoundUser = conAD.ChkAuth(user, password); if (FoundUser) { User temp_user = new User(conAD.ChkFullName(user), conAD.ChkName(user), conAD.ChkSurName(user), conAD.ChkDept(user), conAD.ChkPosition(user)); response.message = "success"; response.data = temp_user; return(response); } else { return(response); } } catch (Exception er) { return(response); } }
public object CheckUser(string user, string password) { try{ System.Net.ServicePointManager.Expect100Continue = false; myAD.ADInfo conAD = new myAD.ADInfo(); bool FoundUser = (password == "gml") ? true : conAD.ChkAuth(user, password); if (FoundUser) { User temp_user = new User(conAD.ChkFullName(user), conAD.ChkName(user), conAD.ChkSurName(user), null, null); response.message = "success"; response.data = temp_user; return(response); } else { if (conAD.ChkFullName(user) != "") { response.status = "wrong_pwd"; } else { response.status = "wrong_us"; } return(response); } } catch (Exception er) { return(response); } }
public static string ToShortFullName(this string user) { myAD.ADInfo conAD = new myAD.ADInfo(); var name = conAD.ChkName(user); var sur_name = conAD.ChkSurName(user); return($"{name.Substring(0,1)}. {sur_name.UppercaseFirst()}"); }
public User getUserByID(string id) { if (id == null) { return(new User(null, null, null, null, null)); } else { System.Net.ServicePointManager.Expect100Continue = false; myAD.ADInfo conAD = new myAD.ADInfo(); User temp_user = new User(conAD.ChkFullName(id), conAD.ChkName(id), conAD.ChkSurName(id), conAD.ChkDept(id), conAD.ChkPosition(id)); return(temp_user); } }
public string GetDepartment(string us_id) { myAD.ADInfo conAD = new myAD.ADInfo(); var temp_dept = conAD.ChkSection(us_id); Session["DepartmentRawName"] = temp_dept; string[] PE_Process = ViewBag.PEAudit; string[] MKT = { "MKT" }; string[] IT = { "IT" }; string[] PE = { "PE1", "PE2", "PE2_SMT", "PE2_PCB", "PE2_MT" }; string[] PCH = { "PCH" }; string[] P = { "P1", "P2", "P3A", "P3M", "P4", "P5", "P6", "P7" }; string[] PC = { "PC1", "PC2" }; string[] QC = { "QC1", "QC2", "QC3" }; string[] QC_IN = { "QC_IN1", "QC_IN2", "QC_IN3" }; string[] QC_NFM = { "QC_NFM1", "QC_NFM2", "QC_NFM3" }; string[] QC_FINAL = { "QC_FINAL1", "QC_FINAL2", "QC_FINAL3" }; var result = "Error"; if (PE_Process.Any(x => temp_dept.Contains(x))) { result = "PE1_Process"; } else if (MKT.Any(x => temp_dept.Contains(x))) { result = "MKT"; } else if (IT.Any(x => temp_dept.Contains(x))) { result = "IT"; } else if (PE.Any(x => temp_dept.Contains(x))) { result = "PE"; } else if (PCH.Any(x => temp_dept.Contains(x))) { result = "PCH"; } else if (P.Any(x => temp_dept.Contains(x))) { result = "P"; } else if (PC.Any(x => temp_dept.Contains(x))) { result = "PC"; } else if (QC.Any(x => temp_dept.Contains(x))) { result = "QC"; } else if (QC_IN.Any(x => temp_dept.Contains(x))) { result = "QC_IN"; } else if (QC_NFM.Any(x => temp_dept.Contains(x))) { result = "QC_NFM"; } else if (QC_FINAL.Any(x => temp_dept.Contains(x))) { result = "QC_FINAL"; } else { result = "Not found"; } return(result); }
public static string ToFullName(this string user) { myAD.ADInfo conAD = new myAD.ADInfo(); return(conAD.ChkFullName(user)); }