private bool RequestIsValid(string dealerUserName, string dealerPassword) { string userName = dealerUserName; // MAKE THE PASSWORD MD5 ENCRYPTION string passWord = MD5Crypt.MDee5(dealerPassword); ClsDealer dl = new ClsDealer(); int isLoginValid = dl.IsDealerLoginValid(userName, passWord); return(isLoginValid == 1 ? true : false); }
public string Login(string dealerUserName, string dealerPassword, string mtid) { string userName = dealerUserName; // MAKE THE PASSWORD MD5 ENCRYPTION string passWord = MD5Crypt.MDee5(dealerPassword); ClsDealer dl = new ClsDealer(); string reqParams = "dealerUserName:"******"|REQ", "Login", reqParams); mtid += "|RESP"; //FIRST CHECK THAT USER IS NOT LOGGED IN ELSWHERE //if logged in elsewhere then inform user and terminate login proces int isDuplicateLogin = 0;// dl.CheckMultiLogin(userName); if (isDuplicateLogin == 1) { string errorMsg = "0|You Have Loged in elsewhere and cannot login at this terminal. Please log out from the other terminal."; //log the mobile request ClsPayment.LogMobileRequest2(dl.GetDealerCode(userName).ToString(), DateTime.Now, mtid, "Login", errorMsg); return(errorMsg); } else { int isLoginValid = dl.IsDealerLoginValid(userName, passWord); if (isLoginValid == 1) { SqlDataReader dr = dl.GetDealerDetails(userName); string fullName = "", availableCredit = "", dealerEmail = ""; while (dr.Read()) { fullName = dr["fullName"].ToString(); availableCredit = dr["availableCredit"].ToString(); dealerEmail = dr["dealerEmail"].ToString(); } string verNum = dl.GetLatestMobileVersion().ToString(); dl.AddMultiLogin(userName); //dl.AddLoginLocation(userName, longitude, latitude, address, mtid); string format = "username_fullname_availableCredit_versionNum_apkLink_brandMsg|"; //vernum = @vernum + | + apkLink string returnString = "1|" + format + userName + "|" + fullName + "|" + availableCredit + "|" + verNum + "|" + dl.GetPushMsg() + "|"; //log the mobile request ClsPayment.LogMobileRequest2(dl.GetDealerCode(userName).ToString(), DateTime.Now, mtid, "Login", returnString); return(returnString); } else { string errorMsg = "0|Your Login Is not VALID "; //log the mobile request ClsPayment.LogMobileRequest2(dl.GetDealerCode(userName).ToString(), DateTime.Now, mtid, "Login", errorMsg); return(errorMsg); } } }