private UserGeneralInfomation ConvertToDM(UserGeneralInformationBM model) { UserBL userBL = new UserBL(); if (model == null) return null; else return new UserGeneralInfomation { Id = model.Id, Address1=model.Address1, Address2=model.Address2, PhoneNumber=model.PhoneNumber, FatherName=model.FatherName, Status=model.Status, // CommunityId = userBL.GetUserById(model.UserId).CommunityId, // SubCommunityId = userBL.GetUserById(model.UserId).SubCommunityId, Image = model.Image, Active = model.Active, CreatedBy = model.CreatedBy, CreationDate = model.CreationDate, UserId = model.UserId, ModifiedBy = model.ModifiedBy, ModificationDate = model.ModificationDate }; }
private ShareContactDetailBM ConvertToBM(ShareContactDetail model) { UserGeneralInformationBM usergeneralInfoBM = new UserGeneralInformationBM(); UserProfessionalQualificationBM userProfessionalBM = new UserProfessionalQualificationBM(); UserBM userBM=new UserBM(); userBM=userBL.GetUserById(model.ShareUserId); usergeneralInfoBM = userGeneralInfoBL.GetGeneralInformationByUserId(model.ShareUserId); userProfessionalBM = userProfessionalQualificationBL.GetProfessionalQualificationByUserId(model.ShareUserId).FirstOrDefault(); return new ShareContactDetailBM() { Id=model.Id, CurrentUserId=model.CurrentUserId, ShareUserId=model.ShareUserId, Message=model.Message, CreationDate=model.CreationDate, CreatedBy=model.CreatedBy, ModificationDate=model.ModificationDate, ModifiedBy=model.ModifiedBy, Email=userBM!=null? userBM.Email:"", Phone=usergeneralInfoBM !=null ? usergeneralInfoBM.PhoneNumber :"", Company=userProfessionalBM !=null ?userProfessionalBM.CompanyName:"", // Designation = userProfessionalBM != null ? userProfessionalBM.Designation : "", IsDeleted=model.IsDeleted, userBM = userBL.GetUserById(model.CurrentUserId) }; }
// public List<Designa> IndustryList { get; set; } public ProfileModel() { UserProfessionalQualificationModel = new UserProfessionalQualificationBM(); IndustryList = commonBL.GetIndustry(); DegreeList = commonBL.GetDegree(); UserGeneralInformationModel = new UserGeneralInformationBM(); UserPersonalInformationModel = new UserPersonalInformationBM(); UserProfessionalQualificationModel = new UserProfessionalQualificationBM(); UserQualificatinModel = new UserQualificatinBM(); UserVideoModel = new UserVideoBM(); }
public void Update(UserGeneralInformationBM model) { uow.UserGeneralInfomationRepository.Update(ConvertToDM(model)); uow.Save(); }
public JsonResult GetUserGeneralDetail() { UserBM CurrentUser = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User); UserGeneralInformationBM UserGeneralInformationBM = new UserGeneralInformationBM(); if (CurrentUser != null) UserGeneralInformationBM = UserGeneralInformationBL.GetGeneralInformationByUserId(CurrentUser.Id); return Json(UserGeneralInformationBM, JsonRequestBehavior.AllowGet); }
private FriendBM ConvertToFriendBM(UserBM model) { UserGeneralInformationBL userGeneralInfoBL = new UserGeneralInformationBL(); UserGeneralInformationBM userGeneralInfoBM=new UserGeneralInformationBM(); userGeneralInfoBM=userGeneralInfoBL.GetGeneralInformationByUserId(model.Id); FriendBM frnd = new FriendBM(); frnd.UserId = CurrentUser; frnd.FriendName = model.Name; frnd.FriendCommunity = model.CommunityName; if (userGeneralInfoBM != null) frnd.FriendImage = string.IsNullOrEmpty(userGeneralInfoBM.Image) ? null : userGeneralInfoBM.Image; var friend = uow.FriendRepository.Find(x => x.UserId == CurrentUser && x.FriendId == model.Id).FirstOrDefault(); if (friend == null) { frnd.FriendId = model.Id; frnd.FriendShipStatusId = 0; } else { frnd.Id = friend.Id; frnd.FriendShipStatusId = friend.FriendShipStatusId; frnd.FriendId = friend.FriendId; frnd.CreationDate = friend.CreationDate; } return frnd; }
public ActionResult UpdateGeneralInformation(ProfileModel Model, HttpPostedFileBase file, FormCollection collection) { UserBM CurrentUser = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User); if (CurrentUser != null) { try { if (Model.UserGeneralInformationModel.Id == 0) { if (file != null) { UserGeneralInformationBL UserGeneralInformationBL = new BL.BusinessLayer.UserGeneralInformationBL(); string ImageName = System.IO.Path.GetFileName(file.FileName); string physicalPath = Server.MapPath("~/Images/" + ImageName); file.SaveAs(physicalPath); UserGeneralInformationBM UserGeneralInformation = new UserGeneralInformationBM(); UserGeneralInformation.Image = "/Images/" + ImageName; UserGeneralInformation.PhoneNumber = Model.UserGeneralInformationModel.PhoneNumber; UserGeneralInformation.Address1 = Model.UserGeneralInformationModel.Address1; UserGeneralInformation.Address2 = Model.UserGeneralInformationModel.Address2; UserGeneralInformation.FatherName = Model.UserGeneralInformationModel.FatherName; UserGeneralInformation.Status = Model.UserGeneralInformationModel.Status; UserGeneralInformation.UserId = CurrentUser.Id; UserGeneralInformation.CreatedBy = CurrentUser.Id; UserGeneralInformation.CreationDate = DateTime.Now; UserGeneralInformationBL.Create(UserGeneralInformation); // TempData["Success"] = "Record saved Successfully."; TempData["Success"] = "Record saved Successfully."; } } else { //update code UserGeneralInformationBM UserGeneralInformationBM = UserGeneralInformationBL.GetGeneralInformationByUserId(CurrentUser.Id); UserGeneralInformationBM.CommunityId = Model.UserGeneralInformationModel.CommunityId; UserGeneralInformationBM.SubCommunityId = Model.UserGeneralInformationModel.SubCommunityId; // UserGeneralInformationBM.Image = "/Images/" + ImageName; if (file != null) { string ImageName = System.IO.Path.GetFileName(file.FileName); string physicalPath = Server.MapPath("~/Images/" + ImageName); file.SaveAs(physicalPath); UserGeneralInformationBM.Image = "/Images/" + ImageName; } UserGeneralInformationBM.PhoneNumber = Model.UserGeneralInformationModel.PhoneNumber; UserGeneralInformationBM.Address1 = Model.UserGeneralInformationModel.Address1; UserGeneralInformationBM.Address2 = Model.UserGeneralInformationModel.Address2; UserGeneralInformationBM.FatherName = Model.UserGeneralInformationModel.FatherName; UserGeneralInformationBM.Status = Model.UserGeneralInformationModel.Status; UserGeneralInformationBM.UserId = CurrentUser.Id; UserGeneralInformationBM.ModifiedBy = CurrentUser.Id; UserGeneralInformationBM.ModificationDate = DateTime.Now; UserGeneralInformationBL.Update(UserGeneralInformationBM); TempData["Success"] = "Record saved Successfully."; } } catch (Exception ex) { TempData["Error"] = "An Error Occured."; } } else { TempData["Error"] = "Please Login."; } return RedirectToAction("EditProfile"); }
public void FillUserGeneralInformation(int UserId) { UserGeneralInformationBM UserGeneralInformation = new UserGeneralInformationBM(); UserGeneralInformation.Image = "/Images/" + "No-Image.jpg"; UserGeneralInformation.UserId = UserId; UserGeneralInformation.CreatedBy = UserId; UserGeneralInformation.CreationDate = DateTime.Now; UserGeneralInformationBL.Create(UserGeneralInformation); }