예제 #1
0
        public List <UserProfileEditModel> GetUserSpecificDetails(Hashtable userProfileCriteria)
        {
            var _db   = new DBUtility();
            var token = new List <UserProfileEditModel>();
            var _dt   = new DataTable();

            _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "GP_SP_GetUserSpecificDetails";

            _cmd.Parameters.AddWithValue("@UserId", Convert.ToString(userProfileCriteria["UserID"]));

            if (string.IsNullOrWhiteSpace(Convert.ToString(userProfileCriteria["Name"])))
            {
                _cmd.Parameters.AddWithValue("@Name", DBNull.Value);
            }
            else
            {
                _cmd.Parameters.AddWithValue("@Name", Convert.ToString(userProfileCriteria["Name"]).Trim());
            }
            if (string.IsNullOrWhiteSpace(Convert.ToString(userProfileCriteria["SortingOrder"])))
            {
                _cmd.Parameters.AddWithValue("@SortingOrder", DBNull.Value);
            }
            else
            {
                _cmd.Parameters.AddWithValue("@SortingOrder", Convert.ToString(userProfileCriteria["SortingOrder"]).Trim());
            }

            _dt = _db.FillDataTable(_cmd, _dt);
            if (_dt.Rows.Count > 0)
            {
                foreach (DataRow dr in _dt.Rows)
                {
                    var temp = new UserProfileEditModel();
                    temp.ID            = Convert.ToInt32(dr["ID"]);
                    temp.Name          = Convert.ToString(dr["Name"]);
                    temp.Email         = Convert.ToString(dr["EmailAddress"]);
                    temp.Address       = Convert.ToString(dr["Address"]);
                    temp.City          = Convert.ToString(dr["City"]);
                    temp.StateName     = Convert.ToString(dr["StateName"]);
                    temp.ZipCode       = Convert.ToInt32(dr["ZipCode"]);
                    temp.CompanyName   = Convert.ToString(dr["CompanyName"]);
                    temp.LicenceNumber = Convert.ToString(dr["LicenseNumber"]);
                    temp.PhoneNumber   = Convert.ToString(dr["PhoneNumber"]);
                    temp.RoleId        = Convert.ToInt32(dr["RoleID"]);
                    temp.IsPaid        = Convert.ToBoolean(DataRowExtensions.GetValue(dr, "IsPaid"));
                    temp.CustomerID    = Convert.ToString(DataRowExtensions.GetValue(dr, "CustomerID"));
                    temp.ProfileImage  = Convert.ToString(dr["ProfileImage"]);
                    temp.IsEnabled     = Convert.ToBoolean(DataRowExtensions.GetValue(dr, "IsEnabled"));
                    temp.Gender        = Convert.ToString(dr["Gender"]);
                    temp.CreatedDate   = Convert.ToDateTime(DataRowExtensions.GetValue(dr, "CreatedDate"));
                    temp.ModifiedDate  = Convert.ToDateTime(DataRowExtensions.GetValue(dr, "ModifiedDate"));
                    temp.Password      = Convert.ToString(DataRowExtensions.GetValue(dr, "Password"));
                    temp.RoleName      = Convert.ToString(DataRowExtensions.GetValue(dr, "RoleName"));
                    token.Add(temp);
                }
            }
            return(token);
        }