public vw_HG_UsersDetails MobileAlreadyExist(string UserLogin) { vw_HG_UsersDetails ObjTmp = new vw_HG_UsersDetails(); ObjTmp = new vw_HG_UsersDetails().GetSingleByUserId(UserLogin: UserLogin); return(ObjTmp); }
public List <vw_HG_UsersDetails> GetAll(string Type = "", int OrgId = 0) { var CurrOrgID = HttpContext.Current.Request.Cookies["UserInfo"]; SqlConnection Con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Con"].ToString()); Con.Open(); List <vw_HG_UsersDetails> listOfuser = new List <vw_HG_UsersDetails>(); string Query = " SELECT * FROM HG_UsersDetails WHERE UserType!='CUST' ;"; if (Type != "") { Query = "SELECT * FROM HG_UsersDetails WHERE UserType='" + Type + "' ;"; } else if (OrgId > 0) { Query = "SELECT * FROM HG_UsersDetails WHERE OrgID=" + OrgId.ToString() + ";"; } else if (CurrOrgID != null && int.Parse(CurrOrgID["OrgId"]) > 0) { Query = "SELECT * FROM HG_UsersDetails WHERE OrgID=" + CurrOrgID["OrgId"] + ";"; } SqlCommand cmd = new SqlCommand(Query, Con); try { SqlDataReader SDR = cmd.ExecuteReader(); while (SDR.Read()) { vw_HG_UsersDetails ObjTmp = new vw_HG_UsersDetails(); ObjTmp.UserCode = SDR.GetInt32(0); ObjTmp.OrgID = SDR.GetInt32(1); ObjTmp.UserType = SDR.GetString(2); ObjTmp.UserName = SDR.GetString(3); ObjTmp.UserId = SDR.GetString(4); ObjTmp.Password = SDR.GetString(5); ObjTmp.EMail = SDR.IsDBNull(6)?"": SDR.GetString(6); ObjTmp.UPhoto = SDR.IsDBNull(7) ? "" : SDR.GetString(7); ObjTmp.EntryBy = SDR.GetInt32(8); ObjTmp.EntryDate = SDR.GetDateTime(9); ObjTmp.UpdateDate = SDR.GetDateTime(10); ObjTmp.Status = SDR.GetBoolean(11); ObjTmp.CurrentStatus = SDR.IsDBNull(12) ? false : SDR.GetBoolean(12); ObjTmp.JoinByOrg = SDR.GetInt32(13); ObjTmp.IsHeadChef = SDR.GetBoolean(14); ObjTmp.TickUntick = SDR.GetBoolean(15); ObjTmp.RateNow = SDR.GetInt32(16); listOfuser.Add(ObjTmp); } } catch (Exception e) { e.ToString(); } finally { cmd.Dispose(); Con.Close(); } return(listOfuser); }
public vw_HG_UsersDetails GetSingleByUserId(int UserCode = 0, string UserLogin = null) { DBCon dBCon = new DBCon(); SqlCommand cmd = null; SqlDataReader SDR = null; vw_HG_UsersDetails ObjTmp = new vw_HG_UsersDetails(); string Query = ""; try { if (UserLogin != null) { Query = "SELECT TOP 1 * FROM HG_UsersDetails where UserId='" + UserLogin + "'"; } else { Query = "SELECT TOP 1 * FROM HG_UsersDetails where UserCode=" + UserCode.ToString() + ""; } cmd = new SqlCommand(Query, dBCon.Con); SDR = cmd.ExecuteReader(); while (SDR.Read()) { ObjTmp = new vw_HG_UsersDetails(); ObjTmp.UserCode = SDR.GetInt32(0); ObjTmp.OrgID = SDR.GetInt32(1); ObjTmp.UserType = SDR.GetString(2); ObjTmp.UserName = SDR.GetString(3); ObjTmp.UserId = SDR.GetString(4); ObjTmp.Password = SDR.GetString(5); ObjTmp.EMail = SDR.GetString(6); ObjTmp.UPhoto = SDR.IsDBNull(7) ? "" : SDR.GetString(7); ObjTmp.EntryBy = SDR.GetInt32(8); ObjTmp.EntryDate = SDR.GetDateTime(9); ObjTmp.UpdateDate = SDR.GetDateTime(10); ObjTmp.Status = SDR.GetBoolean(11); ObjTmp.CurrentStatus = SDR.IsDBNull(12) ? false : SDR.GetBoolean(12); ObjTmp.JoinByOrg = SDR.GetInt32(13); ObjTmp.IsHeadChef = SDR.GetBoolean(14); ObjTmp.TickUntick = SDR.GetBoolean(15); ObjTmp.RateNow = SDR.GetInt32(16); } } catch (Exception e) { e.ToString(); } finally { cmd.Dispose(); SDR.Close(); dBCon.Con.Close(); dBCon.Con.Dispose(); } return(ObjTmp); }
//this is get One Function public vw_HG_UsersDetails Checkvw_HG_UsersDetails() { DBCon dBCon = new DBCon(); SqlCommand cmd = null; SqlDataReader SDR = null; vw_HG_UsersDetails ObjTmp = null; try { string Query = "SELECT TOP 1 * FROM HG_UsersDetails WHERE UserID = @UserID AND Password = @Password COLLATE Latin1_General_CS_AS;"; cmd = new SqlCommand(Query, dBCon.Con); cmd.Parameters.AddWithValue("@UserID", UserId); cmd.Parameters.AddWithValue("@Password", Password); SDR = cmd.ExecuteReader(); while (SDR.Read()) { ObjTmp = new vw_HG_UsersDetails(); ObjTmp.UserCode = SDR.GetInt32(0); ObjTmp.OrgID = SDR.GetInt32(1); ObjTmp.UserType = SDR.GetString(2); ObjTmp.UserName = SDR.GetString(3); ObjTmp.UserId = SDR.GetString(4); ObjTmp.Password = SDR.GetString(5); ObjTmp.EMail = SDR.GetString(6); ObjTmp.UPhoto = SDR.IsDBNull(7) ? "" : SDR.GetString(7); ObjTmp.EntryBy = SDR.GetInt32(8); ObjTmp.EntryDate = SDR.GetDateTime(9); ObjTmp.UpdateDate = SDR.GetDateTime(10); ObjTmp.Status = SDR.GetBoolean(11); ObjTmp.CurrentStatus = SDR.IsDBNull(12) ? false : SDR.GetBoolean(12); ObjTmp.JoinByOrg = SDR.GetInt32(13); ObjTmp.IsHeadChef = SDR.GetBoolean(14); ObjTmp.TickUntick = SDR.GetBoolean(15); ObjTmp.RateNow = SDR.GetInt32(16); } } catch (Exception e) { e.ToString(); } finally { cmd.Dispose(); SDR.Close(); dBCon.Con.Close(); dBCon.Con.Dispose(); SDR.Close(); } return(ObjTmp); }