Example #1
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"));
            }
        }
    }
Example #2
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"));
        }
    }
    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"));
    }