public long GetDentalOfficeID(string username, string password) { long DentalOfficeID = 0; String md5password = new WebHostSynch.Util().MD5Encrypt(password); try { // a query involving both username and password is used because 2 dental offices could potentially have the same username String command = "SELECT * FROM userm WHERE UserName='******' AND Password='******'"; Userm um = Userms.GetOne(command); if (um == null) { DentalOfficeID = 0; //user password combination incorrect- specify message if necessary } else { DentalOfficeID = um.CustomerNum; } } catch (Exception ex) { Logger.LogError(ex); return(DentalOfficeID); } if (username.ToLower() == "demo") //for demo only { DentalOfficeID = GetDemoDentalOfficeID(); } return(DentalOfficeID); }
public void SetMobileWebUserPassword(long customerNum, String UserName, String Password) { Userm um = Userms.GetOne(customerNum, 1); bool UserExists = true; if (um == null) { um = new Userm(); UserExists = false; } um.CustomerNum = customerNum; um.UsermNum = 1; //always 1 um.UserName = UserName; if (Password != "") //do not update password if password string is empty { um.Password = MD5Encrypt(Password); } if (UserExists) { Userms.Update(um); } else { Userms.Insert(um); } }
public string GetMobileWebUserName(long customerNum) { String UserName = ""; Userm um = Userms.GetOne(customerNum, 1); if (um != null) { UserName = um.UserName; } return(UserName); }