Пример #1
0
    private void FillPcpInfo()
    {
        var primaryCarePhysicianRepository = IoC.Resolve <IPrimaryCarePhysicianRepository>();
        var pcp = primaryCarePhysicianRepository.Get(CustomerId);

        if (pcp != null)
        {
            spanpcpchange.Visible = true;
            var commonCode = new CommonCode();
            UCPCPInfo1.FirstName  = pcp.Name.FirstName;
            UCPCPInfo1.MiddleName = pcp.Name.MiddleName;
            UCPCPInfo1.LastName   = pcp.Name.LastName;
            UCPCPInfo1.Phone      = !string.IsNullOrEmpty(commonCode.FormatPhoneNumber(pcp.Primary.ToString()))
                ? commonCode.FormatPhoneNumber(pcp.Primary.ToString())
                : string.Empty;
            UCPCPInfo1.AlternatePhone = !string.IsNullOrEmpty(commonCode.FormatPhoneNumber(pcp.Secondary.ToString()))
               ? commonCode.FormatPhoneNumber(pcp.Secondary.ToString())
               : string.Empty;
            UCPCPInfo1.Email = pcp.Email != null?pcp.Email.ToString() : string.Empty;

            UCPCPInfo1.AlternateEmail = pcp.SecondaryEmail != null?pcp.SecondaryEmail.ToString() : string.Empty;

            UCPCPInfo1.WebsiteUrl = pcp.Website;
            if (pcp.Address != null)
            {
                UCPCPInfo1.Address1 = pcp.Address.StreetAddressLine1;
                UCPCPInfo1.Address2 = pcp.Address.StreetAddressLine2;
                UCPCPInfo1.City     = pcp.Address.City;
                UCPCPInfo1.State    = pcp.Address.StateId.ToString();
                UCPCPInfo1.Zip      = pcp.Address.ZipCode.Zip;
            }
            if (pcp.MailingAddress != null)
            {
                UCPCPInfo1.MaillingAddress1 = pcp.MailingAddress.StreetAddressLine1;
                UCPCPInfo1.MaillingAddress2 = pcp.MailingAddress.StreetAddressLine2;
                UCPCPInfo1.MaillingCity     = pcp.MailingAddress.City;
                UCPCPInfo1.MaillingState    = pcp.MailingAddress.StateId.ToString();
                UCPCPInfo1.MaillingZip      = pcp.MailingAddress.ZipCode.Zip;
            }
            UCPCPInfo1.IsMaillingAddressSame = IsMailingAddressSame(pcp);
            if (pcp.Address != null && pcp.MailingAddress == null)
            {
                UCPCPInfo1.MaillingAddress1      = pcp.Address.StreetAddressLine1;
                UCPCPInfo1.MaillingAddress2      = pcp.Address.StreetAddressLine2;
                UCPCPInfo1.MaillingCity          = pcp.Address.City;
                UCPCPInfo1.MaillingState         = pcp.Address.StateId.ToString();
                UCPCPInfo1.MaillingZip           = pcp.Address.ZipCode.Zip;
                UCPCPInfo1.IsMaillingAddressSame = true;
            }

            HasPcpHiddenField.Value = Boolean.TrueString;
        }
    }
Пример #2
0
        private void SetProspectCustomerDataToControls()
        {
            var commonCode = new CommonCode();
            ProspectCustomer currentProspectCustomer = null;

            if (CurrentProspectCustomerId > 0)
            {
                var prospectCustomerRepository = IoC.Resolve <IUniqueItemRepository <ProspectCustomer> >();
                currentProspectCustomer   = prospectCustomerRepository.GetById(CurrentProspectCustomerId);
                CurrentProspectCustomerId = currentProspectCustomer.Id;
            }
            if (currentProspectCustomer == null)
            {
                return;
            }

            txtFirstName.Text  = currentProspectCustomer.FirstName;
            txtLastName.Text   = currentProspectCustomer.LastName;
            txtZipCode.Text    = currentProspectCustomer.Address.ZipCode.Zip;
            txtCallBackNo.Text = currentProspectCustomer.CallBackPhoneNumber != null
                                     ? commonCode.FormatPhoneNumber(
                currentProspectCustomer.CallBackPhoneNumber.ToString())
                                     : string.Empty;
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegistrationFlow.CanSaveConsentInfo = false;
            if (Request.QueryString["guid"] == null || Request.QueryString["guid"] == string.Empty)
            {
                Response.RedirectUser("/CallCenter/CallCenterRepDashboard/Index");
            }

            SetDisplayControls();
            SetJavaScriptEvents();
            if (!IsPostBack)
            {
                var   repository = new CallCenterCallRepository();
                ECall objCall    = repository.GetCallCenterEntity(ExistingCallId);
                if (objCall != null && (!string.IsNullOrWhiteSpace(objCall.CallersPhoneNumber) || !string.IsNullOrWhiteSpace(objCall.CallBackNumber)))
                {
                    var commonCode = new CommonCode();
                    txtCallBackNo.Text = commonCode.FormatPhoneNumber(string.IsNullOrWhiteSpace(objCall.CallersPhoneNumber) ? objCall.CallBackNumber : objCall.CallersPhoneNumber);
                }

                hfCallStartTime.Value = objCall.TimeCreated;
                if ((Request.UrlReferrer != null) && Request.UrlReferrer.LocalPath == "/App/CallCenter/CallCenterRep/CustomerVerification.aspx")
                {
                    if (CurrentProspectCustomerId > 0)
                    {
                        SetProspectCustomerDataToControls();
                    }
                    if (RegistrationFlow != null)
                    {
                        txtSourceCode.Text = RegistrationFlow.CallSourceCode;
                    }
                    if (Request.QueryString["CustomerId"] != null)
                    {
                        txtCustomerID.Text = Request.QueryString["CustomerId"];
                    }
                }
                else if (Request.UrlReferrer != null && Request.UrlReferrer.LocalPath == "/App/CallCenter/CallCenterRep/AddNotes.aspx")
                {
                    if (CurrentProspectCustomerId > 0)
                    {
                        SetProspectCustomerDataToControls();
                        CurrentProspectCustomerId = 0;
                        txtFirstName.Text         = "";
                    }
                }
                else if (CurrentProspectCustomerId > 0)
                {
                    SetProspectCustomerDataToControls();
                }

                if (RegistrationFlow != null)
                {
                    RegistrationFlow.CallSourceCode     = string.Empty;
                    RegistrationFlow.SourceCode         = string.Empty;
                    RegistrationFlow.SourceCodeId       = 0;
                    RegistrationFlow.SourceCodeAmount   = 0;
                    RegistrationFlow.TestIds            = null;
                    RegistrationFlow.PackageId          = 0;
                    RegistrationFlow.AppointmentSlotIds = null;
                    RegistrationFlow.ShippingDetailId   = 0;
                    RegistrationFlow.ShippingOptionId   = 0;
                    RegistrationFlow.ShippingAddressId  = 0;
                    RegistrationFlow.ProductId          = 0;
                    RegistrationFlow.PackageCost        = 0;
                    RegistrationFlow.TotalAmount        = 0;
                }
            }

            if (Request.Params["__EVENTTARGET"] != null && Request.Params["__EVENTTARGET"] == "Search")
            {
                SearchCustomer();
            }
        }
Пример #4
0
        private void SetProspectCustomer()
        {
            long?sourceCodeId = null;

            if (!string.IsNullOrEmpty(txtSourceCode.Text))
            {
                ISourceCodeRepository sourceCodeRepository = new SourceCodeRepository();
                try
                {
                    var sourceCode = sourceCodeRepository.GetSourceCodeByCode(txtSourceCode.Text);
                    if (sourceCode != null)
                    {
                        sourceCodeId = sourceCode.Id;
                    }
                }
                catch
                {
                    sourceCodeId = null;
                }
            }

            var commonCode  = new CommonCode();
            var phoneNumber = commonCode.FormatPhoneNumber(txtCallBackNo.Text);
            ProspectCustomer prospectCustomer = null;

            if (CurrentProspectCustomerId > 0)
            {
                var proecpectCustomerRepository = IoC.Resolve <IProspectCustomerRepository>();
                prospectCustomer = proecpectCustomerRepository.GetProspectCustomer(CurrentProspectCustomerId);
            }
            else
            {
                prospectCustomer = new ProspectCustomer
                {
                    FirstName = txtFirstName.Text,
                    LastName  = txtLastName.Text,
                    Address   = new Address {
                        ZipCode = new ZipCode {
                            Zip = txtZipCode.Text
                        }
                    },
                    Source        = ProspectCustomerSource.CallCenter,
                    Tag           = ProspectCustomerTag.CallCenterSignup,
                    TagUpdateDate = DateTime.Now
                                    //SourceCodeId = sourceCodeId
                };
            }
            if (!string.IsNullOrEmpty(phoneNumber))
            {
                prospectCustomer.CallBackPhoneNumber = new PhoneNumber
                {
                    PhoneNumberType = PhoneNumberType.Unknown,
                    Number          =
                        phoneNumber.Substring(3,
                                              phoneNumber.Length - 3),
                    AreaCode = phoneNumber.Substring(0, 3)
                };
            }
            if (ViewState["IncomingPhoneLine"] != null && !string.IsNullOrEmpty(ViewState["IncomingPhoneLine"].ToString()))
            {
                var incomingPhoneNumber = ViewState["IncomingPhoneLine"].ToString();
                prospectCustomer.PhoneNumber = new PhoneNumber
                {
                    PhoneNumberType = PhoneNumberType.Unknown,
                    Number          =
                        incomingPhoneNumber.Substring(3,
                                                      incomingPhoneNumber
                                                      .Length - 3),
                    AreaCode = incomingPhoneNumber.Substring(0, 3)
                };
            }

            SaveProspectCustomerNew(prospectCustomer);
        }
Пример #5
0
    private void SaveFranchisor()
    {
        OtherDAL otherDal = new OtherDAL();
        EZip     objczip;

        objczip = otherDal.CheckCityZip(txtCity.Text, txtzip1.Text, ddlState.SelectedValue);

        if (objczip.CityID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('City name entered for contact address is not valid.');", true);
            return;
        }
        else if (objczip.CityID > 0 && objczip.ZipID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('Zip Code entered for contact address, corresponding to its city name, is not valid.');", true);
            return;
        }

        EFranchisorUser franchisoruser = new EFranchisorUser();
        var             address        = new Falcon.Entity.Other.EAddress();
        var             user           = new Falcon.Entity.Other.EUser();
        // format phone no.
        CommonCode objCommonCode = new CommonCode();


        franchisoruser.Active = true;

        address.Address1       = txtaddress1.Text;
        address.Address2       = txtAddress2.Text;
        address.CityID         = objczip.CityID;
        address.StateID        = Convert.ToInt32(ddlState.SelectedValue);
        address.CountryID      = Convert.ToInt32(hfCountryID.Value);
        address.ZipID          = objczip.ZipID;
        user.FirstName         = txtfname.Text;
        user.MiddleName        = txtMiddleName.Text;
        user.LastName          = txtlname.Text;
        user.SSN               = txtSSN.Text;
        user.DOB               = Convert.ToDateTime(txtDOB.Text).ToString();
        user.PhoneHome         = objCommonCode.FormatPhoneNumber(txtphonehome.Text);
        user.PhoneOffice       = objCommonCode.FormatPhoneNumber(txtphoneother.Text);
        user.PhoneCell         = objCommonCode.FormatPhoneNumber(txtphonecell.Text);
        user.EMail1            = txtEmail1.Text;
        user.EMail2            = txtEmail2.Text;
        franchisoruser.User    = user;
        franchisoruser.Address = address;
        Int64 returnresult;

        var currentSession = IoC.Resolve <ISessionContext>().UserSession;


        franchisoruser.ShellDescription = txtabtmself.Text;

        FranchisorDAL franchisorDAL = new FranchisorDAL();

        if (ViewState["IsEdit"].ToString() != string.Empty)
        {
            franchisoruser.User.UserID = Convert.ToInt32(currentSession.UserId);


            returnresult = franchisorDAL.SaveFranchisorUser(franchisoruser, Convert.ToInt32(EOperationMode.Update),
                                                            currentSession.CurrentOrganizationRole.OrganizationId.ToString());
            if (returnresult == 0)
            {
                returnresult = 9999991;
            }

            if (txtPassword.Text.Length > 0)
            {
                var userLoginService = IoC.Resolve <IUserLoginService>();
                userLoginService.ResetPassword(Convert.ToInt32(currentSession.UserId), txtPassword.Text, false, currentSession.CurrentOrganizationRole.OrganizationRoleUserId, false);
            }
            Response.RedirectUser(ResolveUrl("~/App/Franchisor/ProfilePage.aspx"));
        }
        else
        {
            returnresult = franchisorDAL.SaveFranchisorUser(franchisoruser, Convert.ToInt32(EOperationMode.Insert),
                                                            currentSession.CurrentOrganizationRole.OrganizationId.ToString());
            if (returnresult == 0)
            {
                returnresult = 9999990;
            }
        }
    }
Пример #6
0
    public EContact GetFields(out int rownumber)
    {
        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        EContact objcontact = new EContact();

        //objcontact = new EContact();

        if (ViewState["RowNumber"] != null)
        {
            rownumber = Convert.ToInt32(ViewState["RowNumber"]);
        }
        else
        {
            rownumber = -1;
        }

        if (ViewState["ContactID"] != null)
        {
            objcontact.ContactID = Convert.ToInt32(ViewState["ContactID"]);
        }
        else
        {
            objcontact.ContactID = 0;
        }

        objcontact.Title           = txtTitle.Text;
        objcontact.FirstName       = txtFName.Text;
        objcontact.LastName        = txtLName.Text;
        objcontact.MiddleName      = txtMName.Text;
        objcontact.PhoneOffice     = objCommonCode.FormatPhoneNumber(txtPhoneOffice.Text);
        objcontact.WebSite         = "";
        objcontact.Phone1Extension = txtPhoneExtension.Text;

        objcontact.EMail       = txtEmailContact.Text;
        objcontact.PhoneCell   = objCommonCode.FormatPhoneNumber(txtPhoneCell.Text);
        objcontact.PhoneHome   = objCommonCode.FormatPhoneNumber(txtPhoneHome.Text);
        objcontact.EmailWork   = txtSecondaryEmail.Text;
        objcontact.DateOfBirth = txtBday.Text;
        objcontact.Fax         = objCommonCode.FormatPhoneNumber(txtFax.Text);

        objcontact.DesignationTitle = txtTitleContact.Text;
        objcontact.Gender           = Convert.ToBoolean(rbtMale.Checked);
        List <EProspectContactRole> prospectRole = new List <EProspectContactRole>();

        for (int pcount = 0; pcount < chkRoleContact.Items.Count; pcount++)
        {
            if (chkRoleContact.Items[pcount].Selected)
            {
                EProspectContactRole eprospect = new EProspectContactRole();
                eprospect.ProspectContactRoleID   = Convert.ToInt16(chkRoleContact.Items[pcount].Value);
                eprospect.ProspectContactRoleName = Convert.ToString(chkRoleContact.Items[pcount].Text);
                prospectRole.Add(eprospect);
            }
        }
        //objcontact.ListProspectContactRole = prospectRole.ToArray();
        objcontact.ListProspectContactRole = prospectRole;

        objcontact.Note = txtNotesContact.Text;

        ViewState["ContactID"] = null;
        ViewState["RowNumber"] = -1;

        return(objcontact);
    }
Пример #7
0
    /// <summary>
    /// Save Prospect
    /// </summary>
    private void SaveProspect()
    {
        //FranchisorService service = new FranchisorService();
        EProspect        prospect            = new EProspect();
        EAddress         addressbilling      = new EAddress();
        EAddress         addressmailing      = new EAddress();
        EProspectDetails objEProspectDetails = new EProspectDetails();

        prospect.ProspectDetails = new EProspectDetails();
        bool blnIsHost = false;

        OtherDAL otherDal      = new OtherDAL();
        EZip     zipobjbilling = otherDal.CheckCityZip(txtcityBilling.Text, txtzipBilling.Text, ddlstateBilling.SelectedValue);

        EZip zipobjmailing = new EZip();

        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        if (txtzipBilling.Text != "")
        {
            if (zipobjbilling.CityID == 0)
            {
                divErrorMsg.Visible   = true;
                divErrorMsg.InnerHtml = "City name for address is not valid. <br> Please Try again.";

                //ClientScript.RegisterStartupScript(typeof(string), "jscodebilling", "alert('City name for billing address is not valid. <br> Please Try again.');", true);
                return;
            }
            else if (zipobjbilling.CityID > 0 && zipobjbilling.ZipID == 0)
            {
                divErrorMsg.Visible   = true;
                divErrorMsg.InnerHtml = "Address Zip code for the corresponding city is not valid. <br> Please Try again.";

                //ClientScript.RegisterStartupScript(typeof(string), "jscodebilling", "alert('Billing address Zip code for the corresponding city is not valid. <br> Please Try again.');", true);
                return;
            }
        }
        if (chkMailingAddress.Checked == true)
        {
            zipobjmailing = otherDal.CheckCityZip(txtcityMailing.Text, txtzipMailing.Text, ddlstateMailing.SelectedValue);
            if (txtzipMailing.Text != "")
            {
                if (zipobjmailing.CityID == 0)
                {
                    divErrorMsg.Visible   = true;
                    divErrorMsg.InnerHtml = "City name for mailing address is not valid. <br> Please Try again.";

                    //ClientScript.RegisterStartupScript(typeof(string), "jscodemailing", "alert('City name for mailing address is not valid. <br> Please Try again.');", true);
                    return;
                }
                else if (zipobjmailing.CityID > 0 && zipobjmailing.ZipID == 0)
                {
                    divErrorMsg.Visible   = true;
                    divErrorMsg.InnerHtml = "Mailing address Zip code for the corresponding city is not valid. <br> Please Try again.";

                    //ClientScript.RegisterStartupScript(typeof(string), "jscodemailing", "alert('Mailing address Zip code for the corresponding city is not valid. <br> Please Try again.');", true);
                    return;
                }
            }
        }

        if (ViewState["ProspectID"] != null)
        {
            prospect.ProspectID = Convert.ToInt32(ViewState["ProspectID"].ToString());
        }

        if (ViewState["AddressIDBilling"] != null)
        {
            addressbilling.AddressID = Convert.ToInt32(ViewState["AddressIDBilling"].ToString());
        }

        prospect.OrganizationName = txtOrgName.Text;
        prospect.WebSite          = txtwebaddress.Text;

        EProspectType prospecttype = new EProspectType();

        prospecttype.ProspectTypeID = Convert.ToInt32(ddlHostType.SelectedValue.ToString());
        prospect.ProspectType       = prospecttype;

        prospect.ActualMembership = txtActualMembers.Text.Length > 0 ? Convert.ToDecimal(txtActualMembers.Text) : 0;
        prospect.Attendance       = txtAttendence.Text.Length > 0 ? Convert.ToDecimal(txtAttendence.Text) : 0;

        prospect.EMailID   = txtEmail.Text;
        prospect.PhoneCell = "";
        if (txtcphoneoffice.Text.Trim().Equals("(___)-___-____"))
        {
            txtcphoneoffice.Text = "";
        }
        prospect.PhoneOffice = objCommonCode.FormatPhoneNumber(txtcphoneoffice.Text);
        prospect.PhoneOther  = "";

        prospect.Notes = txtNotes.Text;

        if (ViewState["IsHost"].ToString().Equals("1"))
        {
            prospect.IsHost = true;
            blnIsHost       = true;
        }
        else
        {
            prospect.IsHost = false;
        }

        addressbilling.Address1 = txtaddress1Billing.Text;
        addressbilling.Address2 = txtaddress2Billing.Text;


        if (Convert.ToInt32(ddlstateBilling.SelectedValue) > 0)
        {
            addressbilling.State   = ddlstateBilling.SelectedItem.Text;
            addressbilling.StateID = Convert.ToInt32(ddlstateBilling.SelectedItem.Value);
        }
        else
        {
            addressbilling.State = string.Empty;
        }

        addressbilling.ZipID = txtzipBilling.Text.Length > 0 ? Convert.ToInt32(txtzipBilling.Text) : 0;
        addressbilling.City  = txtcityBilling.Text;
        if (txtFax.Text.Trim().Equals("(___)-___-____"))
        {
            txtFax.Text = "";
        }
        addressbilling.Fax = objCommonCode.FormatPhoneNumber(txtFax.Text);

        prospect.Address = addressbilling;

        if (blnIsHost)
        {
            addressbilling.ZipID = txtzipBilling.Text.Length > 0 ? zipobjbilling.ZipID : 0;
        }
        else
        {
            addressbilling.ZipID = txtzipBilling.Text.Length > 0 ? Convert.ToInt32(txtzipBilling.Text) : 0;
        }

        addressbilling.CityID = txtcityBilling.Text.Length > 0 ? zipobjbilling.CityID : 0;

        addressbilling.Country   = COUNTRY_NAME;
        addressbilling.CountryID = COUNTRY_ID;

        // If mailing address is provided
        if (chkMailingAddress.Checked == true)
        {
            addressmailing.IsMailing = true;
            addressmailing.Address1  = txtaddress1Mailing.Text;
            addressmailing.Address2  = txtaddress2Mailing.Text;

            if (Convert.ToInt32(ddlstateMailing.SelectedValue) > 0)
            {
                addressmailing.State   = ddlstateMailing.SelectedItem.Text;
                addressmailing.StateID = Convert.ToInt32(ddlstateBilling.SelectedItem.Value);
            }
            else
            {
                addressmailing.State = string.Empty;
            }

            if (blnIsHost)
            {
                addressmailing.ZipID = txtzipMailing.Text.Length > 0 ? zipobjmailing.ZipID : 0;
            }
            else
            {
                addressmailing.ZipID = txtzipMailing.Text.Length > 0 ? Convert.ToInt32(txtzipMailing.Text) : 0;
            }

            addressmailing.City   = txtcityMailing.Text;
            addressmailing.CityID = txtcityMailing.Text.Length > 0 ? zipobjmailing.CityID : 0;
            addressmailing.Zip    = txtzipMailing.Text;
            addressmailing.Fax    = "";

            addressmailing.Country   = COUNTRY_NAME;
            addressmailing.CountryID = COUNTRY_ID;
        }
        // Mailing address is same as billing address
        else
        {
            addressmailing.Address1 = addressbilling.Address1;
            addressmailing.Address2 = addressbilling.Address2;
            addressmailing.City     = addressbilling.City;
            addressmailing.State    = addressbilling.State;
            addressmailing.Zip      = addressbilling.Zip;
            addressmailing.Country  = addressbilling.Country;

            addressmailing.CityID    = addressbilling.CityID;
            addressmailing.StateID   = addressbilling.StateID;
            addressmailing.ZipID     = addressbilling.ZipID;
            addressmailing.CountryID = addressbilling.CountryID;

            addressmailing.IsMailing = true;
        }

        if (ViewState["AddressIDMailing"] != null)
        {
            addressmailing.AddressID = Convert.ToInt32(ViewState["AddressIDMailing"].ToString());
        }

        prospect.AddressMailing  = addressmailing;
        prospect.FollowDate      = DateTime.Now.ToShortDateString();
        prospect.WillCommunicate = Convert.ToInt32(ddlFeederPromotionStatus.SelectedValue);
        if (ddlFeederPromotionStatus.SelectedValue.Equals("0"))
        {
            prospect.ReasonWillCommunicate = txtWillPromote.Text;
        }
        if (ViewState["FranchiseeID"] != null)
        {
            ArrayList arrtemp = (ArrayList)ViewState["FranchiseeID"];
            prospect.FranchiseeID = arrtemp;
            //prospect.FranchiseeID = arrtemp.ToArray();
        }


        objEProspectDetails.FacilitiesFee = txtFacilitiesFee.Text;

        string strPaymentMethod = string.Empty;

        foreach (ListItem li in chkPaymentMethod.Items)
        {
            if (li.Selected == true)
            {
                if (strPaymentMethod == "")
                {
                    strPaymentMethod = li.Value;
                }
                else
                {
                    strPaymentMethod = strPaymentMethod + "," + li.Value;
                }
            }
        }
        objEProspectDetails.PaymentMethod   = strPaymentMethod;
        objEProspectDetails.DepositsRequire = Convert.ToInt16(rbtnDepositsRequired.SelectedValue);

        if (rbtnDepositsRequired.SelectedValue.Equals("1"))
        {
            objEProspectDetails.DepositsAmount = txtAmount.Text.Length > 0 ? Convert.ToDecimal(txtAmount.Text) : 0.0m;
        }
        objEProspectDetails.WillHost       = Convert.ToInt16(ddlhostStatus.SelectedValue);
        objEProspectDetails.ViableHostSite = Convert.ToInt16(ddlViableHost.SelectedValue);
        objEProspectDetails.HostedInPast   = Convert.ToInt16(ddlHostedInPast.SelectedValue);
        if (ddlhostStatus.SelectedValue.Equals("0"))
        {
            objEProspectDetails.ReasonWillHost = txtWillHost.Text;
        }
        if (ddlViableHost.SelectedValue.Equals("0"))
        {
            objEProspectDetails.ReasonViableHostSite = txtViableHostSite.Text;
        }
        if (ddlHostedInPast.SelectedValue.Equals("0"))
        {
            objEProspectDetails.ReasonHostedInPast = txtHostInPast.Text;
        }
        if (ddlHostedInPast.SelectedValue.Equals("1"))
        {
            objEProspectDetails.HostedInPastWith = txtHostedInPast.Text;
        }

        if (ViewState["ProspectDetailsID"] != null)
        {
            objEProspectDetails.ProspectDetailID = Convert.ToInt32(ViewState["ProspectDetailsID"].ToString());
        }
        prospect.ProspectDetails = objEProspectDetails;

        prospect.ContactMeeting = null;
        prospect.ContactCall    = null;
        prospect.Task           = null;

        var currentSession = IoC.Resolve <ISessionContext>().UserSession;

        Session["Popup"] = "True";
        if (blnIsHost)
        {
            UpdateHostWithContacts(prospect, currentSession.UserId.ToString(), currentSession.CurrentOrganizationRole.OrganizationId.ToString(),
                                   currentSession.CurrentOrganizationRole.RoleId.ToString());
        }
        else
        {
            UpdateProspectWithContact(prospect, currentSession.UserId.ToString(), currentSession.CurrentOrganizationRole.OrganizationId.ToString(),
                                      currentSession.CurrentOrganizationRole.RoleId.ToString());
        }

        ClientScript.RegisterStartupScript(typeof(Page), "Edit Prospect Host", "<script language='javascript'  type='text/javascript' > CloseWindow(); </script>");
    }
Пример #8
0
    /// <summary>
    /// raise the Country dropdown index change event and Refill the
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    //protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    DropDownList ddlcountry = (DropDownList)sender;
    //    FillState(ddlcountry.ID);
    //}
    /// <summary>
    /// Change the city dropdown on change the state
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    //protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    DropDownList ddlstate = (DropDownList)sender;
    //    FillCity(ddlstate.ID);
    //}

    #endregion

    #region Methods

    /// <summary>
    /// this method save the MedicalVendor data to the database
    /// </summary>
    private void SaveMedicalVendor()
    {
        OtherDAL otherDal = new OtherDAL();
        EZip     objbuzip, objzip;

        objbuzip = otherDal.CheckCityZip(txtBuCity.Text, txtBZip.Text, ddlBState.SelectedValue);
        objzip   = otherDal.CheckCityZip(txtCity.Text, txtZip.Text, ddlState.SelectedValue);

        if (objbuzip.CityID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('City name entered for bussiness address is not valid.');", true);
            return;
        }
        else if (objbuzip.CityID > 0 && objbuzip.ZipID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('Zip Code entered for bussiness address, corresponding to its city name, is not valid.');", true);
            return;
        }

        if (objzip.CityID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "jscode", "alert('City name entered for contact address is not valid.');", true);
            return;
        }
        else if (objzip.CityID > 0 && objzip.ZipID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "jscode", "alert('Zip Code entered for contact address, corresponding to its city name, is not valid.');", true);
            return;
        }

        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        //MVUserService service = new MVUserService();
        EMedicalVendor MedicalVendor = new EMedicalVendor();

        EAddress address  = new EAddress();
        EAddress Baddress = new EAddress();
        EUser    user     = new EUser();
        /// fill the default data. Edited data will be overwrite

        var currentSession = IoC.Resolve <ISessionContext>().UserSession;

        MedicalVendor = OrganizationUser.GetMedicalVendor(currentSession);
        MedicalVendor.BusinessName  = txtVName.Text;
        MedicalVendor.BusinessFax   = objCommonCode.FormatPhoneNumber(txtBFax.Text);
        MedicalVendor.BusinessPhone = objCommonCode.FormatPhoneNumber(txtBPhone.Text);
        MedicalVendor.Description   = txtMVDesc.Text;

        Baddress.Address1  = txtBAddress1.Text;
        Baddress.Address2  = txtBAddress2.Text;
        Baddress.CityID    = objbuzip.CityID;
        Baddress.StateID   = Convert.ToInt32(ddlBState.SelectedValue);
        Baddress.CountryID = Convert.ToInt32(hfBusinessCountryID.Value);
        Baddress.ZipID     = objbuzip.ZipID;

        MedicalVendor.BusinessAddress = Baddress;

        address.Address1  = txtAddress1.Text;
        address.Address2  = txtAddress2.Text;
        address.CityID    = objzip.CityID;
        address.StateID   = Convert.ToInt32(ddlState.SelectedValue);
        address.CountryID = Convert.ToInt32(hfCountryID.Value);
        address.ZipID     = objzip.ZipID;


        MedicalVendor.MVUser.User.FirstName   = txtFName.Text;
        MedicalVendor.MVUser.User.MiddleName  = txtMName.Text;
        MedicalVendor.MVUser.User.LastName    = txtLName.Text;
        MedicalVendor.MVUser.User.PhoneHome   = objCommonCode.FormatPhoneNumber(txtPhoneHome.Text);
        MedicalVendor.MVUser.User.PhoneOffice = objCommonCode.FormatPhoneNumber(txtPhoneOther.Text);
        MedicalVendor.MVUser.User.PhoneCell   = objCommonCode.FormatPhoneNumber(txtPhoneCell.Text);
        MedicalVendor.MVUser.User.EMail1      = txtEmail.Text;
        MedicalVendor.MVUser.User.EMail2      = txtEmail2.Text;
        MedicalVendor.MVUser.User.HomeAddress = address;
        MedicalVendor.MVUser.User.SSN         = txtSSN.Text;
        MedicalVendor.MVUser.User.DOB         = Convert.ToDateTime(txtDOB.Text).ToString();
        Ucupdatephotopanel1.GetAllImages();
        MedicalVendor.MVUser.MyPicture   = Ucupdatephotopanel1.MyImage;
        MedicalVendor.MVUser.TeamPicture = Ucupdatephotopanel1.TeamImage;
        //MedicalVendor.MVUser.OtherPictures = Ucupdatephotopanel1.Images.ToArray();
        MedicalVendor.MVUser.OtherPictures = Ucupdatephotopanel1.Images;

        MedicalVendor.SpecialInstruction = txtSplInstruction.Text;
        MedicalVendor.AccountHolder      = txtAccountHolder.Text;
        MedicalVendor.AccountNumber      = txtAccountNo.Text;
        MedicalVendor.AccountType        = txtAccountType.Text;
        MedicalVendor.BankName           = txtBankName.Text;
        MedicalVendor.RountingNumber     = txtRoutingNumber.Text;
        MedicalVendor.Memo        = txtMemo.Text;
        MedicalVendor.PaymentMode = (int)(Falcon.App.Core.Enum.EPaymentType)Enum.Parse(typeof(Falcon.App.Core.Enum.EPaymentType), ddlPayMode.SelectedItem.Value);
        MedicalVendor.Interval    = (int)(PaymentFrequency)Enum.Parse(typeof(PaymentFrequency), ddlInterval.SelectedItem.Value);


        Int64 returnresult;



        if ((ViewState["IsEdit"] != null) && (ViewState["IsEdit"].ToString() != string.Empty))
        {
            MedicalVendorDAL medicalvendorDAL = new MedicalVendorDAL();
            returnresult = medicalvendorDAL.SaveMedicalVendor(MedicalVendor, Convert.ToInt32(EOperationMode.Update), currentSession.CurrentOrganizationRole.OrganizationId.ToString());
            if (returnresult == 0)
            {
                returnresult = 9999991;
            }

            Response.RedirectUser(ResolveUrl("~/App/MedicalVendor/ProfilePage.aspx"));
        }
    }
Пример #9
0
        private long SaveCustomer()
        {
            var commonCode = new CommonCode();

            if (CurrentCustomer == null)
            {
                CurrentCustomer = new Core.Users.Domain.Customer();
            }

            CurrentCustomer.Name = new Name
            {
                FirstName  = txtFName.Text,
                LastName   = txtLName.Text,
                MiddleName = txtMName.Text
            };

            CurrentCustomer.MobilePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Mobile,
                Number          = commonCode.FormatPhoneNumber(txtCPhone.Text)
            };
            CurrentCustomer.HomePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Home,
                Number          = commonCode.FormatPhoneNumber(txtHPhone.Text)
            };
            CurrentCustomer.OfficePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Office,
                Number          = commonCode.FormatPhoneNumber(txtOPhone.Text)
            };
            CurrentCustomer.PhoneOfficeExtension = PhoneOfficeExtension.Text;
            if (!string.IsNullOrEmpty(txtEmail.Text))
            {
                string[] emailSplitUp = txtEmail.Text.Split(new[] { '@' });

                CurrentCustomer.Email = new Email {
                    Address = emailSplitUp[0], DomainName = emailSplitUp[1]
                };
            }
            else
            {
                CurrentCustomer.Email = null;
            }

            if (!string.IsNullOrEmpty(txtDOB.Text))
            {
                CurrentCustomer.DateOfBirth = Convert.ToDateTime(txtDOB.Text);
            }

            if (CurrentCustomer.Address == null)
            {
                CurrentCustomer.Address = new Address();
            }
            else
            {
                CurrentCustomer.Address = new Address(CurrentCustomer.Address.Id);
            }
            CurrentCustomer.Address.StreetAddressLine1 = txtAddress1.Text;
            CurrentCustomer.Address.StreetAddressLine2 = txtAddress2.Text;
            CurrentCustomer.Address.ZipCode            = new ZipCode {
                Zip = txtZip.Text
            };
            CurrentCustomer.Address.Country = ddlCountry.SelectedItem.Text;
            CurrentCustomer.Address.State   = hfstate.Value;
            CurrentCustomer.Address.City    = txtCity.Text;

            if (CurrentCustomer.UserLogin == null)
            {
                CurrentCustomer.UserLogin = new UserLogin
                {
                    UserName     = txtUserName.Text,
                    Password     = txtPassword.Text,
                    HintQuestion = ddlQues1.SelectedItem.Text,
                    HintAnswer   = txtAnswer.Text,
                    IsSecurityQuestionVerified = false,
                    UserVerified = false
                }
            }
            ;
            else
            {
                CurrentCustomer.UserLogin.UserName = txtUserName.Text;
                if (!string.IsNullOrEmpty(txtPassword.Text))
                {
                    CurrentCustomer.UserLogin.Password = txtPassword.Text;
                    CurrentCustomer.UserLogin.Salt     = null;
                }
                CurrentCustomer.UserLogin.HintQuestion = string.IsNullOrEmpty(CurrentCustomer.UserLogin.HintQuestion) ? ddlQues1.SelectedItem.Text : CurrentCustomer.UserLogin.HintQuestion;
                CurrentCustomer.UserLogin.HintAnswer   = string.IsNullOrEmpty(CurrentCustomer.UserLogin.HintAnswer) ? txtAnswer.Text : CurrentCustomer.UserLogin.HintAnswer;
            }
            if (!string.IsNullOrEmpty(txtEmail2.Text))
            {
                string[] emailSplitUp = txtEmail2.Text.Split(new[] { '@' });

                CurrentCustomer.AlternateEmail = new Email {
                    Address = emailSplitUp[0], DomainName = emailSplitUp[1]
                };
            }
            else
            {
                CurrentCustomer.AlternateEmail = null;
            }

            if (rbtnGender.SelectedValue == Gender.Male.ToString() || rbtnGender.SelectedValue == Gender.Female.ToString())
            {
                CurrentCustomer.Gender = rbtnGender.SelectedValue == Gender.Male.ToString() ? Gender.Male : Gender.Female;
            }

            if (CustomerType == CustomerType.New)
            {
                CurrentCustomer.MarketingSource = Request.Form[MarketingSourceDropDown.UniqueID + "_hidden"] ?? string.Empty;
                CurrentCustomer.AddedByRoleId   = Convert.ToInt64(Roles.Technician);
            }
            else if (CustomerId <= 0)
            {
                CurrentCustomer.MarketingSource = Request.Form[MarketingSourceDropDown.UniqueID + "_hidden"] ?? string.Empty;
                CurrentCustomer.AddedByRoleId   = Convert.ToInt64(Roles.Technician);
            }

            RegistrationFlow.MarketingSource = Request.Form[MarketingSourceDropDown.UniqueID + "_hidden"] ?? string.Empty;

            if (Convert.ToInt64(ddlFeet.SelectedValue) > 0 || Convert.ToInt64(ddlInch.SelectedValue) > 0)
            {
                CurrentCustomer.Height = new Height(Convert.ToInt64(ddlFeet.SelectedValue),
                                                    Convert.ToInt64(ddlInch.SelectedValue));
            }
            double weight;

            if (txtweight.Text.Trim().Length > 0 && Double.TryParse(txtweight.Text.Trim(), out weight))
            {
                CurrentCustomer.Weight = new Weight(weight);
            }
            if (ddlrace.SelectedItem.Text != "Select Race")
            {
                CurrentCustomer.Race = (Race)Enum.Parse(typeof(Race), ddlrace.SelectedValue);
            }

            CurrentCustomer.InsuranceId = InsuranceIdTextbox.Text.Trim();

            var prefferedLanguage = PreferredLanguageDropDown.SelectedItem.Text;
            var currentSession    = IoC.Resolve <ISessionContext>().UserSession;

            if (!string.IsNullOrEmpty(prefferedLanguage))
            {
                var languageRepository = IoC.Resolve <ILanguageRepository>();

                var languageService = IoC.Resolve <ILanguageService>();
                var language        = languageRepository.GetByName(prefferedLanguage) ??
                                      languageService.AddLanguage(prefferedLanguage, currentSession.CurrentOrganizationRole.OrganizationRoleUserId);

                CurrentCustomer.LanguageId = language.Id;
            }
            else
            {
                CurrentCustomer.LanguageId = null;
            }
            CurrentCustomer.PreferredLanguage = PreferredLanguageDropDown.SelectedItem.Text;
            CurrentCustomer.BestTimeToCall    = Convert.ToInt64(BestTimeToCallDropdown.SelectedValue);

            CurrentCustomer.Ssn  = SsnTextbox.Text.Replace("-", "").Trim();
            CurrentCustomer.Hicn = MedicareIdTextbox.Text.Trim();
            CurrentCustomer.Mbi  = MBINumberTextbox.Text.Trim();

            CurrentCustomer.MedicareAdvantageNumber   = MedicareAdvantageNumber.Text.Trim();
            CurrentCustomer.MedicareAdvantagePlanName = MedicareAdvantagePlanName.Text.Trim();
            CurrentCustomer.EnableTexting             = rbtnEnableTexting.SelectedValue == "true";
            CurrentCustomer.EnableVoiceMail           = rbtnEnableVoiceMail.SelectedValue == "true";

            CurrentCustomer.EnableEmail = rbtnEnableEmail.SelectedValue == "true";

            CurrentCustomer.PreferredContactType = ddlPreferredContactType.SelectedIndex > 0 ? (long?)long.Parse(ddlPreferredContactType.SelectedValue) : null;

            CurrentCustomer.PhoneHomeConsentId   = long.Parse(ddlPatientConsentPrimary.SelectedValue);
            CurrentCustomer.PhoneCellConsentId   = long.Parse(ddlPatientConsentCell.SelectedValue);
            CurrentCustomer.PhoneOfficeConsentId = long.Parse(ddlPatientConsentOffice.SelectedValue);

            var customerService = IoC.Resolve <ICustomerService>();

            customerService.SaveCustomer(CurrentCustomer, currentSession.CurrentOrganizationRole.OrganizationRoleUserId);
            LogAudit(ModelType.Edit, CurrentCustomer, CustomerId);
            return(CurrentCustomer.CustomerId);
        }
Пример #10
0
        private void SetCustomerDataToControls()
        {
            if (CurrentCustomer != null)
            {
                customerLogEditModel.FirstName  = txtFName.Text = CurrentCustomer.Name.FirstName;
                customerLogEditModel.MiddleName = txtMName.Text = CurrentCustomer.Name.MiddleName;
                customerLogEditModel.LastName   = txtLName.Text = CurrentCustomer.Name.LastName;

                if (CurrentCustomer.Address != null)
                {
                    customerLogEditModel.AddressLine1 = txtAddress1.Text = CurrentCustomer.Address.StreetAddressLine1;
                    customerLogEditModel.AddressLine2 = txtAddress2.Text = CurrentCustomer.Address.StreetAddressLine2;
                    customerLogEditModel.Zip          = txtZip.Text = CurrentCustomer.Address.ZipCode.Zip;
                    customerLogEditModel.State        = hfstate.Value = CurrentCustomer.Address.State;
                    customerLogEditModel.City         = txtCity.Text = CurrentCustomer.Address.City;
                    ddlCountry.ClearSelection();
                    ddlCountry.SelectedValue     = CurrentCustomer.Address.CountryId.ToString();
                    customerLogEditModel.Country = ddlCountry.SelectedItem.Text;
                }

                var userLoginRepository = IoC.Resolve <IUserLoginRepository>();
                var userLogin           = userLoginRepository.GetByUserId(CurrentCustomer.Id);
                if (string.IsNullOrEmpty(userLogin.HintQuestion))
                {
                    pHintQues.Style.Add(HtmlTextWriterStyle.Display, "block");
                }
                else
                {
                    var item = ddlQues1.Items.FindByText(userLogin.HintQuestion);
                    if (item != null)
                    {
                        ddlQues1.ClearSelection();
                        item.Selected = true;
                        customerLogEditModel.HintQuestion = item.Text;
                    }
                }

                if (string.IsNullOrEmpty(userLogin.HintAnswer))
                {
                    pHintAns.Style.Add(HtmlTextWriterStyle.Display, "block");
                }
                else
                {
                    txtAnswer.Text = userLogin.HintAnswer;
                }

                customerLogEditModel.Username = txtUserName.Text = userLogin.UserName;
                //txtPassword.Attributes.Add("value", userLogin.Password);

                var commonCode = new CommonCode();

                customerLogEditModel.MobilePhoneNumber    = txtCPhone.Text = commonCode.FormatPhoneNumber(CurrentCustomer.MobilePhoneNumber.ToString());
                customerLogEditModel.HomePhoneNumber      = txtHPhone.Text = commonCode.FormatPhoneNumber(CurrentCustomer.HomePhoneNumber.ToString());
                customerLogEditModel.OfficePhoneNumber    = txtOPhone.Text = commonCode.FormatPhoneNumber(CurrentCustomer.OfficePhoneNumber.ToString());
                customerLogEditModel.OfficePhoneExtension = PhoneOfficeExtension.Text = CurrentCustomer.PhoneOfficeExtension;

                customerLogEditModel.Email          = txtEmail.Text = CurrentCustomer.Email.ToString();
                customerLogEditModel.EmailSecondary = txtEmail2.Text = CurrentCustomer.AlternateEmail.ToString();
                if (CurrentCustomer.DateOfBirth.HasValue)
                {
                    customerLogEditModel.DateOfBirth = txtDOB.Text = Convert.ToDateTime(CurrentCustomer.DateOfBirth).ToString("MM/dd/yyyy");
                }

                if (CurrentCustomer.Height != null)
                {
                    customerLogEditModel.Feet   = ddlFeet.SelectedValue = CurrentCustomer.Height.Feet.ToString();
                    customerLogEditModel.Inches = ddlInch.SelectedValue = CurrentCustomer.Height.Inches.ToString();
                }

                if (CurrentCustomer.Weight != null)
                {
                    customerLogEditModel.Weight = txtweight.Text = CurrentCustomer.Weight.Pounds.ToString();
                }



                switch (CurrentCustomer.Gender)
                {
                case Gender.Male:
                    rbtnGender.Items[0].Selected = true;
                    rbtnGender.Items[1].Selected = false;
                    customerLogEditModel.Gender  = "Male";
                    break;

                case Gender.Female:
                    rbtnGender.Items[1].Selected = true;
                    rbtnGender.Items[0].Selected = false;
                    customerLogEditModel.Gender  = "Female";
                    break;

                default:
                    rbtnGender.Items[0].Selected = false;
                    rbtnGender.Items[1].Selected = false;
                    break;
                }

                txtUserName.ReadOnly      = true;
                customerLogEditModel.Race = CurrentCustomer.Race;
                ListItem selectedRace = ddlrace.Items.FindByText(CurrentCustomer.Race.ToString());
                if (selectedRace != null)
                {
                    selectedRace.Selected = true;
                }

                if (CurrentCustomer.CustomerId > 0 && !CurrentCustomer.EnableTexting)
                {
                    rbtnEnableTexting.Items[1].Selected = true;
                    customerLogEditModel.EnableTexting  = "false";
                }
                else if (CurrentCustomer.EnableTexting)
                {
                    rbtnEnableTexting.Items[0].Selected = true;
                    customerLogEditModel.EnableTexting  = "true";
                }
                if (CurrentCustomer.CustomerId > 0 && !CurrentCustomer.EnableVoiceMail)
                {
                    rbtnEnableVoiceMail.Items[1].Selected = true;
                    customerLogEditModel.EnableVoiceMail  = "false";
                }
                else if (CurrentCustomer.EnableVoiceMail)
                {
                    rbtnEnableVoiceMail.Items[0].Selected = true;
                    customerLogEditModel.EnableVoiceMail  = "true";
                }

                if (CurrentCustomer.CustomerId > 0 && CurrentCustomer.EnableEmail)
                {
                    rbtnEnableEmail.Items[0].Selected = true;
                    customerLogEditModel.EnableEmail  = true;
                }
                else
                {
                    rbtnEnableEmail.Items[1].Selected = true;
                    customerLogEditModel.EnableEmail  = false;
                }

                customerLogEditModel.InsuranceId = InsuranceIdTextbox.Text = CurrentCustomer.InsuranceId.Trim();

                if (CurrentCustomer.LanguageId.HasValue)
                {
                    var languageRepository = IoC.Resolve <ILanguageRepository>();
                    var language           = languageRepository.GetById(CurrentCustomer.LanguageId.Value);

                    if (language != null)
                    {
                        //    customerLogEditModel.LanguageName = PreferredLanguageTextbox.Text = language.Name;
                        customerLogEditModel.LanguageName       = language.Name;
                        PreferredLanguageDropDown.SelectedValue = language.Id.ToString();
                    }
                }
                PreferredLanguageDropDown.SelectedValue = CurrentCustomer.LanguageId.ToString();
                if (CurrentCustomer.BestTimeToCall.HasValue && CurrentCustomer.BestTimeToCall.Value > 0)
                {
                    customerLogEditModel.BestTimeToCall = BestTimeToCallDropdown.SelectedValue = CurrentCustomer.BestTimeToCall.Value.ToString();
                }

                SsnTextbox.Text = CurrentCustomer.Ssn.Trim();
                customerLogEditModel.MedicareId = MedicareIdTextbox.Text = CurrentCustomer.Hicn.Trim();
                customerLogEditModel.MBINumber  = MBINumberTextbox.Text = CurrentCustomer.Mbi.Trim();
                customerLogEditModel.MedicareAdvantageNumber   = MedicareAdvantageNumber.Text = CurrentCustomer.MedicareAdvantageNumber.Trim();
                customerLogEditModel.MedicareAdvantagePlanName = MedicareAdvantagePlanName.Text = CurrentCustomer.MedicareAdvantagePlanName.Trim();
                if (CurrentCustomer.PreferredContactType.HasValue && CurrentCustomer.PreferredContactType.Value > 0)
                {
                    ddlPreferredContactType.SelectedValue = CurrentCustomer.PreferredContactType.Value.ToString();
                }

                if (CurrentCustomer.PhoneHomeConsentId > 0)
                {
                    ddlPatientConsentPrimary.SelectedValue = CurrentCustomer.PhoneHomeConsentId.ToString();
                }
                if (CurrentCustomer.PhoneCellConsentId > 0)
                {
                    ddlPatientConsentCell.SelectedValue = CurrentCustomer.PhoneCellConsentId.ToString();
                }
                if (CurrentCustomer.PhoneOfficeConsentId > 0)
                {
                    ddlPatientConsentOffice.SelectedValue = CurrentCustomer.PhoneOfficeConsentId.ToString();
                }
            }
        }
Пример #11
0
        public void SaveFacility()
        {
            var otherDal = new OtherDAL();

            // format phone no.
            CommonCode objCommonCode = new CommonCode();

            EZip checkCityZip = otherDal.CheckCityZip(txtCity.Text, txtZip.Text, ddlState.SelectedValue);

            if (checkCityZip.CityID == 0)
            {
                divErrorMsg.InnerText = "City name entered for address is not valid.";
                divErrorMsg.Style.Add(HtmlTextWriterStyle.Display, "block");
                return;
            }
            else if (checkCityZip.CityID > 0 && checkCityZip.ZipID == 0)
            {
                divErrorMsg.InnerText = "Zipcode entered for address, corresponding to its city name, is not valid.";
                divErrorMsg.Style.Add(HtmlTextWriterStyle.Display, "block");
                return;
            }


            EHospitalFacility objEHospitalFacility = new EHospitalFacility();

            objEHospitalFacility.Address = new EAddress();


            Int64  userid         = IoC.Resolve <ISessionContext>().UserSession.UserId;
            string strCampaignIds = string.Empty;

            objEHospitalFacility.FacilityName = txtFacilityName.Text;
            if (ddlMedicalVendor.SelectedIndex > -1)
            {
                objEHospitalFacility.HospitalPartnerId = Convert.ToInt64(ddlMedicalVendor.SelectedValue);
            }
            if (ViewState["AddressID"] != null)
            {
                objEHospitalFacility.Address.AddressID = Convert.ToInt32(ViewState["AddressID"]);
            }

            objEHospitalFacility.Address.Address1    = txtAddress1.Text;
            objEHospitalFacility.Address.Address2    = txtAddress2.Text;
            objEHospitalFacility.Address.PhoneNumber = objCommonCode.FormatPhoneNumber(txtPhonePrimary.Text);
            objEHospitalFacility.PhoneCell           = objCommonCode.FormatPhoneNumber(txtPhoneCell.Text);
            objEHospitalFacility.Address.CityID      = checkCityZip.CityID;
            if (ddlState.SelectedIndex > -1)
            {
                objEHospitalFacility.Address.StateID = Convert.ToInt32(ddlState.SelectedValue);
            }
            if (!string.IsNullOrEmpty(hfCountryID.Value))
            {
                objEHospitalFacility.Address.CountryID = Convert.ToInt32(hfCountryID.Value);
            }

            objEHospitalFacility.Address.ZipID = checkCityZip.ZipID;
            objEHospitalFacility.Email         = txtEmail.Text;
            if (!string.IsNullOrEmpty(Request["FacilityID"]))
            {
                objEHospitalFacility.HospitalFacilityID = Convert.ToInt64(Request["FacilityID"]);
            }
            // Assign Campaigns
            if (!string.IsNullOrEmpty(hidCampaignID.Value))
            {
                strCampaignIds = hidCampaignID.Value;
                strCampaignIds = strCampaignIds.Replace(",,", ",");
            }

            if (objEHospitalFacility.HospitalFacilityID > 0)
            {
                UpdateHospitalFacilty(objEHospitalFacility, userid, strCampaignIds);
            }
            else
            {
                SaveHospitalFacilty(objEHospitalFacility, userid, strCampaignIds);
            }

            // Redirect To Page
            if (ViewState["ReferredUrl"] != null && (string)ViewState["ReferredUrl"] != "")
            {
                Response.RedirectUser(this.ResolveUrl(ViewState["ReferredUrl"].ToString()));
            }
            else
            {
                // Manage Hospital Facility
                Response.RedirectUser(this.ResolveUrl("App/Franchisor/HospitalPartner/ManageHospitalPartnerFacility.aspx"));
            }
        }
Пример #12
0
    private void SaveContact()
    {
        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        //FranchisorService service = new FranchisorService();
        EContact objContact = new EContact();

        //objContact.Address = new HealthYes.Web.UI.FranchisorService.EAddress();
        objContact.Address = new EAddress();

        //Now Address is not saved in TblAddress

        if (ViewState["ContactID"] != null)
        {
            objContact.ContactID = Convert.ToInt32(ViewState["ContactID"].ToString());
        }
        //Now Address is saved in TblContact only. No link with TblAddress
        objContact.Address.Address1 = txtAddress.Text;
        objContact.Address.City     = txtCity.Text;
        objContact.Address.Country  = "US";
        objContact.Address.State    = ddlState.SelectedIndex > 0 ? ddlState.SelectedItem.Text : "";
        objContact.Address.Zip      = txtZip.Text;

        objContact.EMail            = txtEMail.Text;
        objContact.FirstName        = txtFName.Text;
        objContact.MiddleName       = txtMName.Text;
        objContact.LastName         = txtLName.Text;
        objContact.OrganizationName = txtOrganisation.Text;
        objContact.WebSite          = txtWebsite.Text;
        objContact.PhoneCell        = objCommonCode.FormatPhoneNumber(txtPhoneCell.Text);
        objContact.PhoneHome        = objCommonCode.FormatPhoneNumber(txtPhoneHome.Text);
        objContact.PhoneOffice      = objCommonCode.FormatPhoneNumber(txtPhoneOffice.Text);
        objContact.Phone1Extension  = txtExt.Text;
        objContact.Gender           = rbtMale.Checked;
        objContact.DateOfBirth      = txtBday.Text;
        objContact.DesignationTitle = txtJobtitle.Text;
        objContact.EmailWork        = txtEmailOffice.Text;

        objContact.ContactType = Convert.ToInt32(ddlContactType.SelectedValue);
        objContact.Fax         = objCommonCode.FormatPhoneNumber(txtFax.Text);
        objContact.Note        = txtNotes.Text.Length > 0 ? txtNotes.Text : "";
        objContact.Title       = txtTitle.Text;

        int prospectid = 0;

        prospectid = this.ExtractProspectID();

        if (prospectid > 0)
        {
            objContact.ArrayProspectIDs    = new long[1];
            objContact.ArrayProspectIDs[0] = prospectid;

            int arraylength = 0;
            for (int icount = 0; icount < chklistContactRole.Items.Count; icount++)
            {
                if (chklistContactRole.Items[icount].Selected)
                {
                    arraylength++;
                }
            }
            if (arraylength > 0)
            {
                //int jcount = 0;
                //objContact.ListProspectContactRole = new EProspectContactRole[arraylength];
                objContact.ListProspectContactRole = new List <EProspectContactRole>();
                for (int icount = 0; icount < chklistContactRole.Items.Count; icount++)
                {
                    if (chklistContactRole.Items[icount].Selected)
                    {
                        objContact.ListProspectContactRole.Add(new EProspectContactRole()
                        {
                            ProspectContactRoleID =
                                Convert.ToInt16(
                                    chklistContactRole.Items[icount].Value),
                            ProspectID = prospectid
                        });


                        //objContact.ListProspectContactRole[jcount] = new EProspectContactRole();
                        //objContact.ListProspectContactRole[jcount].ProspectContactRoleID = Convert.ToInt16(chklistContactRole.Items[icount].Value);
                        //objContact.ListProspectContactRole[jcount].ProspectID = prospectid;
                        //jcount++;
                    }
                }
            }
        }

        var currentsession = IoC.Resolve <ISessionContext>().UserSession;

        long tempResult;

        //bool tempResult1;

        if (ViewState["ContactID"] != null)
        {
            if (prospectid > 0)
            {
                //service.UpdateContactDetail(objContact, usershellmodulerole1, out tempResult, out tempResult1);
                tempResult = UpdateContactDetail(objContact, currentsession.UserId.ToString(), currentsession.CurrentOrganizationRole.OrganizationId.ToString(),
                                                 currentsession.CurrentOrganizationRole.RoleId.ToString());
            }
            else
            {
                FranchisorDAL franchisorDAL = new FranchisorDAL();
                tempResult = franchisorDAL.SaveContact(objContact, Convert.ToInt32(EOperationMode.Update),
                                                       Convert.ToInt32(currentsession.UserId.ToString()));
                //service.UpdateContact(objContact, usershellmodulerole1, out tempResult, out tempResult1);
            }
        }
        else
        {
            if (prospectid > 0)
            {
                //service.SaveProspectContact(objContact, usershellmodulerole1, out tempResult, out tempResult1);
                tempResult = SaveProspectContact(objContact, currentsession.UserId.ToString(), currentsession.CurrentOrganizationRole.OrganizationId.ToString(),
                                                 currentsession.CurrentOrganizationRole.RoleId.ToString());
            }
            else
            {
                FranchisorDAL franchisorDAL = new FranchisorDAL();
                tempResult = franchisorDAL.SaveContact(objContact, Convert.ToInt32(EOperationMode.Insert),
                                                       Convert.ToInt32(currentsession.UserId.ToString()));
                //service.SaveContact(objContact, usershellmodulerole1, out tempResult, out tempResult1);
            }
        }
        // Assign prospect to salesrep
        if (prospectid > 0)
        {
            if (currentsession.CurrentOrganizationRole.CheckRole((long)Roles.SalesRep))
            {
                Int64 iProspectId = prospectid;

                FranchisorDAL franchisorDAL = new FranchisorDAL();
                franchisorDAL.AssignProspect(1, iProspectId, Convert.ToInt64(currentsession.UserId));

                //service.AssignProspect(iProspectId, true, Convert.ToInt64(usershellmodulerole1.UserID), true);
            }
        }
        if (ViewState["ReferedURL"].ToString().ToLower().IndexOf("/createeventwizard/step1.aspx") >= 0)
        {
            string strUpdateProspectHost = "/App/Common/CreateEventWizard/Step1.aspx";
            if (Request.QueryString["EventId"] != null)
            {
                strUpdateProspectHost = strUpdateProspectHost + "?EventId=" + Request.QueryString["EventId"];
            }
            if (Request.QueryString["Type"] != null)
            {
                if (strUpdateProspectHost.IndexOf("?") >= 0)
                {
                    strUpdateProspectHost = strUpdateProspectHost + "&HostID=" + ViewState["ProspectID"] + "&Type=Selected";
                }
                else
                {
                    strUpdateProspectHost = strUpdateProspectHost + "?HostID=" + ViewState["ProspectID"] + "&Type=Selected";
                }
            }
            Response.RedirectUser(strUpdateProspectHost);
        }
        else
        {
            Response.RedirectUser(ViewState["ReferedURL"].ToString());
        }
        //Response.RedirectUser(ViewState["ReferedURL"].ToString());
    }
Пример #13
0
        private bool UpdateCustomerInfo()
        {
            long                customerId           = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
            dynamic             displayCustomerModel = new ExpandoObject();
            ICustomerRepository customerRepository   = new CustomerRepository();

            displayCustomerModel.CustomerId = customerId;

            if (!customerRepository.UniqueEmail(customerId, _txtEmail.Text))
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "jscode_UniqueEmail", "alert('This email address is already registered! Please use different email address.');", true);
                return(false);
            }


            var address = new Address(_txtAddress.Text, _txtSuit.Text, _txtCity.Text, hfstate.Value,
                                      _txtZip.Text, ddlCountry.SelectedItem.Text);
            var customer = customerRepository.GetCustomer(customerId);

            customer.Name = new Name
            {
                FirstName  = _txtFirstName.Text,
                MiddleName = _txtMiddleName.Text,
                LastName   = _txtLastName.Text
            };
            displayCustomerModel.Name = customer.Name;
            address.Id = customer.Address.Id;
            displayCustomerModel.Address = customer.Address = address;

            var commonCode = new CommonCode();

            customer.HomePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Home,
                Number          = commonCode.FormatPhoneNumber(_txtPhoneHome.Text)
            };
            displayCustomerModel.HomePhone = _txtPhoneHome.Text;
            customer.OfficePhoneNumber     = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Office,
                Number          = commonCode.FormatPhoneNumber(_txtPhoneOffice.Text)
            };
            displayCustomerModel.PhoneOffice          = _txtPhoneOffice.Text;
            customer.PhoneOfficeExtension             = PhoneOfficeExtension.Text;
            displayCustomerModel.PhoneOfficeExtension = PhoneOfficeExtension.Text;

            customer.MobilePhoneNumber = new PhoneNumber
            {
                PhoneNumberType = PhoneNumberType.Mobile,
                Number          = commonCode.FormatPhoneNumber(_txtPhoneCell.Text)
            };
            displayCustomerModel.MobilePhoneNumber = _txtPhoneCell.Text;
            displayCustomerModel.Email             = _txtEmail.Text;
            string[] emailSplitUp = _txtEmail.Text.Split(new[] { '@' });
            customer.Email = new Email {
                Address = emailSplitUp[0], DomainName = emailSplitUp[1]
            };

            displayCustomerModel.Feet = _ddlFeet.SelectedValue;
            displayCustomerModel.Inch = _ddlInch.SelectedValue;

            customer.Height           = new Height(Convert.ToInt64(_ddlFeet.SelectedValue), Convert.ToInt64(_ddlInch.SelectedValue));
            customer.Race             = (Race)Enum.Parse(typeof(Race), _ddlRace.SelectedValue);
            displayCustomerModel.Race = _ddlRace.SelectedValue;

            if (_txtDateOfBrith.Text.Trim().Length > 0)
            {
                displayCustomerModel.DateOfBirth = customer.DateOfBirth = Convert.ToDateTime(_txtDateOfBrith.Text);
            }

            double weight;

            if (_txtWeight.Text.Trim().Length > 0 && Double.TryParse(_txtWeight.Text.Trim(), out weight))
            {
                customer.Weight             = new Weight(weight);
                displayCustomerModel.Weight = weight;
            }
            else
            {
                customer.Weight = null;
            }

            customer.EnableTexting               = rbtnEnableTexting.Checked;
            customer.EnableVoiceMail             = rbtnEnableVoiceMail.Checked;
            displayCustomerModel.EnableVoiceMail = customer.EnableVoiceMail;
            displayCustomerModel.EnableTexting   = customer.EnableTexting;
            decimal waist;

            if (_txtWaist.Text.Trim().Length > 0 && decimal.TryParse(_txtWaist.Text.Trim(), out waist))
            {
                customer.Waist             = waist;
                displayCustomerModel.Waist = waist;
            }
            else
            {
                customer.Waist = null;
            }

            if (_ddlGender.SelectedItem.Text == Gender.Male.ToString())
            {
                customer.Gender = Gender.Male;
            }
            else if (_ddlGender.SelectedItem.Text == Gender.Female.ToString())
            {
                customer.Gender = Gender.Female;
            }
            else
            {
                customer.Gender = Gender.Unspecified;
            }
            displayCustomerModel.Gender = customer.Gender.GetDescription();

            displayCustomerModel.Ssn = customer.Ssn = _txtSsnNumber.Text.Replace("-", "").Trim();

            var customerService = IoC.Resolve <ICustomerService>();

            try
            {
                customerService.SaveCustomer(customer, customerId);
                if (IsUpdateProfile)
                {
                    var loginSettingRepository = IoC.Resolve <ILoginSettingRepository>();

                    var loginSettings = loginSettingRepository.Get(customer.UserLogin.Id);
                    if (loginSettings != null && (IsPinRequiredForRole || ((IsOtpByAppEnabled || IsOtpByEmailEnabled || IsOtpBySmsEnabled) && IsAuthenticationForUserEnabled)))
                    {
                        if (IsPinRequiredForRole)
                        {
                            loginSettings.DownloadFilePin = IsPinRequiredForRole ? (string.IsNullOrEmpty(txtDownloadFilePin.Value) ? loginSettings.DownloadFilePin : txtDownloadFilePin.Value) : null;
                        }

                        if ((IsOtpByAppEnabled || IsOtpByEmailEnabled || IsOtpBySmsEnabled) && IsAuthenticationForUserEnabled)
                        {
                            if (useApp.Checked)
                            {
                                loginSettings.AuthenticationModeId         = (long)AuthenticationMode.AuthenticatorApp;
                                loginSettings.GoogleAuthenticatorSecretKey = (string)Session["EncodedSecret"];
                            }
                            else
                            {
                                loginSettings.GoogleAuthenticatorSecretKey = null;
                                loginSettings.AuthenticationModeId         = UseEmail.Checked && UseSms.Checked ? (long)AuthenticationMode.BothSmsEmail : (UseSms.Checked ? (long)AuthenticationMode.Sms : (long)AuthenticationMode.Email);
                            }
                            Session["EncodedSecret"] = null;
                        }

                        loginSettingRepository.Save(loginSettings);
                    }
                }

                LogAudit(ModelType.Edit, displayCustomerModel, customerId);
            }
            catch (InvalidAddressException ex)
            {
                ClientScript.RegisterStartupScript(typeof(string), "jscodecityvalidate", "alert('" + ex.Message + "');", true);
                return(false);
            }
            if (!IsUpdateProfile)
            {
                CustomerId = customer.CustomerId;

                RegistrationFlow.MarketingSource = Request.Form[MarketingSourceDropDown.UniqueID + "_hidden"] ?? string.Empty;
            }
            return(true);
        }
Пример #14
0
    /// <summary>
    /// this method save the franchisor data to the database
    /// </summary>
    private void SaveFranchisor()
    {
        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        OtherDAL otherDal = new OtherDAL();
        EZip     objczip  = otherDal.CheckCityZip(txtCity.Text, txtzip1.Text, ddlstate.SelectedValue);

        if (objczip.CityID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('City name entered for contact address is not valid.');", true);
            return;
        }
        else if (objczip.CityID > 0 && objczip.ZipID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('Zip Code entered for contact address, corresponding to its city name, is not valid.');", true);
            return;
        }

        EFranchisorFranchisorUser franchisorfranchisoruser = new EFranchisorFranchisorUser();
        EFranchisorUser           franchisoruser           = new EFranchisorUser();
        EFranchisor franchisor = new EFranchisor();


        franchisor.Active = true;
        //HealthYes.Web.UI.FranchisorFranchisorUserService.EAddress address = new HealthYes.Web.UI.FranchisorFranchisorUserService.EAddress();
        var address = new Falcon.Entity.Other.EAddress();

        address.Address1  = txtaddress1.Text;
        address.Address2  = string.Empty;
        address.CityID    = objczip.CityID;
        address.StateID   = Convert.ToInt32(ddlstate.SelectedValue);
        address.CountryID = Convert.ToInt32(hfCountryID.Value);
        address.ZipID     = objczip.ZipID;

        //HealthYes.Web.UI.FranchisorFranchisorUserService.EUser user = new HealthYes.Web.UI.FranchisorFranchisorUserService.EUser();
        var user = new Falcon.Entity.Other.EUser();

        user.FirstName   = txtfname.Text;
        user.MiddleName  = txtMiddleName.Text.Length == 0 ? "" : txtMiddleName.Text;
        user.LastName    = txtlname.Text;
        user.SSN         = txtSSN.Text.Length == 0 ? "" : txtSSN.Text;
        user.DOB         = Convert.ToDateTime(txtDOB.Text).ToString();
        user.PhoneHome   = txtphonehome.Text.Length == 0 ? "" : objCommonCode.FormatPhoneNumber(txtphonehome.Text);
        user.PhoneOffice = txtphoneother.Text.Length == 0 ? "" : objCommonCode.FormatPhoneNumber(txtphoneother.Text);
        user.PhoneCell   = txtphonecell.Text.Length == 0 ? "" : objCommonCode.FormatPhoneNumber(txtphonecell.Text);
        user.EMail1      = txtEmail1.Text;
        user.EMail2      = txtEmail2.Text.Length == 0 ? "" : txtEmail2.Text;
        user.HomeAddress = address;

        Ucupdatephotopanel1.GetAllImages();
        franchisoruser.OtherPictures = Ucupdatephotopanel1.Images;
        //franchisoruser.OtherPictures = Ucupdatephotopanel1.Images.ToArray();
        franchisoruser.TeamPicture              = Ucupdatephotopanel1.TeamImage;
        franchisoruser.MyPicture                = Ucupdatephotopanel1.MyImage;
        franchisoruser.User                     = user;
        franchisorfranchisoruser.Franchisor     = franchisor;
        franchisorfranchisoruser.FranchisorUser = franchisoruser;

        var sessionContext = IoC.Resolve <ISessionContext>();

        if (ViewState["FranchisorFranchisorUserID"] != null && ViewState["Email"].ToString().Equals(txtEmail1.Text.Trim()))
        {
            if (ViewState["FranchisorFranchisorUserID"].ToString() != string.Empty)
            {
                FranchisorDAL franchisorDal = new FranchisorDAL();
                var           listFranchisorFranchisorUser =
                    franchisorDal.GetFranchisorFranchisorUser(ViewState["FranchisorFranchisorUserID"].ToString(), 1);
                EFranchisorFranchisorUser[] FFUser = null;

                if (listFranchisorFranchisorUser != null)
                {
                    FFUser = listFranchisorFranchisorUser.ToArray();
                }

                if (FFUser != null)
                {
                    franchisorfranchisoruser.FranchisorUser.User.UserID = Convert.ToInt32(ViewState["UserID"].ToString());

                    franchisorDal.SaveFranchisorFranchisorUser(franchisorfranchisoruser,
                                                               Convert.ToInt32(EOperationMode.Update), sessionContext.UserSession.CurrentOrganizationRole.OrganizationId);

                    Response.RedirectUser(ResolveUrl("~/App/Franchisor/FranchisorAdminUser.aspx?Action=Edited"));
                }
            }
        }
        else
        {
            IUserRepository <User> userRepository = IoC.Resolve <IUserRepository <User> >();
            if (userRepository.UserNameExists(txtEmail1.Text))
            {
                divErrorMsg.Visible   = true;
                divErrorMsg.InnerHtml = "Contact email already exists. Please try another email.";
                return;
            }
            if (ViewState["FranchisorFranchisorUserID"] != null)
            {
                if (ViewState["FranchisorFranchisorUserID"].ToString() != string.Empty)
                {
                    FranchisorDAL franchisorDal = new FranchisorDAL();
                    var           listFranchisorFranchisorUser =
                        franchisorDal.GetFranchisorFranchisorUser(
                            ViewState["FranchisorFranchisorUserID"].ToString(), 1);
                    EFranchisorFranchisorUser[] FFUser = null;

                    if (listFranchisorFranchisorUser != null)
                    {
                        FFUser = listFranchisorFranchisorUser.ToArray();
                    }

                    if (FFUser != null)
                    {
                        franchisorfranchisoruser.FranchisorUser.User.UserID =
                            Convert.ToInt32(ViewState["UserID"].ToString());
                        franchisorDal.SaveFranchisorFranchisorUser(franchisorfranchisoruser,
                                                                   Convert.ToInt32(EOperationMode.Update), sessionContext.UserSession.CurrentOrganizationRole.OrganizationId);

                        Response.RedirectUser(ResolveUrl("~/App/Franchisor/FranchisorAdminUser.aspx?Action=Edited"));
                    }
                }
            }
            else
            {
                //service.AddFranchisorFranchisorUser(franchisorfranchisoruser, usershellmodulerole1, out returnresult, out temp);

                FranchisorDAL franchisorDal = new FranchisorDAL();
                franchisorDal.SaveFranchisorFranchisorUser(franchisorfranchisoruser,
                                                           Convert.ToInt32(EOperationMode.Insert), sessionContext.UserSession.CurrentOrganizationRole.OrganizationId);

                Response.RedirectUser(ResolveUrl("~/App/Franchisor/FranchisorAdminUser.aspx?Action=Added"));
            }
        }
    }
    private void SaveMedicalVendor()
    {
        OtherDAL otherDal = new OtherDAL();
        EZip objczip;

        // format phone no.
        CommonCode objCommonCode = new CommonCode();

        objczip = otherDal.CheckCityZip(txtCity.Text, txtZip.Text, ddlState.SelectedValue);

        if (objczip.CityID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('City name entered for contact address is not valid.');", true);
            return;
        }
        else if (objczip.CityID > 0 && objczip.ZipID == 0)
        {
            ClientScript.RegisterStartupScript(typeof(string), "bujscode", "alert('Zip Code entered for contact address, corresponding to its city name, is not valid.');", true);
            return;
        }

        EMVMVUser emvmvUser = new EMVMVUser();
        EMedicalVendor medicalVendor = new EMedicalVendor();

        if (ViewState["AuditRequired"] != null)
            emvmvUser.AuditRequired = Convert.ToBoolean(ViewState["AuditRequired"]);

        medicalVendor.BusinessName = ddlVendorName.SelectedItem.Text;
        if (ViewState["MedicalVendorID"] != null)
        {
            medicalVendor.MedicalVendorID = Convert.ToInt32(ViewState["MedicalVendorID"].ToString());
        }
        else
            medicalVendor.MedicalVendorID = Convert.ToInt32(ddlVendorName.SelectedValue);
        EAddress address = new EAddress();
        address.Address1 = txtAddress1.Text;
        address.Address2 = txtAddress2.Text;
        address.CityID = objczip.CityID;
        address.StateID = Convert.ToInt32(ddlState.SelectedValue);
        address.CountryID = Convert.ToInt32(hfCountryID.Value);
        address.ZipID = objczip.ZipID;

        EUser user = new EUser();
        if (ViewState["UserID"] != null)
        {
            user.UserID = Convert.ToInt32(ViewState["UserID"].ToString());
        }
        user.FirstName = txtFirstName.Text;
        user.MiddleName = txtMiddleName.Text;
        user.LastName = txtLastName.Text;
        user.PhoneCell = objCommonCode.FormatPhoneNumber(txtPhoneC.Text);
        user.PhoneHome = objCommonCode.FormatPhoneNumber(txtPhoneH.Text);
        user.PhoneOffice = objCommonCode.FormatPhoneNumber(txtPhoneO.Text);
        user.DOB = txtDOB.Text;
        user.SSN = txtSSN.Text;
        user.EMail1 = txtEmail1.Text;
        user.EMail2 = txtEmail2.Text;

        user.HomeAddress = address;

        var reference = new EReferences[3];
        reference[0] = new EReferences { Name = string.Empty, EMail = string.Empty };
        reference[1] = new EReferences { Name = string.Empty, EMail = string.Empty };
        reference[2] = new EReferences { Name = string.Empty, EMail = string.Empty };

        EMVUserSpecialization userSpecialization = new EMVUserSpecialization();
        userSpecialization.MVUserSpecilaizationID = Convert.ToInt32(ddlSpecialization.SelectedValue);

        EMVUserClassification emvUserClassification = new EMVUserClassification();
        emvUserClassification.MVUserClassificationID = Convert.ToInt32(ViewState["ClassificationID"]);


        EMVUser emvUser = new EMVUser();
        Ucupdatephotopanel1.GetAllImages();
        emvUser.OtherPictures = Ucupdatephotopanel1.Images;
        emvUser.MyPicture = Ucupdatephotopanel1.MyImage;


        if (ViewState["MVUserID"] != null)
        {
            emvUser.MVUserID = Convert.ToInt32(ViewState["MVUserID"].ToString());
        }
        emvUser.User = user;
        emvUser.References = reference.ToList();
        emvUser.MVUserSpecialization = userSpecialization;
        emvUser.MVUserClassification = emvUserClassification;
        emvUser.Address = address;
        //// For Resume
        string resumePath = ViewState["Resume"].ToString();
        string signPath = ViewState["Signature"].ToString();
        if ((hfResume.Value == "1") && fileResume.HasFile)
        {
            string filePath = Request.MapPath(ConfigurationManager.AppSettings["MVUploadResume"].ToString());
            resumePath = ConfigurationManager.AppSettings["MVUploadResume"].ToString();
            var fileInfo = new FileInfo(fileResume.FileName);
            if (!(fileInfo.Extension.Equals(".doc") || fileInfo.Extension.Equals(".docx") || fileInfo.Extension.Equals(".rtf") || fileInfo.Extension.Equals(".txt")))
            {
                divErrorMsg.Visible = true;
                divErrorMsg.InnerHtml = "Invalid file format. It should be either of type doc, docx, rtf or txt";
                return;
            }
            else
            {
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                string saveFileName = fileResume.FileName + DateTime.Now.ToFileTimeUtc() + fileInfo.Extension;
                if (fileResume.HasFile)
                {
                    fileResume.SaveAs(filePath + "\\" + saveFileName);
                }
                resumePath = resumePath + "/" + saveFileName;
            }
        }
        emvUser.Resume = resumePath;
        ////////////////////////signature//////////////////////////////////
        if ((hfSignature.Value == "1") && (fileSignature.FileName.Trim() != ""))
        {
            if (fileSignature.HasFile)
            {
                string signFilePath = Request.MapPath(ConfigurationManager.AppSettings["MVUploadSignature"].ToString());
                signPath = ConfigurationManager.AppSettings["MVUploadSignature"].ToString();

                var fileInfo = new FileInfo(fileSignature.FileName);
                if (!(fileInfo.Extension.ToLower().Equals(".jpeg") || fileInfo.Extension.ToLower().Equals(".jpg")))
                {
                    divErrorMsg.Visible = true;
                    divErrorMsg.InnerHtml = "Please Check the file extension.It should be either of type jpg or jpeg";
                    return;
                }
                else
                {
                    if (!Directory.Exists(signFilePath))
                    {
                        Directory.CreateDirectory(signFilePath);
                    }
                    string saveFileName = fileSignature.FileName.Substring(0, fileSignature.FileName.IndexOf(".")) + DateTime.Now.ToFileTimeUtc() + fileInfo.Extension;
                    if (fileSignature.HasFile)
                    {
                        fileSignature.PostedFile.SaveAs(signFilePath + "\\" + saveFileName);
                    }
                    signPath = signPath + "/" + saveFileName;
                }
            }
        }

        emvUser.DigitalSignature = signPath;
        emvmvUser.MedicalVendor = medicalVendor;

        if (ViewState["IsAuthorizationAllowed"] != null)
            emvmvUser.IsAuthorizationsAllowed = Convert.ToBoolean(ViewState["IsAuthorizationAllowed"]);

        if (ViewState["CutoffDate"] != null)
            emvmvUser.CutOffDate = ViewState["CutoffDate"].ToString();
        if (ViewState["ShowEarningAmount"] != null)
            emvmvUser.ShowEarningAmount = Convert.ToBoolean(ViewState["ShowEarningAmount"]);

        emvmvUser.MVUser = emvUser;

        Int64 returnresult;

        var eUserShellModuleRole = new EUserShellModuleRole
                                                        {
                                                            RoleID = "1",
                                                            ShellID = "1",
                                                            UserID = "1"
                                                        };

        var medicalvendorDal = new MedicalVendorDAL();
        returnresult = medicalvendorDal.SaveMedicalVendorUserProfile(emvmvUser, Convert.ToInt32(EOperationMode.Update), eUserShellModuleRole.UserID, Convert.ToInt64(eUserShellModuleRole.ShellID), eUserShellModuleRole.RoleID);

        if (txtPassword.Text.Length > 0)
        {
            var userLoginService = IoC.Resolve<IUserLoginService>();
            var userContext = IoC.Resolve<SessionContext>();
            userLoginService.ResetPassword(Convert.ToInt32(userContext.UserSession.UserId), txtPassword.Text, false, userContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId,false);
        }

        Response.RedirectUser(this.ResolveUrl("MedicalVendorUserProfile.aspx"));
    }