private bool isPhysicianMasterMailinAddressSame(PhysicianMaster physicianMaster) { if (physicianMaster.PracticeAddress1.Trim().Length <= 0 || physicianMaster.MailingAddress1.Trim().Length <= 0) { return(true); } return(physicianMaster.PracticeAddress1.Trim() == physicianMaster.MailingAddress1.Trim() && physicianMaster.PracticeState.Trim() == physicianMaster.MailingState.Trim() && physicianMaster.PracticeCity.Trim() == physicianMaster.MailingCity.Trim() && physicianMaster.PracticeZip.Trim() == physicianMaster.MailingZip.Trim()); }
//Dropdown list City public static List <Citymaster> ListCity(PhysicianMaster obj) { DataValue dv = new DataValue(); dv.Add("@STATE_CODE", obj.state, EnumCommand.DataType.Varchar); var listcity = (List <Citymaster>)SQLHelper.FetchData <Citymaster>(Common.Queries.SP_GET_CITYLIST, EnumCommand.DataSource.list, dv).DataSource.Data; return(listcity); }
public PhysicianMaster Save(PhysicianMaster domain) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var entity = Mapper.Map <PhysicianMaster, PhysicianMasterEntity>(domain); if (adapter.SaveEntity(entity, true)) { return(Mapper.Map <PhysicianMasterEntity, PhysicianMaster>(entity)); } throw new PersistenceFailureException(); } }
public JsonResult Savephysicianmaster(PhysicianMaster PhysicianMaster) { try { PhysicianMaster.P_KEY = "S"; PhysicianMaster.INSERTBY = Session[Common.SESSION_VARIABLES.USERNAME].ToString(); //PhysicianMaster.ORGID = "1"; PhysicianMaster.ORGID = Session[Common.SESSION_VARIABLES.COMPANYCODE].ToString(); PhysicianMaster.ISACTIVE = (PhysicianMaster.ISACTIVE == Common.ActiveLog.Active) ? "Y" : "N"; objViewModel.liphysicianMaster = MasterViewModel.SavePhysicianMaster(PhysicianMaster); return(Json(objViewModel, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex)); } }
public void UpdateCustomerPrimaryCarePhysician(PhysicianMaster physicianMaster, long stateId, long countryId) { var primaryCarePhysicians = _primaryCarePhysicianRepository.GetByPhysicianMasterId(physicianMaster.Id); if (primaryCarePhysicians != null && primaryCarePhysicians.Any()) { foreach (var primaryCarePhysician in primaryCarePhysicians) { primaryCarePhysician.Name = new Name(physicianMaster.FirstName, physicianMaster.MiddleName, physicianMaster.LastName); primaryCarePhysician.Primary = physicianMaster.PracticePhone; primaryCarePhysician.Fax = physicianMaster.PracticeFax; primaryCarePhysician.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(1);//TaazaaAdmin primaryCarePhysician.DataRecorderMetaData.DateModified = DateTime.Now; primaryCarePhysician.Npi = physicianMaster.Npi; primaryCarePhysician.PrefixText = physicianMaster.PrefixText; primaryCarePhysician.SuffixText = physicianMaster.SuffixText; primaryCarePhysician.CredentialText = physicianMaster.CredentialText; if (!string.IsNullOrEmpty(physicianMaster.PracticeAddress1) && !string.IsNullOrEmpty(physicianMaster.PracticeState) && !string.IsNullOrEmpty(physicianMaster.PracticeCity) && !string.IsNullOrEmpty(physicianMaster.PracticeZip)) { long addressId = 0; if (primaryCarePhysician.Address != null) { addressId = primaryCarePhysician.Address.Id; } primaryCarePhysician.Address = new Address(addressId) { StreetAddressLine1 = physicianMaster.PracticeAddress1, StreetAddressLine2 = physicianMaster.PracticeAddress2, City = physicianMaster.PracticeCity, StateId = stateId,//physicianMaster.PracticeState, ZipCode = new ZipCode(physicianMaster.PracticeZip), CountryId = countryId }; } _primaryCarePhysicianRepository.Save(primaryCarePhysician); } } }
public JsonResult BindListphysicianMaster() { try { PhysicianMaster objModel = new PhysicianMaster(); Statemaster obj = new Statemaster(); Citymaster city = new Citymaster(); Usermst user = new Usermst(); objModel.P_KEY = "L"; objModel.ORGID = Session[Common.SESSION_VARIABLES.COMPANYCODE].ToString(); user.ORGID = Session[Common.SESSION_VARIABLES.COMPANYCODE].ToString(); objViewModel.liphysicianMaster = MasterViewModel.SavePhysicianMaster(objModel); objViewModel.liStateMaster = MasterViewModel.ListState(obj); objViewModel.liUserMaster = MasterViewModel.ListUserdetails(user); //objViewModel.liCityMaster = Manage_InfoViewModel.ListCity(city); return(Json(objViewModel, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex)); } }
private PrimaryCarePhysician UpdatePcpAddressesFromMaster(PhysicianMaster physicianMaster, PrimaryCarePhysician pcp) { var stateRepository = IoC.Resolve <IStateRepository>(); if (physicianMaster.PracticeAddress1.Trim().Length > 0 && physicianMaster.PracticeState.Trim().Length > 0 && physicianMaster.PracticeCity.Trim().Length > 0 && physicianMaster.PracticeZip.Trim().Length > 0) { var state = stateRepository.GetStatebyCode(physicianMaster.PracticeState) ?? stateRepository.GetState(physicianMaster.PracticeState); long addressId = 0; if (pcp.Address != null) { addressId = pcp.Address.Id; } pcp.Address = SetPCPAddressFromPhysicianMaster(addressId, physicianMaster.PracticeAddress1, physicianMaster.PracticeAddress2, physicianMaster.PracticeCity, state.Id, state.CountryId, physicianMaster.PracticeZip); } else { pcp.Address = null; } if (!isPhysicianMasterMailinAddressSame(physicianMaster) && physicianMaster.MailingAddress1.Trim().Length > 0 && physicianMaster.MailingState.Trim().Length > 0 && physicianMaster.MailingCity.Trim().Length > 0 && physicianMaster.MailingZip.Trim().Length > 0) { var state = stateRepository.GetStatebyCode(physicianMaster.MailingState) ?? stateRepository.GetState(physicianMaster.MailingState); long addressId = 0; if (pcp.MailingAddress != null && (pcp.Address != null && pcp.MailingAddress.Id != pcp.Address.Id)) { addressId = pcp.MailingAddress.Id; } pcp.MailingAddress = SetPCPAddressFromPhysicianMaster(addressId, physicianMaster.MailingAddress1, physicianMaster.MailingAddress2, physicianMaster.MailingCity, state.Id, state.CountryId, physicianMaster.MailingZip); } else { pcp.MailingAddress = null; } return(pcp); }
public PhysicianMaster SavePhysicianMaster(PhysicianMaster physicianMaster, long stateId, long countryId) { var existingPhysicianMaster = _physicianMasterRepository.GetByNpi(physicianMaster.Npi); if (existingPhysicianMaster != null) { physicianMaster.Id = existingPhysicianMaster.Id; physicianMaster.DateCreated = existingPhysicianMaster.DateCreated; physicianMaster.DateModified = DateTime.Now; } else { physicianMaster.DateCreated = DateTime.Now; } physicianMaster = _physicianMasterRepository.Save(physicianMaster); if (existingPhysicianMaster != null) { UpdateCustomerPrimaryCarePhysician(physicianMaster, stateId, countryId); } return(physicianMaster); }
public static List <PhysicianMaster> SavePhysicianMaster(PhysicianMaster PhysicianMaster) { DataValue dv = new DataValue(); dv.Add("@PHYID", PhysicianMaster.PHYID, EnumCommand.DataType.Varchar); dv.Add("@ISACTIVE", PhysicianMaster.ISACTIVE, EnumCommand.DataType.Varchar); dv.Add("@U_ID", PhysicianMaster.U_ID, EnumCommand.DataType.Varchar); dv.Add("@DOCTORNAME", PhysicianMaster.DOCTORNAME, EnumCommand.DataType.Varchar); dv.Add("@SPECIALITY", PhysicianMaster.SPECIALITY, EnumCommand.DataType.Varchar); dv.Add("@MOBILENO", PhysicianMaster.MOBILENO, EnumCommand.DataType.Varchar); dv.Add("@ADDRESS_DETAIL", PhysicianMaster.ADDRESS_DETAIL, EnumCommand.DataType.Varchar); dv.Add("@ORGID", PhysicianMaster.ORGID, EnumCommand.DataType.Varchar); dv.Add("@INSERTBY", PhysicianMaster.INSERTBY, EnumCommand.DataType.Varchar); dv.Add("@INSERTDATE", PhysicianMaster.INSERTDATE, EnumCommand.DataType.Varchar); dv.Add("@MODIFYDATE", PhysicianMaster.MODIFYDATE, EnumCommand.DataType.Varchar); dv.Add("@email_address", PhysicianMaster.email_address, EnumCommand.DataType.Varchar); dv.Add("@state", PhysicianMaster.state, EnumCommand.DataType.Varchar); dv.Add("@city", PhysicianMaster.city, EnumCommand.DataType.Varchar); dv.Add("@zipcode", PhysicianMaster.zipcode, EnumCommand.DataType.Varchar); dv.Add("@P_KEY", PhysicianMaster.P_KEY, EnumCommand.DataType.Varchar); var Physicianmasterinsert = (List <PhysicianMaster>)SQLHelper.FetchData <PhysicianMaster>(Common.Queries.SP_PHYMST_ACTION, EnumCommand.DataSource.list, dv).DataSource.Data; return(Physicianmasterinsert); }
private bool SavePcpDetails() { if (rbtnYes.Checked) { try { var countryRepository = IoC.Resolve <ICountryRepository>(); var countryId = countryRepository.GetAll().First().Id; var primaryCarePhysicianRepository = IoC.Resolve <IPrimaryCarePhysicianRepository>(); PrimaryCarePhysician pcp = null; if (!chkPCPChange.Checked) { pcp = primaryCarePhysicianRepository.Get(CustomerId); } var currentOrganizationRole = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole; var physicianMasterRepository = IoC.Resolve <IPhysicianMasterRepository>(); var newPcp = false; if (Convert.ToInt64(PhysicianMasterIdHiddenField.Value) > 0) { var physicianMaster = physicianMasterRepository.GetById(Convert.ToInt64(PhysicianMasterIdHiddenField.Value)); if (pcp == null) { pcp = new PrimaryCarePhysician { Name = new Name(physicianMaster.FirstName, physicianMaster.MiddleName, physicianMaster.LastName), Primary = physicianMaster.PracticePhone, Fax = physicianMaster.PracticeFax, PrefixText = physicianMaster.PrefixText, SuffixText = physicianMaster.SuffixText, CredentialText = physicianMaster.CredentialText, Npi = physicianMaster.Npi, PhysicianMasterId = physicianMaster.Id, CustomerId = CustomerId, DataRecorderMetaData = new DataRecorderMetaData(currentOrganizationRole.OrganizationRoleUserId, DateTime.Now, null), IsActive = true }; } else { pcp.Name = new Name(physicianMaster.FirstName, physicianMaster.MiddleName, physicianMaster.LastName); pcp.Primary = physicianMaster.PracticePhone; pcp.Fax = physicianMaster.PracticeFax; pcp.PrefixText = physicianMaster.PrefixText; pcp.SuffixText = physicianMaster.SuffixText; pcp.CredentialText = physicianMaster.CredentialText; pcp.Npi = physicianMaster.Npi; pcp.PhysicianMasterId = physicianMaster.Id; pcp.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(currentOrganizationRole.OrganizationRoleUserId); pcp.DataRecorderMetaData.DateModified = DateTime.Now; pcp.IsActive = true; } pcp = UpdatePcpAddressesFromMaster(physicianMaster, pcp); } else { if (pcp == null) { newPcp = true; pcp = new PrimaryCarePhysician { Name = new Name(UCPCPInfo1.FirstName, UCPCPInfo1.MiddleName, UCPCPInfo1.LastName), Primary = string.IsNullOrEmpty(UCPCPInfo1.Phone) ? null : PhoneNumber.Create(UCPCPInfo1.Phone, PhoneNumberType.Home), Secondary = string.IsNullOrEmpty(UCPCPInfo1.AlternatePhone) ? null : PhoneNumber.Create(UCPCPInfo1.AlternatePhone, PhoneNumberType.Office), Fax = string.IsNullOrEmpty(UCPCPInfo1.Fax) ? null : PhoneNumber.Create(UCPCPInfo1.Fax, PhoneNumberType.Unknown), Email = string.IsNullOrEmpty(UCPCPInfo1.Email) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.Email), SecondaryEmail = string.IsNullOrEmpty(UCPCPInfo1.AlternateEmail) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.AlternateEmail), Website = UCPCPInfo1.WebsiteUrl, CustomerId = CustomerId, DataRecorderMetaData = new DataRecorderMetaData(currentOrganizationRole.OrganizationRoleUserId, DateTime.Now, null), IsActive = true, }; } else { pcp.Name = new Name(UCPCPInfo1.FirstName, UCPCPInfo1.MiddleName, UCPCPInfo1.LastName); pcp.Primary = string.IsNullOrEmpty(UCPCPInfo1.Phone) ? null : PhoneNumber.Create(UCPCPInfo1.Phone, PhoneNumberType.Home); pcp.Secondary = string.IsNullOrEmpty(UCPCPInfo1.AlternatePhone) ? null : PhoneNumber.Create(UCPCPInfo1.AlternatePhone, PhoneNumberType.Office); pcp.Fax = string.IsNullOrEmpty(UCPCPInfo1.Fax) ? null : PhoneNumber.Create(UCPCPInfo1.Fax, PhoneNumberType.Unknown); pcp.Email = string.IsNullOrEmpty(UCPCPInfo1.Email) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.Email); pcp.SecondaryEmail = string.IsNullOrEmpty(UCPCPInfo1.AlternateEmail) ? new Email(string.Empty, string.Empty) : new Email(UCPCPInfo1.AlternateEmail); pcp.Website = UCPCPInfo1.WebsiteUrl; pcp.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(currentOrganizationRole.OrganizationRoleUserId); pcp.DataRecorderMetaData.DateModified = DateTime.Now; pcp.IsActive = true; } if (UCPCPInfo1.Address1.Trim().Length > 0 && UCPCPInfo1.State != "0" && UCPCPInfo1.City.Trim().Length > 0 && UCPCPInfo1.Zip.Trim().Length > 0) { long addressId = 0; if (pcp.Address != null) { addressId = pcp.Address.Id; } pcp.Address = new Address(addressId) { StreetAddressLine1 = UCPCPInfo1.Address1, StreetAddressLine2 = UCPCPInfo1.Address2, City = UCPCPInfo1.City, StateId = Convert.ToInt64(UCPCPInfo1.State), ZipCode = new ZipCode(UCPCPInfo1.Zip), CountryId = countryId }; } else { pcp.Address = null; } SetPcpMaillingAddress(pcp, countryId); } var isPcpAddressVerified = false; if (Convert.ToInt64(PhysicianMasterIdHiddenField.Value) > 0) { isPcpAddressVerified = chkVerifiedPcpInfo.Checked; } else { isPcpAddressVerified = UCPCPInfo1.IsPcpAddressVerified; } pcp.IsPcpAddressVerified = isPcpAddressVerified; pcp.PcpAddressVerifiedBy = currentOrganizationRole.OrganizationRoleUserId; pcp.PcpAddressVerifiedOn = DateTime.Now; pcp = primaryCarePhysicianRepository.Save(pcp); var currentActivePcp = primaryCarePhysicianRepository.Get(CustomerId); var eventCustomerRepository = IoC.Resolve <IEventCustomerRepository>(); if (EventId > 0) { var eventCustomer = eventCustomerRepository.GetRegisteredEventForUser(CustomerId, EventId); if (eventCustomer != null && currentActivePcp != null) { var eventCustomerPrimaryCarePhysicianRepository = IoC.Resolve <IEventCustomerPrimaryCarePhysicianRepository>(); var eventCustomerPrimarycarePhysician = new EventCustomerPrimaryCarePhysician { EventCustomerId = eventCustomer.Id, PrimaryCarePhysicianId = currentActivePcp.Id, IsPcpAddressVerified = isPcpAddressVerified, PcpAddressVerifiedOn = DateTime.Now, PcpAddressVerifiedBy = currentOrganizationRole.OrganizationRoleUserId }; eventCustomerPrimaryCarePhysicianRepository.Save(eventCustomerPrimarycarePhysician); } } if (newPcp && pcp.PhysicianMasterId == null) { var physicianMaster = new PhysicianMaster() { LastName = pcp.Name.LastName, FirstName = pcp.Name.FirstName, MiddleName = pcp.Name.MiddleName, PracticePhone = pcp.Primary, PracticeFax = pcp.Fax, IsImported = false, IsActive = true, DateCreated = DateTime.Now, Npi = "" }; if (pcp.Address != null) { physicianMaster.PracticeAddress1 = pcp.Address.StreetAddressLine1; physicianMaster.PracticeAddress2 = pcp.Address.StreetAddressLine2; physicianMaster.PracticeCity = pcp.Address.City; physicianMaster.PracticeState = pcp.Address.StateCode; physicianMaster.PracticeZip = pcp.Address.ZipCode.Zip; } if (pcp.MailingAddress != null) { physicianMaster.MailingAddress1 = pcp.MailingAddress.StreetAddressLine1; physicianMaster.MailingAddress2 = pcp.MailingAddress.StreetAddressLine2; physicianMaster.MailingCity = pcp.MailingAddress.City; physicianMaster.MailingState = pcp.MailingAddress.StateCode; physicianMaster.MailingZip = pcp.MailingAddress.ZipCode.Zip; } if (pcp.Address != null && pcp.MailingAddress == null) { physicianMaster.MailingAddress1 = pcp.Address.StreetAddressLine1; physicianMaster.MailingAddress2 = pcp.Address.StreetAddressLine2; physicianMaster.MailingCity = pcp.Address.City; physicianMaster.MailingState = pcp.Address.StateCode; physicianMaster.MailingZip = pcp.Address.ZipCode.Zip; } physicianMaster = physicianMasterRepository.Save(physicianMaster); pcp.PhysicianMasterId = physicianMaster.Id; primaryCarePhysicianRepository.Save(pcp); } } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(typeof(string), "jscodecityvalidate", "alert('" + ex.Message + "');", true); return(false); } } if (Request.QueryString["Call"] != null && Request.QueryString["Call"] == "No") { if (Request.QueryString["CustomerID"] != null) { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=no&CustomerID=" + Request.QueryString["CustomerID"] + "&Name=" + Request.QueryString["Name"] + "&Call=No&EventRegistered=Yes" + "&guid=" + GuId); } else { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=no&Call=No&EventRegistered=Yes" + "&guid=" + GuId); } } else { if (Request.QueryString["CustomerID"] != null) { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=yes &CustomerID=" + Request.QueryString["CustomerID"] + "&Name=" + Request.QueryString["Name"] + "&guid=" + GuId); } else { Response.RedirectUser("../AddNotes.aspx?LbuttonVisible=yes" + "&guid=" + GuId); } } return(true); }
public JsonResult BindCity(PhysicianMaster obj) { objViewModel.liCityMaster = MasterViewModel.ListCity(obj); return(Json(objViewModel, JsonRequestBehavior.AllowGet)); }