Ejemplo n.º 1
0
        /// <summary>
        /// Update User Profile Detail
        /// </summary>
        /// <param name="UpdateUserProfiledetailsModel"></param>
        /// <returns></returns>
        public int UpdateUserProfileDetail(UpdateUserProfiledetailsModel UpdateUserProfiledetailsModel)
        {
            int UserID = 0;

            try
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SP_UpdateUserProfileDetails", conn);
                cmd.Connection = conn;
                cmd.Parameters.AddWithValue("@User_ID", UpdateUserProfiledetailsModel.UserId);
                cmd.Parameters.AddWithValue("@First_Name", UpdateUserProfiledetailsModel.FirstName);
                cmd.Parameters.AddWithValue("@Last_Name", UpdateUserProfiledetailsModel.LastName);
                cmd.Parameters.AddWithValue("@Mobile_No", UpdateUserProfiledetailsModel.MobileNo);
                cmd.Parameters.AddWithValue("@Email_ID", UpdateUserProfiledetailsModel.EmailId);
                cmd.Parameters.AddWithValue("@Designation_ID", UpdateUserProfiledetailsModel.DesignationID);
                cmd.Parameters.AddWithValue("@Profile_Picture", UpdateUserProfiledetailsModel.ProfilePicture);

                cmd.CommandType = CommandType.StoredProcedure;
                UserID          = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }

            return(UserID);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// GetUserProfileDetails
        /// </summary>
        /// <param name="UserMasterID"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public List <UpdateUserProfiledetailsModel> GetUserProfileDetails(int UserMasterID, string url)
        {
            DataSet      ds  = new DataSet();
            MySqlCommand cmd = new MySqlCommand();
            List <UpdateUserProfiledetailsModel> UpdateUserProfiledetailsModel = new List <UpdateUserProfiledetailsModel>();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand cmd1 = new MySqlCommand("SP_GetUserProfileDetails", conn);
                cmd1.CommandType = CommandType.StoredProcedure;
                cmd1.Parameters.AddWithValue("@User_ID", UserMasterID);
                MySqlDataAdapter da = new MySqlDataAdapter();
                da.SelectCommand = cmd1;
                da.Fill(ds);
                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        UpdateUserProfiledetailsModel model = new UpdateUserProfiledetailsModel();
                        model.UserId          = Convert.ToInt32(ds.Tables[0].Rows[i]["UserID"]);
                        model.FirstName       = ds.Tables[0].Rows[i]["FirstName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["FirstName"]);
                        model.LastName        = ds.Tables[0].Rows[i]["LastName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["LastName"]);
                        model.MobileNo        = ds.Tables[0].Rows[i]["MobileNo"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["MobileNo"]);
                        model.EmailId         = ds.Tables[0].Rows[i]["EmailID"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["EmailID"]);
                        model.DesignationID   = Convert.ToInt32(ds.Tables[0].Rows[i]["DesignationID"]);
                        model.DesignationName = ds.Tables[0].Rows[i]["DesignationName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["DesignationName"]);
                        model.ProfilePicture  = ds.Tables[0].Rows[i]["ProfilePicture"] == DBNull.Value ? string.Empty :url + "/" + Convert.ToString(ds.Tables[0].Rows[i]["ProfilePicture"]);
                        UpdateUserProfiledetailsModel.Add(model);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
            return(UpdateUserProfiledetailsModel);
        }
Ejemplo n.º 3
0
        public ResponseModel UpdateUserProfileDetails(IFormFile File)
        {
            UpdateUserProfiledetailsModel updateUserProfiledetailsModel = new UpdateUserProfiledetailsModel();
            ProfileDetailsmodel           profileDetailsmodel           = new ProfileDetailsmodel();
            var keys = Request.Form;

            updateUserProfiledetailsModel = JsonConvert.DeserializeObject <UpdateUserProfiledetailsModel>(keys["UpdateUserProfiledetailsModel"]);
            var    file       = Request.Form.Files;
            string timeStamp  = DateTime.Now.ToString("ddmmyyyyhhssfff");
            var    folderName = Path.Combine(ProfileImg_Resources, ProfileImg_Image);
            var    pathToSave = Path.Combine(Directory.GetCurrentDirectory(), folderName);

            try
            {
                if (file.Count > 0)
                {
                    var fileName    = ContentDispositionHeaderValue.Parse(file[0].ContentDisposition).FileName.Trim('"');
                    var fileName_Id = fileName.Replace(".", updateUserProfiledetailsModel.UserId + timeStamp + ".") + "";
                    var fullPath    = Path.Combine(pathToSave, fileName_Id);
                    var dbPath      = Path.Combine(folderName, fileName_Id);

                    using (var stream = new FileStream(fullPath, FileMode.Create))
                    {
                        file[0].CopyTo(stream);
                    }
                    updateUserProfiledetailsModel.ProfilePicture = fileName_Id;
                    string url = Configuration.GetValue <string>("APIURL") + ProfileImg_Resources + "/" + ProfileImg_Image + "/" + fileName_Id;
                    profileDetailsmodel.ProfilePath = url;
                }
            }
            catch (Exception ex) { }
            ResponseModel objResponseModel = new ResponseModel();
            int           statusCode       = 0;
            string        statusMessage    = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token));

                UserCaller userCaller = new UserCaller();
                int        Result     = userCaller.UpdateUserProfileDetail(new UserServices(Cache, Db), updateUserProfiledetailsModel);
                profileDetailsmodel.Result = Result;
                statusCode =
                    Result == 0 ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;
                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = profileDetailsmodel;
            }
            catch (Exception)
            {
                throw;
            }

            return(objResponseModel);
        }
Ejemplo n.º 4
0
 public int UpdateUserProfileDetail(IStoreUser Users, UpdateUserProfiledetailsModel UpdateUserProfiledetailsModel)
 {
     _StoreUserRepository = Users;
     return(_StoreUserRepository.UpdateUserProfileDetail(UpdateUserProfiledetailsModel));
 }
Ejemplo n.º 5
0
 public int UpdateUserProfileDetail(IUser User, UpdateUserProfiledetailsModel UpdateUserProfiledetailsModel)
 {
     _UserRepository = User;
     return(_UserRepository.UpdateUserProfileDetail(UpdateUserProfiledetailsModel));
 }