/// <summary> /// This is the login function for SmManager service /// The reparator has to be in the category of AL_ST /// in order to be accepted /// </summary> /// <param name=Login parameters></param> /// <returns>Login parameters with reparator name and ident added</returns> public LoginAdm loginAdmin(LoginAdm login) { // Create parameter collection NxParameterCollection pc = new NxParameterCollection(); // Add anvandID and pwd as parameters pc.Add("pAnvID", login.AnvID); pc.Add("pPwd", login.pwd); // Create SQL clause string sSql = " select reparator, rep_kat_id, coalesce(canResetPyramid,false) canResetPyramid from reparator " + " where anvID = :pAnvID " + " and pwd = :pPwd " + " and visas = true "; string errSt = ""; DataTable dt = cdb.getData(sSql, ref errSt, pc); LoginAdm la = new LoginAdm(); if (errSt != "") { la.ErrCode = -1; la.ErrMessage = errSt; return(la); } if (dt.Rows.Count == 0) { la.ErrCode = 1001; la.ErrMessage = "Felaktigt användarnamn eller lösenord"; return(la); } DataRow dr = dt.Rows[0]; if (dr["rep_kat_id"].ToString() != "AL_ST") { la.ErrCode = 1002; la.ErrMessage = "Rättigheter saknas till denna app"; return(la); } la.AnvID = login.AnvID; la.ident = UpdateAuthenticate(login.AnvID); la.pwd = ""; la.reparator = dr["reparator"].ToString(); la.canResetPyramid = Convert.ToBoolean(dr["canResetPyramid"]); la.ErrCode = 0; la.ErrMessage = ""; return(la); }
/// <summary> /// Login for the GaskMan application /// Will check tha gasketLevel (will be 5 for a user or 10 for an administrator) /// If the user is MaSa (Mattias Samuelsson) then the gasketLevel will be 10 without /// checking. /// </summary> /// <param name="login"></param> /// <returns>LoginAdm class. Check for errors</returns> /// 2018-08-14 kjbo public LoginAdm GLogin(LoginAdm login) { // Create parameter collection NxParameterCollection pc = new NxParameterCollection(); // Add anvandID and pwd as parameters pc.Add("pAnvID", login.AnvID); pc.Add("pPwd", login.pwd); // Create SQL clause string sSql = " select reparator, rep_kat_id, coalesce(gasketLevel,0) gasketLevel " + " from reparator " + " where anvID = :pAnvID " + " and pwd = :pPwd " + " and visas = true "; string errSt = ""; DataTable dt = cdb.getData(sSql, ref errSt, pc); LoginAdm la = new LoginAdm(); if (errSt != "") { la.ErrCode = -1; la.ErrMessage = errSt; return(la); } if (dt.Rows.Count == 0) { la.ErrCode = 1001; la.ErrMessage = "Felaktigt användarnamn eller lösenord"; return(la); } if (login.AnvID != "MaSa") { if (Convert.ToInt32(dt.Rows[0]["gasketLevel"]) == 0) { la.ErrCode = 1001; la.ErrMessage = "Behörighet saknas"; return(la); } } DataRow dr = dt.Rows[0]; la.AnvID = login.AnvID; la.ident = UpdateAuthenticate(login.AnvID); la.pwd = ""; la.reparator = dr["reparator"].ToString(); if (login.AnvID == "MaSa") { la.gasketLevel = 10; } else { la.gasketLevel = Convert.ToInt32(dr["gasketLevel"]); } la.ErrCode = 0; la.ErrMessage = ""; return(la); }
/// <summary> /// Login for the GaskMan application /// Will check tha gasketLevel (will be 5 for a user or 10 for an administrator) /// If the user is MaSa (Mattias Samuelsson) then the gasketLevel will be 10 without /// checking. /// </summary> /// <param name="login"></param> /// <returns>LoginAdm class. Check for errors</returns> /// 2018-08-14 kjbo public LoginAdm GLogin(LoginAdm login) { CReparator cr = new CReparator(); return(cr.GLogin(login)); }