public List <User> GetUsers(DBSite site, string user_id = "") { List <User> user_list = new List <User>(); User user = null; string qry = " SELECT " + " UserInfoId" + ", UserName" + ", Email" + ", SenderId" + ", SMSUser" + ", SMSPassword" + ", SMSDelivery" + ", UserPassword" + ", CreationDate" + ", AmountPaid" + ", StartDate" + ", EndDate" + ", Address" + ", City" + ", Country" + ", Phone" + ", Mobile" + ", TinNumber" + ", SalesTaxNumber" + ", CSTNumber" + ", UserType" + ", IsUnicode" + ", NumberOfSubusers" + ", SMSUser" + ", SMSPassword" + ", SMSDelivery" + ", Remarks"; qry += " FROM tblUserInfo"; if (user_id != "") { qry += " WHERE UserInfoId=" + user_id; } DataTable dt = site.ExecuteSelect(qry); foreach (DataRow row in dt.Rows) { user = new User(); user.UserId = util.CheckNullInt(row["UserInfoId"]); user.UserName = util.CheckNull(row["UserName"]); user.EmailId = util.CheckNull(row["Email"]); user.SenderId = util.CheckNull(row["SenderId"]); user.SMSUser = util.CheckNull(row["SMSUser"]); user.SMSPassword = util.CheckNull(row["SMSPassword"]); user.SMSDelivery = util.CheckNullInt(row["SMSDelivery"]); user.UserPassword = util.CheckNull(row["UserPassword"]); user.AmountPaid = util.CheckNullDecimal(row["AmountPaid"]); user.CreationDate = ((DateTime)row["CreationDate"]).ToShortDateString(); user.StartDate = ((DateTime)row["StartDate"]).ToShortDateString(); user.EndDate = ((DateTime)row["EndDate"]).ToShortDateString(); user.Address = util.CheckNull(row["Address"]); user.City = util.CheckNull(row["City"]); user.Country = util.CheckNull(row["Country"]); user.Phone = util.CheckNull(row["Phone"]); user.Mobile = util.CheckNull(row["Mobile"]); user.TinNumber = util.CheckNull(row["TinNumber"]); user.SalesTaxNumber = util.CheckNull(row["SalesTaxNumber"]); //user.SalesTaxNumber = System.Web.HttpContext.Current.Server.MapPath("\\image\\logo.bmp"); // user.SalesTaxNumber = "http://www.gsc99.com/images/logo/bpslogo.jpg"; user.CSTNumber = util.CheckNull(row["CSTNumber"]); user.UserType = util.CheckNullInt(row["UserType"]); user.IsUnicode = util.CheckNullInt(row["IsUnicode"]) == 1 ? true : false; user.Remarks = util.CheckNull(row["Remarks"]); user.NumberOFSubusers = util.CheckNullInt(row["NumberOfSubusers"]); user.fYear = util.CheckNullInt(util.GetHomeSetting(site, "CurrentFYear")); user.Subusers = GetSubusers(site, user.UserId + ""); //------ get subuser list -------- user.Permissions = GetPermissions(site, user.UserId + ""); //----- get permission list -------- user_list.Add(user); } return(user_list); }
// ---------------- Authenticate User ---------------------------------------------- public UserBLL.User AuthenticateUser(DBSite site, string email_id, string password, string user_id = "", int subuserId = -1) { UserBLL.User user = null; UserBLL user_bll = new UserBLL(); string qry = "SELECT " + " UserInfoId" + ", UserName" + ", Email" + ", SenderID" + ", SMSUser" + ", SMSPassword" + ", SMSDelivery" + ", UserPassword" + ", CreationDate" + ", AmountPaid" + ", StartDate" + ", EndDate" + ", Address" + ", City" + ", Country" + ", Phone" + ", Mobile" + ", TinNumber" + ", SalesTaxNumber" + ", CSTNumber" + ", IsActive" + ", UserType" + ", IsUnicode" + ", Remarks" + ", NumberOfSubusers" + " FROM tblUserInfo"; if (user_id == "") { qry += " WHERE Email='" + email_id + "'" + " AND UserPassword='******'"; } else { qry += " WHERE UserInfoId=" + user_id; } DataTable dt = site.ExecuteSelect(qry); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; user = new UserBLL.User(); user.UserId = util.CheckNullInt(row["UserInfoID"]); user.UserName = util.CheckNull(row["UserName"]); user.EmailId = util.CheckNull(row["Email"]); user.SenderId = util.CheckNull(row["SenderID"]); user.SMSUser = util.CheckNull(row["SMSUser"]); user.SMSPassword = util.CheckNull(row["SMSPassword"]); user.SMSDelivery = util.CheckNullInt(row["SMSDelivery"]); user.UserPassword = util.CheckNull(row["UserPassword"]); user.CreationDate = Convert.ToDateTime(row["CreationDate"]).ToShortDateString(); user.AmountPaid = util.CheckNullDecimal(row["AmountPaid"]); user.StartDate = Convert.ToDateTime(row["StartDate"]).ToShortDateString(); user.EndDate = Convert.ToDateTime(row["EndDate"]).ToShortDateString(); user.Address = util.CheckNull(row["Address"]); user.City = util.CheckNull(row["City"]); user.Country = util.CheckNull(row["Country"]); user.Phone = util.CheckNull(row["Phone"]); user.Mobile = util.CheckNull(row["Mobile"]); user.TinNumber = util.CheckNull(row["TinNumber"]); user.SalesTaxNumber = util.CheckNull(row["SalesTaxNumber"]); user.CSTNumber = util.CheckNull(row["CSTNumber"]); user.IsActive = util.CheckNull(row["IsActive"]); user.UserType = util.CheckNullInt(row["UserType"]); user.IsUnicode = util.CheckNullInt(row["IsUnicode"]) == 1 ? true : false; user.Remarks = util.CheckNull(row["Remarks"]); user.NumberOFSubusers = util.CheckNullInt(row["NumberOfSubusers"]); user.fYear = util.CheckNullInt(util.GetHomeSetting(site, "CurrentFYear")); user.Subusers = user_bll.GetSubusers(site, user.UserId + ""); //------- Subusers -------- user.Current_subuserId = subuserId; user.Permissions = user_bll.GetPermissions(site, user.UserId + ""); //--------- Permissions ------------------ } return(user); }