public ActionResult PersonPhone_Update([DataSourceRequest] DataSourceRequest request, string pid, PhoneNumbers _objPhoneNumbers) { if (ModelState.IsValid) { if (_objPersonContactBAL.PersonPhoneNumbers_DuplicationCheckBAL(_objPhoneNumbers, Convert.ToInt64(pid)) > 0) { ModelState.AddModelError(lr.PersonPhoneNumber, lr.PersonPhoneDuplication); } else { _objPhoneNumbers.UpdatedBy = CurrentUser.NameIdentifierInt64; _objPhoneNumbers.UpdatedDate = DateTime.Now; var result = _objPersonContactBAL.PersonPhoneNumbers_UpdateBAL(_objPhoneNumbers, Convert.ToInt64(pid)); if (result == -1) { ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError); } } } var resultData = new[] { _objPhoneNumbers }; return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState))); }
public ActionResult Person_Update([DataSourceRequest] DataSourceRequest request, Person _person, string filename, long aid) { _person.UpdatedBy = CurrentUser.NameIdentifierInt64; _person.UpdatedDate = DateTime.Now; _person.ClientType = ClientType.ClientType_Internal; bool _valid = false; if (_person.Email != null)//when Email is Provided { _valid = true; } else if (_person.ContactNumber != null) //when Contact number is provided { if (_person.CountryCode == 0) //when country code is provided { ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde); } else { _valid = true; } } else { ModelState.AddModelError(lr.PersonContactEmail, lr.PersonEmailorPhoneRequired); } if (_valid) { var result = _PersonBAL.Person_UpdateBAL(_person); _person.ProfilePicture = HandlePersonProfilePicture(filename, _person.ID, aid); if (result != -1) { if (_person.PhoneID > 0) { if (_person.ContactNumber != null) { if (_person.CountryCode != 0)//when country code is provided { PhoneNumbers _objPhoneNumbers = new PhoneNumbers { ID = _person.PhoneID, ContactNumber = _person.ContactNumber, CountryCode = _person.CountryCode, IsPrimary = true, Extension = _person.Extension, UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now }; _objPersonContactBAL.PersonPhoneNumbers_UpdateBAL(_objPhoneNumbers, _person.ID); string ip = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (string.IsNullOrEmpty(ip)) { ip = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } _objConfigurationBAL.Audit_CreateBAL(ip, DateTime.Now, CurrentUser.CompanyID, CurrentUser.NameIdentifierInt64, EventType.Update, System.Web.HttpContext.Current.Request.Browser.Browser); } else { } } } else { if (_person.ContactNumber != null) //when Contact number is provided { if (_person.CountryCode == 0) //when country code is provided { ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde); } else { PhoneNumbers _objPhoneNumbers = new PhoneNumbers { ID = _person.PhoneID, ContactNumber = _person.ContactNumber, CountryCode = _person.CountryCode, IsPrimary = true, Extension = _person.Extension, CreatedBy = CurrentUser.NameIdentifierInt64, CreatedDate = DateTime.Now }; _person.PhoneID = _objPersonContactBAL.PersonPhoneNumbers_CreateBAL(_objPhoneNumbers, _person.ID); } } } if (_person.EmailID > 0) { if (_person.Email != null)//when Email is Provided { EmailAddresses _objEmailAddresses = new EmailAddresses { ID = _person.EmailID, Email = _person.Email, IsPrimary = true, UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now }; _objPersonContactBAL.PersonEmailAddress_UpdateBAL(_objEmailAddresses, _person.ID); } } else { if (_person.Email != null)//when Email is Provided { EmailAddresses _objEmailAddresses = new EmailAddresses { Email = _person.Email, IsPrimary = true, CreatedBy = CurrentUser.NameIdentifierInt64, CreatedDate = DateTime.Now }; _person.EmailID = _objPersonContactBAL.PersonEmailAddress_CreateBAL(_objEmailAddresses, _person.ID); } } } } var resultData = new[] { _person }; if (_person.Flags != null) { _person.Flags = _person.Flags.Where(i => i != null).ToList(); } //return Json(new object[0].ToDataSourceResult(request, ModelState)); return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState))); }
public ActionResult Trainer_Update([DataSourceRequest] DataSourceRequest request, Trainer _objTrainer, string filename, long aid) { _objTrainer.UpdatedBy = CurrentUser.NameIdentifierInt64; _objTrainer.UpdatedDate = DateTime.Now; bool _valid = false; if (_objTrainer.Email != null)//when Email is Provided { _valid = true; } else if (_objTrainer.ContactNumber != null) //when Contact number is provided { if (_objTrainer.CountryCode == 0) //when country code is provided { ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde); } else { _valid = true; } } else { ModelState.AddModelError(lr.PersonContactEmail, lr.PersonEmailorPhoneRequired); } if (_valid) { var result = _TrainerBAL.Trainer_UpdateBAL(_objTrainer); _objTrainer.ProfilePicture = HandlePersonProfilePicture(filename, _objTrainer.ID, aid); if (result != -1) { if (_objTrainer.PhoneID > 0) { if (_objTrainer.ContactNumber != null) { if (_objTrainer.CountryCode != 0)//when country code is provided { PhoneNumbers _objPhoneNumbers = new PhoneNumbers { ID = _objTrainer.PhoneID, ContactNumber = _objTrainer.ContactNumber, CountryCode = _objTrainer.CountryCode, IsPrimary = true, Extension = _objTrainer.Extension, UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now }; _objPersonContactBAL.PersonPhoneNumbers_UpdateBAL(_objPhoneNumbers, _objTrainer.ID); } else { } } } else { if (_objTrainer.ContactNumber != null) //when Contact number is provided { if (_objTrainer.CountryCode == 0) //when country code is provided { ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde); } else { PhoneNumbers _objPhoneNumbers = new PhoneNumbers { ID = _objTrainer.PhoneID, ContactNumber = _objTrainer.ContactNumber, CountryCode = _objTrainer.CountryCode, IsPrimary = true, Extension = _objTrainer.Extension, CreatedBy = CurrentUser.NameIdentifierInt64, CreatedDate = DateTime.Now }; _objTrainer.PhoneID = _objPersonContactBAL.PersonPhoneNumbers_CreateBAL(_objPhoneNumbers, _objTrainer.ID); } } } if (_objTrainer.EmailID > 0) { if (_objTrainer.Email != null)//when Email is Provided { EmailAddresses _objEmailAddresses = new EmailAddresses { ID = _objTrainer.EmailID, Email = _objTrainer.Email, IsPrimary = true, UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now }; _objPersonContactBAL.PersonEmailAddress_UpdateBAL(_objEmailAddresses, _objTrainer.ID); } } else { if (_objTrainer.Email != null)//when Email is Provided { EmailAddresses _objEmailAddresses = new EmailAddresses { Email = _objTrainer.Email, IsPrimary = true, CreatedBy = CurrentUser.NameIdentifierInt64, CreatedDate = DateTime.Now }; _objTrainer.EmailID = _objPersonContactBAL.PersonEmailAddress_CreateBAL(_objEmailAddresses, _objTrainer.ID); } } } } var resultData = new[] { _objTrainer }; if (_objTrainer.Flags != null) { _objTrainer.Flags = _objTrainer.Flags.Where(i => i != null).ToList(); } //return Json(new object[0].ToDataSourceResult(request, ModelState)); return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState))); }
public ActionResult Person_Update([DataSourceRequest] DataSourceRequest request, Person _person, string filename, long aid) { _person.UpdatedBy = CurrentUser.NameIdentifierInt64; _person.UpdatedDate = DateTime.Now; bool _valid = false; if (_UserBAL.LoginPerson_DuplicationCheckBAL(new Person { Email = _person.Email, CreatedBy = _person.CreatedBy }) > 0) { ModelState.AddModelError(lr.UserEmailAlreadyExist, lr.UserEmailAlreadyExist); // return Json(lr.UserEmailAlreadyExist, JsonRequestBehavior.AllowGet); _valid = false; } else if (_UserBAL.LoginPerson_DuplicationPhoneNumberUpdateCheckBAL(new Person { ContactNumber = _person.ContactNumber, CreatedBy = CurrentUser.CompanyID, ID = _person.ID }) > 0) { ModelState.AddModelError(lr.DubliocationHappen, lr.PersonContactPhoneDuplicationCheck); //return Json(lr.UserEmailAlreadyExist, JsonRequestBehavior.AllowGet); } else { if (_person.Email != null)//when Email is Provided { _valid = true; } else if (_person.ContactNumber != null) //when Contact number is provided { if (_person.CountryCode == 0) //when country code is provided { _person.CountryCode = 134; _valid = true; //ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde); } else { _valid = true; } } else { ModelState.AddModelError(lr.PersonContactEmail, lr.PersonEmailorPhoneRequired); } if (_valid) { _person.UpdatedBy = CurrentUser.NameIdentifierInt64; if (_person.CrmClientType == null) { _person.CrmClientType = CRMClientType.Not_Specified; } var result = _PersonBAL.Person_UpdateBAL(_person); _person.ProfilePicture = HandlePersonProfilePicture(filename, _person.ID, aid); if (result != -1) { if (_person.clientstatus == null) { _person.clientstatus = CRMClientType.Not_Specified; } _PersonBAL.ManageAssigned_UpdateBAL(_person); Library.TMS.Notifications nof = new Library.TMS.Notifications(); nof.NotificationText = "Your have assigned a prospect"; nof.Organization_ID = CurrentUser.CompanyID; nof.ToUser = Convert.ToInt64(_person.AssignedTo); nof.FromUser = CurrentUser.NameIdentifierInt64; nof.ActionUrl = "Prospect/Detail?pid=" + _person.ID; nof.Event_ID = 2; nof.CreatedDate = DateTime.Now; BALNotification.create_NotificationsBAL(nof); var notificationHub = GlobalHost.ConnectionManager.GetHubContext <NotificationHub>(); notificationHub.Clients.All.notify("added"); if (_person.PhoneID > 0) { if (_person.ContactNumber != null) { if (_person.CountryCode == 0) { _person.CountryCode = 134; } if (_person.CountryCode != 0)//when country code is provided { PhoneNumbers _objPhoneNumbers = new PhoneNumbers { ID = _person.PhoneID, ContactNumber = _person.ContactNumber, CountryCode = _person.CountryCode, IsPrimary = true, Extension = _person.Extension, UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now }; _objPersonContactBAL.PersonPhoneNumbers_UpdateBAL(_objPhoneNumbers, _person.ID); } else { } } } else { if (_person.ContactNumber != null) //when Contact number is provided { if (_person.CountryCode == 0) //when country code is provided { ModelState.AddModelError(lr.PersonPhoneCountryCode, lr.PersonPhoneNumberProvideCountryocde); } else { PhoneNumbers _objPhoneNumbers = new PhoneNumbers { ID = _person.PhoneID, ContactNumber = _person.ContactNumber, CountryCode = _person.CountryCode, IsPrimary = true, Extension = _person.Extension, CreatedBy = CurrentUser.NameIdentifierInt64, CreatedDate = DateTime.Now }; _person.PhoneID = _objPersonContactBAL.PersonPhoneNumbers_CreateBAL(_objPhoneNumbers, _person.ID); } } } if (_person.EmailID > 0) { if (_person.Email != null)//when Email is Provided { EmailAddresses _objEmailAddresses = new EmailAddresses { ID = _person.EmailID, Email = _person.Email, IsPrimary = true, UpdatedBy = CurrentUser.NameIdentifierInt64, UpdatedDate = DateTime.Now }; _objPersonContactBAL.PersonEmailAddress_UpdateBAL(_objEmailAddresses, _person.ID); } } else { if (_person.Email != null)//when Email is Provided { EmailAddresses _objEmailAddresses = new EmailAddresses { Email = _person.Email, IsPrimary = true, CreatedBy = CurrentUser.NameIdentifierInt64, CreatedDate = DateTime.Now }; _person.EmailID = _objPersonContactBAL.PersonEmailAddress_CreateBAL(_objEmailAddresses, _person.ID); } } } } } var resultData = new[] { _person }; if (_person.Flags != null) { _person.Flags = _person.Flags.Where(i => i != null).ToList(); } //return Json(new object[0].ToDataSourceResult(request, ModelState)); return(Json(resultData.AsQueryable().ToDataSourceResult(request, ModelState))); }