//For updating Personal profile details public static bool UpdatePersonalProfile(PersonalProfileModel _PersonalProfileModel) { bool result = false; try { Database db = DatabaseFactory.CreateDatabase("Helios_V2_DB"); DbCommand dbCommand = db.GetStoredProcCommand("sp_Personal_Profile_upd"); db.AddInParameter(dbCommand, "@Employee_profile_id", DbType.Int32, _PersonalProfileModel.Employee_profile_id); db.AddInParameter(dbCommand, "@Employee_name", DbType.String, _PersonalProfileModel.Employee_name); db.AddInParameter(dbCommand, "@Prefered_name", DbType.String, _PersonalProfileModel.Prefered_name); db.AddInParameter(dbCommand, "@Nationality", DbType.String, _PersonalProfileModel.Nationality); db.AddInParameter(dbCommand, "@DOB", DbType.DateTime, _PersonalProfileModel.DOB); db.AddInParameter(dbCommand, "@Gender", DbType.String, _PersonalProfileModel.Gender); db.AddInParameter(dbCommand, "@Email", DbType.String, _PersonalProfileModel.Email); db.AddInParameter(dbCommand, "@Mobile_number", DbType.String, _PersonalProfileModel.Mobile_number); db.AddInParameter(dbCommand, "@Image_url", DbType.String, _PersonalProfileModel.Image_url); int ret = db.ExecuteNonQuery(dbCommand); if (ret > 0) { result = true; } else { result = false; } } catch (Exception ex) { string var = ex.Message; } return(result); }
//For Creating new Personal profile public static int InsertPersonalProfile(PersonalProfileModel _PersonalProfileModel) { int Employee_profile_id = 0; try { if (_PersonalProfileModel != null) { Database db = DatabaseFactory.CreateDatabase("Helios_V2_DB"); DbCommand dbCommand = db.GetStoredProcCommand("sp_Personal_Profile_ins"); db.AddInParameter(dbCommand, "@Employee_name", DbType.String, _PersonalProfileModel.Employee_name); db.AddInParameter(dbCommand, "@Prefered_name", DbType.String, _PersonalProfileModel.Prefered_name); db.AddInParameter(dbCommand, "@Nationality", DbType.String, _PersonalProfileModel.Nationality); db.AddInParameter(dbCommand, "@DOB", DbType.DateTime, _PersonalProfileModel.DOB); db.AddInParameter(dbCommand, "@Gender", DbType.String, _PersonalProfileModel.Gender); db.AddInParameter(dbCommand, "@Phone_number", DbType.String, _PersonalProfileModel.Phone_number); db.AddInParameter(dbCommand, "@Email", DbType.String, _PersonalProfileModel.Email); db.AddInParameter(dbCommand, "@Mobile_number", DbType.String, _PersonalProfileModel.Mobile_number); db.AddInParameter(dbCommand, "@Image_url", DbType.String, _PersonalProfileModel.Image_url); db.AddInParameter(dbCommand, "@Network_id", DbType.String, _PersonalProfileModel.Network_id); db.AddInParameter(dbCommand, "@Created_by", DbType.Int32, _PersonalProfileModel.Created_by); db.AddInParameter(dbCommand, "@Updated_by", DbType.Int32, _PersonalProfileModel.Updated_by); db.AddInParameter(dbCommand, "@Active_flag", DbType.Boolean, _PersonalProfileModel.Active_flag); Employee_profile_id = (int)db.ExecuteScalar(dbCommand); } } catch (Exception ex) { string var = ex.Message; } return(Employee_profile_id); }
public PartialViewResult NewPersonalProfile(PersonalProfileModel _PersonalProfileModel) { if (ModelState.IsValid) { EmployeeBL _EmployeeBL = new EmployeeBL(); int result = _EmployeeBL.InsertPersonalProfile(_PersonalProfileModel); } return(PartialView()); }
public int InsertPersonalProfile(PersonalProfileModel _PersonalProfileModel) { int result = 0; if (_PersonalProfileModel != null) { result = EmployeeProfileDAL.InsertPersonalProfile(_PersonalProfileModel); } return(result); }
public ActionResult PersonalProfileView(PersonalProfileModel _PersonalProfileModel) { EmployeeBL _EmployeeBL = new EmployeeBL(); bool result = _EmployeeBL.UpdatePersonalProfile(_PersonalProfileModel); if (result == true) { return(RedirectToAction("PersonalProfileList")); } else { return(View(_PersonalProfileModel)); } }
public ActionResult PersonalProfileView(int id) { List <PersonalProfileModel> PersonalProfileModelList = new List <PersonalProfileModel>(); PersonalProfileModel _PersonalProfileModel = new PersonalProfileModel(); EmployeeBL _EmployeeBL = new EmployeeBL(); PersonalProfileModelList = _EmployeeBL.GetPersonalProfile(id); foreach (var v in PersonalProfileModelList) { _PersonalProfileModel = v; } return(View(_PersonalProfileModel)); }
public async Task <IHttpActionResult> UpdatePersonalProfile(PersonalProfileModel model) { var userId = User.Identity.GetUserId <int>(); if (!string.IsNullOrEmpty(model.ProfileUrl)) { var uploadedImage = model.ProfileUrl.Split(new[] { ',' }, 2); if (uploadedImage.Count() > 1) { var serverPath = string.Concat(ConfigurationManager.AppSettings["ProfilePath"] + userId); var filePath = HttpContext.Current.Server.MapPath(serverPath); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } var imageInfo = uploadedImage[0]; var imageData = uploadedImage[1]; if (imageInfo.ToLower().Contains("base64") && imageInfo.ToLower().Contains("im")) { var fileExtension = "jpeg"; if (imageInfo.Contains(";")) { fileExtension = imageInfo.Split('/')[1].Split(';')[0]; } // Save the uploaded file to server model.ProfileUrl = string.Format("{0}/{1}.{2}", serverPath, userId, fileExtension); var fileName = string.Format("{0}\\{1}.{2}", filePath, userId, fileExtension); var bytes = Convert.FromBase64String(uploadedImage[1]); using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(imageData))) { using (System.Drawing.Bitmap bm2 = new System.Drawing.Bitmap(ms)) { bm2.Save(fileName); } } } } } var success = false; success = await repository.UpdatePersonalProfile(model); return(Ok(success)); }
//For geting Personal profile list public static List <PersonalProfileModel> GetPersonalProfile(int id) { PersonalProfileModel _PersonalProfileModel = null; List <PersonalProfileModel> PersonalProfileModelList = new List <PersonalProfileModel>(); try { Database db = DatabaseFactory.CreateDatabase("Helios_V2_DB"); DbCommand dbCommand = db.GetStoredProcCommand("sp_Personal_Profile_get"); if (id > 0) { db.AddInParameter(dbCommand, "@Employee_profile_id", DbType.Int32, id); } using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader != null && dataReader.Read()) { _PersonalProfileModel = new PersonalProfileModel(); _PersonalProfileModel.Employee_profile_id = DataParser.GetSafeInt(dataReader, "Employee_profile_id", 0); _PersonalProfileModel.Employee_name = DataParser.GetSafeString(dataReader, "Employee_name", string.Empty); _PersonalProfileModel.Prefered_name = DataParser.GetSafeString(dataReader, "Prefered_name", string.Empty); _PersonalProfileModel.Nationality = DataParser.GetSafeString(dataReader, "Nationality", string.Empty); _PersonalProfileModel.DOB = DataParser.GetSafeDateTime(dataReader, "DOB", DateTime.Now); _PersonalProfileModel.Gender = DataParser.GetSafeString(dataReader, "Gender", string.Empty); _PersonalProfileModel.Phone_number = DataParser.GetSafeString(dataReader, "Phone_number", string.Empty); _PersonalProfileModel.Email = DataParser.GetSafeString(dataReader, "Email", string.Empty); _PersonalProfileModel.Mobile_number = DataParser.GetSafeString(dataReader, "Mobile_number", string.Empty); _PersonalProfileModel.Image_url = DataParser.GetSafeString(dataReader, "Image_url", string.Empty); _PersonalProfileModel.Network_id = DataParser.GetSafeString(dataReader, "Network_id", string.Empty); _PersonalProfileModel.Created_by = DataParser.GetSafeInt(dataReader, "Created_by", 0); _PersonalProfileModel.Created_date = DataParser.GetSafeDateTime(dataReader, "Created_date", DateTime.Now); _PersonalProfileModel.Updated_by = DataParser.GetSafeInt(dataReader, "Updated_by", 0); _PersonalProfileModel.Updated_date = DataParser.GetSafeDateTime(dataReader, "Updated_date", DateTime.Now); _PersonalProfileModel.Active_flag = DataParser.GetSafeBool(dataReader, "Active_flag", true); PersonalProfileModelList.Add(_PersonalProfileModel); } } } catch (Exception ex) { string var = ex.Message; } return(PersonalProfileModelList); }
public async Task <bool> UpdatePersonalProfile(PersonalProfileModel model) { var success = false; await Task.Run(() => { using (var db = new SocialCRMEntities()) { var userProfile = db.AspNetUsers.Where(z => z.Email == model.Email).FirstOrDefault(); userProfile.Name = model.Name; userProfile.ProfileImage = model.ProfileUrl; userProfile.SignHTML = model.SignHtml; db.SaveChanges(); db.Dispose(); } }); return(success); }
public async Task <ActionResult> Create(PersonalProfileModel personalProfileModel) { // TODO: Country is invalid if (ModelState.IsValid) { var country = CountryArrays.Names[int.Parse(personalProfileModel.CountryIndex)]; var countryCode = CountryArrays.Abbreviations[int.Parse(personalProfileModel.CountryIndex)]; var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); /// Maps the personal profile model to the viewmodel, might add DTO's in the future PersonalProfile personalProfile = _mapper.Map <PersonalProfile>(personalProfileModel); personalProfile.Country = country; personalProfile.CountryCode = countryCode; personalProfile.ContextId = userId; personalProfile.Id = Guid.NewGuid().ToString(); personalProfile.DateUpdated = DateTime.Now; personalProfile.DateCreated = DateTime.Now; /*PersonalProfile personalProfile = new PersonalProfile * { * Id = * ContextId = userId, * DateCreated = DateTime.Now, * DateUpdated = DateTime.Now, * FirstName = personalProfileModel.FirstName, * LastName = personalProfileModel.LastName, * PhoneNumber = personalProfileModel.PhoneNumber, * EmailAddress = personalProfileModel.EmailAddress, * Address = personalProfileModel.Address, * Country = country, * CountryCode = countryCode, * City = personalProfileModel.City, * State = personalProfileModel.State, * PostalCode = personalProfileModel.PostalCode, * Links = personalProfileModel.Links * };*/ await _personalProfileService.AddAsync(personalProfile); } return(RedirectToAction(nameof(Index))); }
public static List <PersonalProfileModel> GetHRManager() { PersonalProfileModel _PersonalProfileModel = new PersonalProfileModel(); List <PersonalProfileModel> hrManagerList = new List <PersonalProfileModel>(); Database db = DatabaseFactory.CreateDatabase("Helios_V2_DB"); DbCommand dbCommand = db.GetStoredProcCommand("sp_HRManager_get"); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader != null && dataReader.Read()) { _PersonalProfileModel = new PersonalProfileModel(); _PersonalProfileModel.Employee_profile_id = DataParser.GetSafeInt(dataReader, "Employee_profile_id", 0); _PersonalProfileModel.Employee_name = DataParser.GetSafeString(dataReader, "Employee_name", String.Empty); hrManagerList.Add(_PersonalProfileModel); } } return(hrManagerList); }
public bool UpdatePersonalProfile(PersonalProfileModel _PersonalProfileModel) { bool result = EmployeeProfileDAL.UpdatePersonalProfile(_PersonalProfileModel); return(result); }