Exemplo n.º 1
0
    protected void SearchUsers_Click(object sender, EventArgs e)
    {
        RegistrationService.RegistrationService registrationService = ServiceAccess.GetInstance().GetRegistration();


        RegistrationService.UserRole userRole = (RegistrationService.UserRole)Convert.ToInt32(RoleDropDownList.SelectedValue);
        string firstName = FirstNameTextBox.Text;
        string lastName  = LastNameTextBox.Text;
        string userName  = UserNameTextBox.Text;

        try
        {
            RegistrationService.RegistrationInfo[] searchResults = registrationService.GetUsersList(userRole, firstName, lastName, userName);
            SearchUsersResultGridView.DataSource = searchResults;
            SearchUsersResultGridView.DataBind();
            ViewState["dataSource"]     = searchResults;
            SearchCriteriaPanel.Visible = false;
            SearchResultsPanel.Visible  = true;
            ResultCountLiteral.Text     = "Users result - " + searchResults.Length + " users found";
        }
        catch (Exception ex)
        {
            log.Error("Error searching Users", ex);
            ErrorLiteral.Text = "Error searching Users";
        }
    }
Exemplo n.º 2
0
    protected void ForgetPwdStep2Button_Click(object sender, EventArgs e)
    {
        registrationInfo =
            (RegistrationService.RegistrationInfo)ViewState["RegistrationInfo"];

        if (SecurityAnswerTextBox.Text == registrationInfo.PasswordAnswer)
        {
            PageDescriptionLabel.Text = "Email message has been sent to your email address.";
            SuccessText.InnerHtml     = "An email message with reset password has been sent to " +
                                        "the email address you provided during registration.<br /><br />" +
                                        "If you do not receive reset password email from us, please check your " +
                                        "spam, bulk, or junk mail folders. If you find the email there, your " +
                                        "ISP or your own software spam-blocker or filters are diverting our email.";

            ForgetPwdStep1Panel.Visible = false;
            ForgetPwdStep2Panel.Visible = false;
            ForgetPwdStep3Panel.Visible = true;

            // Generate a new password and save it.
            string password = Guid.NewGuid().ToString().Substring(0, 8);
            registrationInfo.Password = password;

            RegistrationService.RegistrationService registrationService =
                serviceLoader.GetRegistration();
            registrationService.UpdatePassword(registrationInfo);

            // Send email to the user.
            SendPasswordEmail();
        }
        else
        {
            ErrorMessageLabel.Text    = "Error: Invalid Secret Answer";
            ErrorMessageLabel.Visible = true;
        }
    }
Exemplo n.º 3
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorLiteral.Text = "";
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

            RegistrationService.RegistrationInfo registration = registrationService.GetDetails(loginInfo.UserId);

            if (PasswordTextBox.Text == registration.Password)
            {
                registration.PasswordQuestion = SecretQuestionDropDownList.SelectedItem.Text;
                registration.PasswordAnswer   = SecretAnswerTextBox.Text;
                registrationService.UpdateSecretDetails(registration);
            }
            else
            {
                ErrorLiteral.Text = "Error: Invalid Password";
            }
        }
        catch (Exception ex)
        {
        }
        if (ErrorLiteral.Text == "")
        {
            MessagesLabel.Text = "Secret details Updated Successfully";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ((HyperLink)CreditCardWebUserControl1.FindControl("HelpHyperLink")).NavigateUrl = "javascript: openHelp('../Help/CvvNumber.htm')";
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

            RegistrationService.CreditCardInfo creditCardInfo = registrationService.GetCreditCard(loginInfo.UserId);

            //((CustomValidator)CreditCardWebUserControl1.FindControl("CardNumberTextBoxCustomValidator")).Enabled = false;

            if (creditCardInfo != null)
            {
                ((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedValue = creditCardInfo.Type.LookupId.ToString();
                ((TextBox)CreditCardWebUserControl1.FindControl("CardNumberTextBox")).Text = creditCardInfo.Number;
                ((DropDownList)CreditCardWebUserControl1.FindControl("CardMonthDropDownList")).SelectedValue = creditCardInfo.ExpirationMonth.ToString();
                ((DropDownList)CreditCardWebUserControl1.FindControl("CardYearDropDownList")).SelectedValue  = creditCardInfo.ExpirationYear.ToString();
                ((TextBox)CreditCardWebUserControl1.FindControl("CVVNumberTextBox")).Text      = creditCardInfo.CvvNumber;
                ((TextBox)CreditCardWebUserControl1.FindControl("CardHolderNameTextBox")).Text = creditCardInfo.HolderName;

                ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress1TextBox")).Text = creditCardInfo.Address.Address1;
                ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress2TextBox")).Text = creditCardInfo.Address.Address2;
                ((TextBox)CreditCardWebUserControl1.FindControl("BillingCityTextBox")).Text     = creditCardInfo.Address.City;
                ((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedValue = creditCardInfo.Address.Country.CountryId.ToString();
                ((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedValue   = creditCardInfo.Address.State.StateId.ToString();

                ((TextBox)CreditCardWebUserControl1.FindControl("BillingZipTextBox")).Text = creditCardInfo.Address.Zip;
            }
        }
    }
Exemplo n.º 5
0
    protected void InitializeValuesFromSession()
    {
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

        RegistrationService.RegistrationInfo registration = registrationService.GetDetails(loginInfo.UserId);

        FirstNameTextBox.Text             = registration.FirstName;
        MiddleNameTextBox.Text            = registration.MiddleName;
        LastNameTextBox.Text              = registration.LastName;
        CompanyNameTextBox.Text           = registration.CompanyName;
        Address1TextBox.Text              = registration.Address.Address1;
        Address2TextBox.Text              = registration.Address.Address2;
        CityTextBox.Text                  = registration.Address.City;
        StateDropDownList.SelectedValue   = registration.Address.State.StateId.ToString();
        CountryDropDownList.SelectedValue = registration.Address.Country.CountryId.ToString();
        ZipTextBox.Text    = registration.Address.Zip;
        PhoneTextBox.Text  = registration.Address.Phone;
        MobileTextBox.Text = registration.Address.Mobile;
        FaxTextBox.Text    = registration.Address.Fax;
        EmailTextBox.Text  = registration.Email;
        CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs());
    }
Exemplo n.º 6
0
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        RegistrationService.LoginInfo loginInfo = new RegistrationService.LoginInfo();

        string userName;
        string password;

        userName = UserNameTextBox.Text;
        password = PasswordTextBox.Text;

        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

        loginInfo = registrationService.Login(userName, password);

        if (loginInfo != null)
        {
            Session["loginInfo"] = loginInfo;
            Response.Redirect("~/Members/Welcome.aspx");
        }
        else
        {
            ErrorLiteral.Text = "Error: Invalid UserName or Password";
        }
    }
Exemplo n.º 7
0
    protected void InitializeValuesFromSession()
    {
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

        int userId = -1;


        if (Request.QueryString["UserId"] != "")
        {
            userId = Convert.ToInt32(Request.QueryString["UserId"]);
        }
        else
        {
            Response.Redirect("SearchUsers.aspx");
        }


        UserIdHiddenField.Value = userId.ToString();
        RegistrationService.RegistrationInfo registration = registrationService.GetDetails(userId);

        UserNameTextBox.Text = registration.UserName;

        foreach (ListItem listItem in RoleDropDownList.Items)
        {
            if (listItem.Text == registration.Role.ToString())
            {
                listItem.Selected = true;
                break;
            }
        }

        StatusTextBox.Text = registration.Status.ToString();

        if (StatusTextBox.Text == "ApprovalRequired")
        {
            StatusTextBox.Text = "Approval Required";
        }


        FirstNameTextBox.Text             = registration.FirstName;
        MiddleNameTextBox.Text            = registration.MiddleName;
        LastNameTextBox.Text              = registration.LastName;
        CompanyNameTextBox.Text           = registration.CompanyName;
        Address1TextBox.Text              = registration.Address.Address1;
        Address2TextBox.Text              = registration.Address.Address2;
        CityTextBox.Text                  = registration.Address.City;
        StateDropDownList.SelectedValue   = registration.Address.State.StateId.ToString();
        CountryDropDownList.SelectedValue = registration.Address.Country.CountryId.ToString();
        ZipTextBox.Text    = registration.Address.Zip;
        PhoneTextBox.Text  = registration.Address.Phone;
        MobileTextBox.Text = registration.Address.Mobile;
        FaxTextBox.Text    = registration.Address.Fax;
        EmailTextBox.Text  = registration.Email;
        CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs());
    }
Exemplo n.º 8
0
        public static bool SendEmailAsRejected(int agentId, string category,
                                               string notes, string applicationPath)
        {
            try
            {
                // Send email to the Agent.
                RegistrationService.RegistrationService registrationService =
                    serviceLoader.GetRegistration();
                RegistrationService.RegistrationInfo agent =
                    registrationService.GetDetails(agentId);

                string templatePath = AppDomain.CurrentDomain.BaseDirectory +
                                      "HTMLTemplate\\Email_DesignRejected_Agent.html";

                Hashtable variables = new Hashtable();
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_CATEGORY", category);
                variables.Add("DESIGN_NOTES", (notes == "" ? "---" : notes));

                MailAddressCollection mailAddresses = new MailAddressCollection();
                mailAddresses.Add(agent.Email);

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Rejected", applicationPath);

                // Send email to all the Admins.
                CommonService.CommonService            commonService = serviceLoader.GetCommon();
                IList <CommonService.RegistrationInfo> users         =
                    commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString());

                templatePath = AppDomain.CurrentDomain.BaseDirectory +
                               "HTMLTemplate\\Email_DesignRejected_Admin.html";

                variables = new Hashtable();
                variables.Add("DESIGN_CATEGORY", category);
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_NOTES", (notes == "" ? "---" : notes));

                mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Rejected", applicationPath);
            }
            catch (Exception ex)
            {
                log.Error("Unknown Error", ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 9
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                ErrorLiteral.Text = "";
                ServiceAccess serviceLoader = ServiceAccess.GetInstance();
                RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
                RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

                RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo();

                // Get user's personal modified information.
                RegistrationService.StateInfo state = new RegistrationService.StateInfo();
                state.StateId = Convert.ToInt32(StateDropDownList.SelectedValue);
                state.Name    = StateDropDownList.SelectedItem.Text;

                RegistrationService.CountryInfo country = new RegistrationService.CountryInfo();
                country.CountryId = Convert.ToInt32(CountryDropDownList.SelectedValue);
                country.Name      = CountryDropDownList.SelectedItem.Text;


                RegistrationService.AddressInfo address = new RegistrationService.AddressInfo();
                address.Address1 = Address1TextBox.Text;
                address.Address2 = Address2TextBox.Text;
                address.City     = CityTextBox.Text;
                address.State    = state;
                address.Zip      = ZipTextBox.Text;
                address.Country  = country;
                address.Phone    = PhoneTextBox.Text;
                address.Fax      = FaxTextBox.Text;
                address.Mobile   = MobileTextBox.Text;

                registration.UserId      = loginInfo.UserId;
                registration.UserName    = loginInfo.UserName;
                registration.FirstName   = FirstNameTextBox.Text;
                registration.MiddleName  = MiddleNameTextBox.Text;
                registration.LastName    = LastNameTextBox.Text;
                registration.CompanyName = CompanyNameTextBox.Text;
                registration.Address     = address;
                registration.Email       = EmailTextBox.Text;
                registration.Role        = loginInfo.Role;
                registration.Status      = loginInfo.Status;
                registrationService.Update(registration, loginInfo.UserId);
            }
            catch (Exception ex)
            {
                ErrorLiteral.Text = "Error in Update";
            }
            if (ErrorLiteral.Text == "")
            {
                MessagesLabel.Text = "Profile Updated Successfully";
            }
        }
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;

            int farmId = 0;
            if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null))
            {
                int.TryParse(Request.QueryString["farmId"], out farmId);
            }

            if (farmId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            FarmIdHiddenField.Value = farmId.ToString();
            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForFarm(farmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId);
                FarmNameLabel.Text         = farm.FarmName;
                MailingPlanLabel.Text      = farm.MailingPlan.Title;
                CreateDateLabel.Text       = farm.CreateDate.ToShortDateString();
                FarmContactCountLabel.Text = farm.ContactCount.ToString();
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Get the common web service instance.

            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();

            // Get the list of secret questions and populate.
            IList <CommonService.LookupInfo> secretQuestions = commonService.GetLookups("Secret Question");

            SecretQuestionDropDownList.DataSource     = secretQuestions;
            SecretQuestionDropDownList.DataValueField = "LookupId";
            SecretQuestionDropDownList.DataTextField  = "Name";
            SecretQuestionDropDownList.DataBind();
            //SecretQuestionDropDownList.Items.Add(new ListItem(" ", "100"));


            RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

            registration = registrationService.GetDetails(loginInfo.UserId);



            ListItem questionItem = new ListItem();
            questionItem = SecretQuestionDropDownList.Items.FindByText(registration.PasswordQuestion);

            if (questionItem == null)
            {
                //SecretQuestionDropDownList.SelectedValue = "13";
                //SecretQuestionDropDownList.Items.FindByValue("13").Text = registration.PasswordQuestion;
            }
            else
            {
                //SecretQuestionDropDownList.SelectedValue = questionItem.Value;


                //SecretAnswerTextBox.Text = registration.PasswordAnswer;
                SecretQuestionDropDownList.Attributes.Add("onChange", "javascript: newQuestion(this);");
            }
        }
        else
        {
            if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13"))
            {
                SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value;
            }
        }
    }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
            try
            {
                // Get the common web service instance.
                int userId = 0;

                if ((Request.QueryString["userId"] != "") && (Request.QueryString["userId"] != null))
                {
                    int.TryParse(Request.QueryString["userId"], out userId);
                }

                if (userId == 0)
                {
                    Response.Redirect("~/Members/FarmManagement.aspx");
                }

                UserIdHiddenField.Value = userId.ToString();
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();

                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList();
                MailingPlanDropDownList.DataSource     = mailingPlans;
                MailingPlanDropDownList.DataValueField = "MailingPlanId";
                MailingPlanDropDownList.DataTextField  = "Title";
                MailingPlanDropDownList.DataBind();
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
            }
        }
    }
Exemplo n.º 13
0
    protected void CheckUniqueEmail(Object source, ServerValidateEventArgs args)
    {
        string        email         = args.Value;
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

        if (registrationService.IsEmailExists(email, Convert.ToInt32(UserIdHiddenField.Value)))
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }
Exemplo n.º 14
0
    protected void CheckUniqueUserName(Object source, ServerValidateEventArgs args)
    {
        string        userName      = args.Value;
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();


        if (registrationService.GetUserDetails(userName) != null)
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }
Exemplo n.º 15
0
    protected void CheckUniqueEmail(Object source, ServerValidateEventArgs args)
    {
        string        email         = args.Value;
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();
        RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];


        if (registrationService.IsEmailExists(email, loginInfo.UserId))
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }
Exemplo n.º 16
0
    private void ApproveRejectUser(RegistrationService.RegistrationStatus status)
    {
        try
        {
            int userId;
            ErrorLiteral.Text = "";
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

            RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo();
            RegistrationService.LoginInfo        loginInfo    = (RegistrationService.LoginInfo)Session["loginInfo"];

            userId = Convert.ToInt32(UserIdHiddenField.Value);
            registrationService.UpdateStatus(userId, status, loginInfo.UserId);
        }
        catch (Exception ex)
        {
            ErrorLiteral.Text = "Error in Update";
        }
    }
Exemplo n.º 17
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                ErrorLiteral.Text = "";
                ServiceAccess serviceLoader = ServiceAccess.GetInstance();
                RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
                RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

                RegistrationService.RegistrationInfo registration = registrationService.GetDetails(loginInfo.UserId);
                if (OldPasswordTextBox.Text == registration.Password)
                {
                    if (OldPasswordTextBox.Text == NewPasswordTextBox.Text)
                    {
                        ErrorLiteral.Text = "Error: New password cannot be same as Old";
                    }
                    else
                    {
                        registration.Password = NewPasswordTextBox.Text;
                        registrationService.UpdatePassword(registration);
                    }
                }
                else
                {
                    ErrorLiteral.Text = "Error: Invalid Old Password";
                }
                if (ErrorLiteral.Text == "")
                {
                    MessagesLabel.Text = "Password Updated Successfully";
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
    protected void FinishButton_Click(object sender, EventArgs e)
    {
        ErrorLiteral.Text = "";
        RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"];
        int userId = 0;

        try
        {
            // Insert the registration details

            // Get the service loader
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();

            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();
            userId = registrationService.Insert(registration);
        }
        catch (Exception ex)
        {
            log.Error("User Registration is not sucessful", ex);
            ErrorLiteral.Text = "User registration failed";
        }

        if (ErrorLiteral.Text == "")
        {
            RegistrationService.LoginInfo loginInfo = new RegistrationService.LoginInfo();
            loginInfo.UserId    = userId;
            loginInfo.UserName  = registration.UserName;
            loginInfo.FirstName = registration.FirstName;
            loginInfo.LastName  = registration.LastName;
            loginInfo.Role      = registration.Role;
            loginInfo.Status    = registration.Status;

            SendRegistrationEmail(registration);
            Session["registrationInfo"] = null;
            Response.Redirect("RoleRegistrationThanks.aspx");
        }
    }
Exemplo n.º 19
0
    protected void RejectUserButton_Click(object sender, EventArgs e)
    {
        try
        {
            int           userId        = Convert.ToInt32(UserIdHiddenField.Value);
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();
            RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];

            registrationService.DeleteUser(userId, loginInfo.UserId);
            SendRejectEmail();
            SendRejectEmailCSR();
        }
        catch (Exception ex)
        {
            ErrorLiteral.Text = "Error in Rejecting the user";
        }
        string selectedValue = Request.QueryString["selectedCriteria"];

        if (ErrorLiteral.Text == "")
        {
            Response.Redirect("SearchUsers.aspx" + "?selectedCriteria=" + selectedValue);
        }
    }
Exemplo n.º 20
0
    private bool IsUserExists(string userName)
    {
        bool isValid = false;

        try
        {
            RegistrationService.RegistrationService registrationService =
                serviceLoader.GetRegistration();
            registrationInfo = registrationService.GetUserDetails(userName);

            if (registrationInfo != null)
            {
                ViewState.Add("RegistrationInfo", registrationInfo);

                isValid = true;
            }
        }
        catch (Exception ex)
        {
            log.Error("Unknown Error", ex);
        }

        return(isValid);
    }
Exemplo n.º 21
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        try
        {
            bool isExpiryValid     = false;
            bool isCardNumberValid = false;

            ((CustomValidator)CreditCardWebUserControl1.FindControl("CCExpiryCustomValidator")).Validate();
            if (Page.IsValid)
            {
                isExpiryValid = true;
            }
            ((CustomValidator)CreditCardWebUserControl1.FindControl("CardNumberTextBoxCustomValidator")).Validate();
            if (Page.IsValid)
            {
                isCardNumberValid = true;
            }

            if (isExpiryValid == true && isCardNumberValid == true)
            {
                ErrorLiteral.Text = "";
                ServiceAccess serviceLoader = ServiceAccess.GetInstance();
                RegistrationService.LoginInfo           loginInfo           = (RegistrationService.LoginInfo)Session["loginInfo"];
                RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

                RegistrationService.CreditCardInfo creditCardInfo = new RegistrationService.CreditCardInfo();

                RegistrationService.StateInfo billingState = new RegistrationService.StateInfo();
                billingState.StateId = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedValue);
                billingState.Name    = ((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedItem.Text;

                RegistrationService.CountryInfo billingCountry = new RegistrationService.CountryInfo();
                billingCountry.CountryId = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedValue);
                billingCountry.Name      = ((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedItem.Text;

                RegistrationService.AddressInfo billingAddress = new RegistrationService.AddressInfo();
                billingAddress.Address1 = ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress1TextBox")).Text;
                billingAddress.Address2 = ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress2TextBox")).Text;
                billingAddress.City     = ((TextBox)CreditCardWebUserControl1.FindControl("BillingCityTextBox")).Text;
                billingAddress.State    = billingState;
                billingAddress.Zip      = ((TextBox)CreditCardWebUserControl1.FindControl("BillingZipTextBox")).Text;
                billingAddress.Country  = billingCountry;

                RegistrationService.LookupInfo creditCardType = new RegistrationService.LookupInfo();
                creditCardType.LookupId = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedValue);
                creditCardType.Name     = ((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedItem.Text;

                creditCardInfo.Type            = creditCardType;
                creditCardInfo.Number          = ((TextBox)CreditCardWebUserControl1.FindControl("CardNumberTextBox")).Text;
                creditCardInfo.CvvNumber       = ((TextBox)CreditCardWebUserControl1.FindControl("CVVNumberTextBox")).Text;
                creditCardInfo.HolderName      = ((TextBox)CreditCardWebUserControl1.FindControl("CardHolderNameTextBox")).Text;
                creditCardInfo.ExpirationMonth = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("CardMonthDropDownList")).SelectedValue);
                creditCardInfo.ExpirationYear  = Convert.ToInt32(((DropDownList)CreditCardWebUserControl1.FindControl("CardYearDropDownList")).SelectedValue);
                creditCardInfo.Address         = billingAddress;


                registrationService.UpdateCreditCard(loginInfo.UserId, creditCardInfo);
            }
            else
            {
                ErrorLiteral.Text = " ";
            }
        }
        catch (Exception ex)
        {
            ErrorLiteral.Text = "Error in Update";
        }
        if (ErrorLiteral.Text == "")
        {
            MessagesLabel.Text = "Credit Card Information Updated Successfully";
        }
    }
Exemplo n.º 22
0
    protected void InitializeValuesFromSession()
    {
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

        int userId = -1;


        if (Request.QueryString["UserId"] != "")
        {
            userId = Convert.ToInt32(Request.QueryString["UserId"]);
        }
        else
        {
            Response.Redirect("SearchUsers.aspx");
        }

        UserIdHiddenField.Value = userId.ToString();
        RegistrationService.RegistrationInfo registration = registrationService.GetDetails(userId);

        if (registration.Status == Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus.ApprovalRequired)
        {
            ApproveUserButton.Visible = true;
            RejectUserButton.Visible  = true;

            //ApprovePanel.Visible = true;
        }
        else
        {
            //ActivatePanel.Visible = true;
            if (registration.Status == Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus.Active)
            {
                InactivateUserButton.Visible = true;
                ActivateSpaceImage.Visible   = false;
                ApproveSpaceImage.Visible    = false;
                RejectSpaceImage.Visible     = false;
            }
            else
            {
                ActivateUserButton.Visible   = true;
                InActivateSpaceImage.Visible = false;
                ApproveSpaceImage.Visible    = false;
                RejectSpaceImage.Visible     = false;
            }
        }


        UserNameLabel.Text    = registration.UserName;
        RoleLabel.Text        = registration.Role.ToString();
        FirstNameLabel.Text   = registration.FirstName;
        MiddleNameLabel.Text  = registration.MiddleName;
        LastNameLabel.Text    = registration.LastName;
        CompanyNameLabel.Text = registration.CompanyName;
        Address1Label.Text    = registration.Address.Address1;
        Address2Label.Text    = registration.Address.Address2;
        CityLabel.Text        = registration.Address.City;
        StateLabel.Text       = registration.Address.State.Name;
        CountryLabel.Text     = registration.Address.Country.Name;
        ZipLabel.Text         = registration.Address.Zip;
        PhoneLabel.Text       = registration.Address.Phone;
        MobileLabel.Text      = registration.Address.Mobile;
        FaxLabel.Text         = registration.Address.Fax;
        EmailLabel.Text       = registration.Email;
        StatusLabel.Text      = registration.Status.ToString();

        if (StatusLabel.Text == "ApprovalRequired")
        {
            StatusLabel.Text = "Approval Required";
        }
    }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int plotId = 100107;

            //if ((Request.QueryString["plotId"] != "") && (Request.QueryString["plotId"] != null))
            //    int.TryParse(Request.QueryString["plotId"], out plotId);

            //if (plotId == 0)
            //    Response.Redirect("~/Members/FarmManagement.aspx");

            PlotIdHiddenField.Value = plotId.ToString();

            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForPlot(plotId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }
                FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId);
                FarmIdHiddenField.Value        = plot.FarmId.ToString();
                ContactListGridView.DataSource = plot.Contacts;
                ContactListGridView.DataBind();

                //Block Edit Course for the Printer

                /*
                 * if (IsPrinterRole)
                 * {
                 *  ContactListGridView.Columns.RemoveAt(0);
                 *  ContactListGridView.Columns.RemoveAt(1);
                 *
                 *  for (int i = 0; i < plot.Contacts.Length; i++)
                 *  {
                 *      ContactListGridView.Rows[i].Cells[0].FindControl("EditContactHyperLink").Visible = false;
                 *      ContactListGridView.Rows[i].Cells[0].FindControl("ContactIdCheckBox").Visible = false;
                 *  }
                 * }
                 */
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
            }
        }
    }
Exemplo n.º 24
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                ErrorLiteral.Text = "";

                if (StatusTextBox.Text == "Approval Required")
                {
                    StatusTextBox.Text = "ApprovalRequired";
                }
                ServiceAccess serviceLoader = ServiceAccess.GetInstance();
                RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();

                RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo();

                // Get user's personal modified information.
                RegistrationService.StateInfo state     = new RegistrationService.StateInfo();
                RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"];


                state.StateId = Convert.ToInt32(StateDropDownList.SelectedValue);
                state.Name    = StateDropDownList.SelectedItem.Text;

                RegistrationService.CountryInfo country = new RegistrationService.CountryInfo();
                country.CountryId = Convert.ToInt32(CountryDropDownList.SelectedValue);
                country.Name      = CountryDropDownList.SelectedItem.Text;


                RegistrationService.AddressInfo address = new RegistrationService.AddressInfo();
                address.Address1 = Address1TextBox.Text;
                address.Address2 = Address2TextBox.Text;
                address.City     = CityTextBox.Text;
                address.State    = state;
                address.Zip      = ZipTextBox.Text;
                address.Country  = country;
                address.Phone    = PhoneTextBox.Text;
                address.Fax      = FaxTextBox.Text;
                address.Mobile   = MobileTextBox.Text;

                registration.UserId      = Convert.ToInt32(UserIdHiddenField.Value);
                registration.UserName    = UserNameTextBox.Text;
                registration.FirstName   = FirstNameTextBox.Text;
                registration.MiddleName  = MiddleNameTextBox.Text;
                registration.LastName    = LastNameTextBox.Text;
                registration.CompanyName = CompanyNameTextBox.Text;
                registration.Address     = address;
                registration.Email       = EmailTextBox.Text;
                registration.Role        = (Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole)Enum.Parse(typeof(Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole), RoleDropDownList.SelectedValue, true);
                registration.Status      = (Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus)Enum.Parse(typeof(Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus), StatusTextBox.Text, true);

                registrationService.Update(registration, loginInfo.UserId);
            }
            catch (Exception ex)
            {
                ErrorLiteral.Text = "Error in Update";
            }
            if (ErrorLiteral.Text == "")
            {
                RedirectPage(Request.QueryString["PageName"]);
            }
        }
    }
Exemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (IsPrinterRole)
            {
                DeleteContactButton.Enabled = false;
                EditContactButton.Enabled   = false;
            }

            Int64 contactId = 0;
            if ((Request.QueryString["contactId"] != "") && (Request.QueryString["contactId"] != null))
            {
                Int64.TryParse(Request.QueryString["contactId"], out contactId);
            }

            if (contactId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            if ((Request.QueryString["parentPage"] != "") && (Request.QueryString["parentPage"] != null))
            {
                ParentPageHiddenField.Value = Request.QueryString["parentPage"];
            }
            else
            {
                ParentPageHiddenField.Value = "";
            }

            try
            {
                //Get the common web service instance.
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();

                //Getting Required Data
                FarmService.ContactInfo contact = farmService.GetContactDetails(contactId);
                FarmService.PlotInfo    plot    = farmService.GetPlotDetail(contact.PlotId);
                FarmService.FarmInfo    farm    = farmService.GetFarmDetail(plot.FarmId);
                int contactCount = farmService.GetContactCountForPlot(contact.PlotId);

                int userId = farmService.GetUserIdForFarm(plot.FarmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                //Header Details
                FarmNameLabel.Text            = farm.FarmName;
                PlotNameLabel.Text            = plot.PlotName;
                ContactCountLabel.Text        = contactCount.ToString();
                ContactCountHiddenField.Value = contactCount.ToString();

                if (farmService.IsDefaultPlot(plot.PlotId))
                {
                    DefaultPlotFlagHiddenField.Value = "true";
                }
                else
                {
                    DefaultPlotFlagHiddenField.Value = "false";
                }

                CreatedOnLabel.Text  = contact.CreateDate.ToShortDateString();
                ModifiedOnLable.Text = contact.LastModifyDate.ToShortDateString();

                //Hidden Fields
                FarmIdHiddenField.Value    = farm.FarmId.ToString();
                PlotIdHiddenField.Value    = plot.PlotId.ToString();
                ContactIdHiddenField.Value = contact.ContactId.ToString();

                //Contact Details
                ContactIdLabel.Text        = contact.ContactId.ToString();
                ScheduleNumberLabel.Text   = contact.ScheduleNumber.ToString();
                OwnerFullNameLabel.Text    = contact.OwnerFullName;
                LotNumberLabel.Text        = contact.Lot.ToString();
                BlockLabel.Text            = contact.Block;
                SubdivisionLabel.Text      = contact.Subdivision;
                FilingLabel.Text           = contact.Filing;
                SiteAddressLabel.Text      = contact.SiteAddress;
                BedroomsLabel.Text         = contact.Bedrooms.ToString();
                FullBathLabel.Text         = contact.FullBath.ToString();
                ThreeQuarterBathLabel.Text = contact.ThreeQuarterBath.ToString();
                HalfBathLabel.Text         = contact.HalfBath.ToString();
                AcresLabel.Text            = contact.Acres.ToString();
                ActMktComboLabel.Text      = contact.ActMktComb;
                OwnerFirstNameLabel.Text   = contact.OwnerFirstName;
                OwnerLastNameLabel.Text    = contact.OwnerLastName;
                OwnerAddress1Label.Text    = contact.OwnerAddress1;
                OwnerArrdess2Label.Text    = contact.OwnerAddress2;
                OwnerCityLabel.Text        = contact.OwnerCity;
                OwnerStateLabel.Text       = contact.OwnerState;
                OwnerZipLabel.Text         = contact.OwnerZip;
                OwnerCountryLabel.Text     = contact.OwnerCountry;
                SaleDateLabel.Text         = contact.SaleDate.ToShortDateString();
                TransAmountLabel.Text      = contact.TransAmount.ToString();
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
                ErrorLiteral.Text = "UNKNOWN ERROR: Contact Administrator";
            }
        }
    }
Exemplo n.º 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (IsPrinterRole)
            {
                DeleteFarmButton.Enabled = false;
                EditFarmButton.Enabled   = false;
                FirmUpButton.Enabled     = false;
                CreatePlotButton.Enabled = false;
            }
            int farmId = 0;
            if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null))
            {
                int.TryParse(Request.QueryString["farmId"], out farmId);
            }

            if (farmId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            FarmIdHiddenField.Value = farmId.ToString();

            try
            {
                // Get the common web service instance.

                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForFarm(farmId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }

                FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId);
                FarmNameLabel.Text    = farm.FarmName;
                MailingPlanLabel.Text = farm.MailingPlan.Title;
                CreateDateLabel.Text  = farm.CreateDate.ToShortDateString();
                if (farm.Firmup)
                {
                    FirmupStatusLabel.Text = "Firmed Up";
                }
                else
                {
                    FirmupStatusLabel.Text = "Not Firmed Up";
                }
                FarmContactCountLabel.Text = farm.ContactCount.ToString();
                PlotCountLabel.Text        = farm.PlotCount.ToString();

                FillPlotGrid(farm.Plots, 0);

                // ***************** Firm Up ***************** \\
                if (IsAgentRole)
                {
                    // Set the firm up button visible to agent.
                    FirmUpButtonPanel.Visible = true;

                    // Get the mailing plan of the farm.
                    int mailingPlanId = farm.MailingPlan.MailingPlanId;

                    // Get the design details of the agent.
                    DesignService.DesignService designService = serviceLoader.GetDesign();
                    DesignService.DesignInfo    design        = new DesignService.DesignInfo();
                    DesignService.DesignInfo    brochure      = new DesignService.DesignInfo();

                    RegistrationService.LoginInfo loginInfo =
                        (RegistrationService.LoginInfo)Session["loginInfo"];
                    IList <DesignService.DesignInfo> designs =
                        designService.GetList(loginInfo.UserId);

                    foreach (DesignService.DesignInfo designInfo in designs)
                    {
                        if (designInfo.Category.Name == "PowerKard")
                        {
                            design = designInfo;
                        }
                        else
                        {
                            brochure = designInfo;
                        }
                    }

                    // Get the credit card details of the logged in agent.
                    RegistrationService.RegistrationService registrationService =
                        serviceLoader.GetRegistration();
                    RegistrationService.CreditCardInfo creditCard =
                        registrationService.GetCreditCard(loginInfo.UserId);
                    bool isCreditCardValid = false;

                    if (creditCard != null)
                    {
                        DateTime expirationDate =
                            new DateTime(creditCard.ExpirationYear,
                                         creditCard.ExpirationMonth,
                                         1);

                        expirationDate = expirationDate.AddMonths(1);

                        if (expirationDate > DateTime.Today)
                        {
                            isCreditCardValid = true;
                        }
                    }

                    // Check whether the farm is ready for firm up.
                    if (mailingPlanId == 0)
                    {
                        FirmUpStatusHiddenField.Value = "MP_REQ";
                    }
                    else if (mailingPlanId == 100003)
                    {
                        // 8 x 8.
                        if (design.Status.Name != "Approved")
                        {
                            FirmUpStatusHiddenField.Value = "DESIGN_REQ";
                        }
                    }
                    else
                    {
                        if (design.Status.Name != "Approved" ||
                            brochure.Status.Name != "Approved")
                        {
                            FirmUpStatusHiddenField.Value = "DESIGN_REQ";
                        }
                    }

                    if (!isCreditCardValid)
                    {
                        FirmUpStatusHiddenField.Value = "CC_INVALID";
                    }

                    if (farm.Firmup)
                    {
                        FirmUpButton.Enabled = false;
                    }
                }
                // ******************************************* \\
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
                ErrorLiteral.Text = "Unknown Error Please contact Administrator:";
            }
        }
    }
Exemplo n.º 27
0
    protected void FinishButton_Click(object sender, EventArgs e)
    {
        ErrorLiteral.Text = "";
        RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"];
        int    userId     = 0;
        string folderPath = Request.PhysicalPath.Replace("AgentRegistrationConf.aspx", "Members\\UserData\\");
        String username   = registration.UserName;

        registration.UserName = username + ";" + folderPath;
        OrderService.OrderInfo orderInfo = new OrderService.OrderInfo();
        int membershipFee;

        try
        {
            // Get the service loader
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();

            CommonService.CommonService commonService = serviceLoader.GetCommon();
            // Get the Membership fee
            CommonService.PropertyInfo property = commonService.GetProperty("Membership Fee");
            membershipFee = Convert.ToInt32(property.Value);


            // Insert the registration details


            RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration();
            userId = registrationService.Insert(registration);
            registration.UserName = username;


            // Insert the membership details

            if (registration.Role == Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole.Agent)
            {
                try
                {
                    OrderService.CreditCardInfo creditCard = new OrderService.CreditCardInfo();

                    OrderService.StateInfo billingState = new OrderService.StateInfo();
                    billingState.StateId = registration.Address.State.StateId;
                    billingState.Name    = registration.Address.State.Name;

                    OrderService.CountryInfo billingCountry = new OrderService.CountryInfo();
                    billingCountry.CountryId = registration.Address.Country.CountryId;
                    billingCountry.Name      = registration.Address.Country.Name;

                    OrderService.AddressInfo billingAddress = new OrderService.AddressInfo();
                    billingAddress.Address1 = registration.Address.Address1;
                    billingAddress.Address2 = registration.Address.Address2;
                    billingAddress.City     = registration.Address.City;
                    billingAddress.State    = billingState;
                    billingAddress.Zip      = registration.Address.Zip;
                    billingAddress.Country  = billingCountry;

                    OrderService.LookupInfo creditCardType = new OrderService.LookupInfo();
                    creditCardType.LookupId = registration.CreditCard.Type.LookupId;
                    creditCardType.Name     = registration.CreditCard.Type.Name;

                    creditCard.Type            = creditCardType;
                    creditCard.Number          = registration.CreditCard.Number;
                    creditCard.CvvNumber       = registration.CreditCard.CvvNumber;
                    creditCard.HolderName      = registration.CreditCard.HolderName;
                    creditCard.ExpirationMonth = registration.CreditCard.ExpirationMonth;
                    creditCard.ExpirationYear  = registration.CreditCard.ExpirationYear;
                    creditCard.Address         = billingAddress;

                    orderInfo.Number             = 100;
                    orderInfo.Type               = Irmac.MailingCycle.BLLServiceLoader.Order.OrderType.MembershipFee;
                    orderInfo.Date               = DateTime.Now;
                    orderInfo.Amount             = membershipFee;
                    orderInfo.CreditCard         = creditCard;
                    orderInfo.TransactionCode    = -1;
                    orderInfo.TransactionMessage = "Dummy Transaction";
                    orderInfo.Items              = null;

                    OrderService.OrderService orderService = serviceLoader.GetOrder();
                    orderService.Insert(userId, orderInfo, userId);
                }
                catch (Exception ex)
                {
                    log.Error("Transaction is not sucessful", ex);
                    ErrorLiteral.Text = "credit card transaction failed";
                }
            }
        }
        catch (Exception ex)
        {
            log.Error("User Registration is not sucessful", ex);
            ErrorLiteral.Text = "User registration failed" + " | " + ex.Message + " | " + ex.StackTrace.ToString();
        }

        if (ErrorLiteral.Text == "")
        {
            RegistrationService.LoginInfo loginInfo = new RegistrationService.LoginInfo();
            loginInfo.UserId    = userId;
            loginInfo.UserName  = registration.UserName;
            loginInfo.FirstName = registration.FirstName;
            loginInfo.LastName  = registration.LastName;
            loginInfo.Role      = registration.Role;
            loginInfo.Status    = registration.Status;

            SendRegistrationEmail(registration);
            Session["registrationInfo"] = null;
            Session["loginInfo"]        = loginInfo;
            Response.Redirect("AgentRegistrationThanks.aspx");
        }
    }
Exemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["loginInfo"] == null || Session["loginInfo"] == "")
        {
            Response.Redirect("../userLogin.aspx?Message=SessionExpired");
        }

        RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"];
        bool          isAgent       = (loginInfo.Role == RegistrationService.UserRole.Agent);
        ServiceAccess serviceLoader = ServiceAccess.GetInstance();

        // ************Populate the Farm Data************

        FarmService.FarmService farmService = serviceLoader.GetFarm();
        int  farmCount    = 0;
        int  plotCount    = 0;
        long contactCount = 0;

        if (isAgent)
        {
            FarmService.FarmInfo[] farmInfo = farmService.GetFarmSummary(loginInfo.UserId);
            farmCount = farmInfo.Length;
            for (int i = 0; i < farmCount; i++)
            {
                plotCount    = plotCount + farmInfo[i].PlotCount;
                contactCount = contactCount + farmInfo[i].ContactCount;
            }
        }
        else
        {
            farmCount    = farmService.TotalActiveFarmCount();
            plotCount    = farmService.TotalActivePlotCount();
            contactCount = farmService.TotalActiveContactCount();
        }

        FarmPlotLabel.Text = farmCount.ToString() + " Farms / " + plotCount + " Plots";
        ContactLabel.Text  = contactCount.ToString() + " Contacts";

        // ************Populate Messages Data************
        MessageService messageService = serviceLoader.GetMessage();

        StandardMessagesLabel.Text = messageService.GetStandardMessageList(isAgent, string.Empty, string.Empty).Length + " messages";

        if (isAgent)
        {
            CustomMessagesLabel.Text = messageService.GetCustomMessageList(loginInfo.UserId).Length + " messages";
        }
        else
        {
            CustomMessagesLabel.Text = messageService.GetCustomMessageList(0).Length + " messages";
        }


        // ************Populate design Data************
        DesignService.DesignService designService = serviceLoader.GetDesign();

        if (isAgent)
        {
            IList <DesignService.DesignInfo> designs =
                designService.GetList(loginInfo.UserId);

            DesignService.DesignInfo design   = new DesignService.DesignInfo();
            DesignService.DesignInfo brochure = new DesignService.DesignInfo();

            foreach (DesignService.DesignInfo designInfo in designs)
            {
                if (designInfo.Category.Name == "PowerKard")
                {
                    design = designInfo;
                }
                else
                {
                    brochure = designInfo;
                }
            }

            PowerKardStatusLabel.Text = design.Status.Name.ToString();
            BrochureStatusLabel.Text  = brochure.Status.Name.ToString();
        }
        else
        {
            object[]  designStatusArray;
            DataTable designStatusTable = new DataTable();
            designStatusArray = designService.GetSummary();
            designStatusTable = Util.GetDataTable(designStatusArray);

            if (designStatusTable != null)
            {
                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text + designStatusTable.Rows[0][3] + " - " + designStatusTable.Rows[0][4] + ",";
                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text + designStatusTable.Rows[1][3] + " - " + designStatusTable.Rows[1][4] + ",";
                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text + designStatusTable.Rows[4][3] + " - " + designStatusTable.Rows[4][4] + ",";
                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text.Substring(0, PowerKardStatusLabel.Text.Length - 1);

                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text.Replace("Uploaded", "Upd");
                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text.Replace("Submitted", "Sub");
                PowerKardStatusLabel.Text = PowerKardStatusLabel.Text.Replace("Approved", "App");

                BrochureStatusLabel.Text = BrochureStatusLabel.Text + designStatusTable.Rows[5][3] + " - " + designStatusTable.Rows[5][4] + ",";
                BrochureStatusLabel.Text = BrochureStatusLabel.Text + designStatusTable.Rows[6][3] + " - " + designStatusTable.Rows[6][4] + ",";
                BrochureStatusLabel.Text = BrochureStatusLabel.Text + designStatusTable.Rows[9][3] + " - " + designStatusTable.Rows[9][4] + ",";
                BrochureStatusLabel.Text = BrochureStatusLabel.Text.Substring(0, BrochureStatusLabel.Text.Length - 1);

                BrochureStatusLabel.Text = BrochureStatusLabel.Text.Replace("Uploaded", "Upd");
                BrochureStatusLabel.Text = BrochureStatusLabel.Text.Replace("Submitted", "Sub");
                BrochureStatusLabel.Text = BrochureStatusLabel.Text.Replace("Approved", "App");

                WelcomeHelpPanel.Visible = true;
            }
        }
        // ************Populate Inventory Data************

        ProductService.ProductService    productService = serviceLoader.GetProduct();
        ProductService.ProductItemInfo[] productItemInfo;

        if (isAgent)
        {
            productItemInfo = productService.GetInventoryTotalCount(loginInfo.UserId);
        }
        else
        {
            productItemInfo = productService.GetInventoryTotalCount(0);
        }

        if (productItemInfo.Length < 1)
        {
            InventoryLabel.Text = "PowerKards:0<br>Brochures:0";
        }

        InventoryRepeater.DataSource = productItemInfo;
        InventoryRepeater.DataBind();

        // ************Populate Schedule Management Data************
        ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule();

        object[]  SchedulePlansArray;
        DataTable SchedulePlansTable = new DataTable();

        if (isAgent)
        {
            SchedulePlansArray = scheduleService.GetSummaryOfUser(loginInfo.UserId);
        }
        else
        {
            SchedulePlansArray = scheduleService.GetSummary();
        }

        SchedulePlansTable = Util.GetDataTable(SchedulePlansArray);

        if (SchedulePlansTable != null)
        {
            ActivePlansLabel.Text = SchedulePlansTable.Rows[0][0].ToString() + ": " + SchedulePlansTable.Rows[0][1].ToString();
            if (Convert.ToInt32(SchedulePlansTable.Rows[1][1].ToString()) > 0)
            {
                DelayedPlansLabel.Text = SchedulePlansTable.Rows[1][0].ToString() + ": " + SchedulePlansTable.Rows[1][1].ToString();
            }
        }

        //********* Populate User Management Info **********

        if (isAgent)
        {
            UserManagementPanel.Visible = false;
        }
        else
        {
            object[]  usersArray;
            DataTable usersTable = new DataTable();
            RegistrationService.RegistrationService registrationService = ServiceAccess.GetInstance().GetRegistration();

            usersArray = registrationService.GetApprovalRequiredUsers();
            usersTable = Util.GetDataTable(usersArray);
            RegistrationService.UserRole userRole;
            if (usersTable != null)
            {
                if (usersTable.Rows.Count < 1)
                {
                    UsersLabel.Text = "No Users waiting for approval";
                }
                else
                {
                    for (int i = 0; i < usersTable.Rows.Count; i++)
                    {
                        userRole        = (RegistrationService.UserRole)((Convert.ToInt32(usersTable.Rows[i][0].ToString()) - 1));
                        UsersLabel.Text = UsersLabel.Text + userRole.ToString() + " : " + usersTable.Rows[i][1].ToString() + "<br>";
                    }
                }
            }
        }
    }
Exemplo n.º 29
0
        public static bool SendEmailAsSubmitted(DesignService.DesignInfo design,
                                                string applicationPath, string url)
        {
            try
            {
                RegistrationService.RegistrationService registrationService =
                    serviceLoader.GetRegistration();
                RegistrationService.RegistrationInfo agent =
                    registrationService.GetDetails(design.UserId);

                // Send email to all the Printers.
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();
                IList <CommonService.RegistrationInfo> users =
                    commonService.GetUsersByRole(CommonService.UserRole.Printer.ToString());

                string templatePath = AppDomain.CurrentDomain.BaseDirectory +
                                      "HTMLTemplate\\Email_DesignSubmitted.html";

                Hashtable variables = new Hashtable();
                variables.Add("ROLE", CommonService.UserRole.Printer.ToString());
                variables.Add("DESIGN_CATEGORY", design.Category.Name);
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_INFO", BuildInformation(design, agent.UserId, url));

                MailAddressCollection mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Submitted for Approval", applicationPath);

                // Send email to all the Admins.
                users = commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString());

                templatePath = AppDomain.CurrentDomain.BaseDirectory +
                               "HTMLTemplate\\Email_DesignSubmitted.html";

                variables = new Hashtable();
                variables.Add("ROLE", "Administrator");
                variables.Add("DESIGN_CATEGORY", design.Category.Name);
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_INFO", BuildInformation(design, agent.UserId, url));

                mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Submitted for Approval", applicationPath);
            }
            catch (Exception ex)
            {
                log.Error("Unknown Error", ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (IsPrinterRole)
            {
                MoveToButton.Enabled        = false;
                DeleteContactButton.Enabled = false;
                DeletePlotButton.Enabled    = false;
                AddContactButton.Enabled    = false;
                EditPlotButton.Enabled      = false;
            }
            int plotId = 0;

            if ((Request.QueryString["plotId"] != "") && (Request.QueryString["plotId"] != null))
            {
                int.TryParse(Request.QueryString["plotId"], out plotId);
            }

            if (plotId == 0)
            {
                Response.Redirect("~/Members/FarmManagement.aspx");
            }

            ExportToExcelButton.CausesValidation = false;
            ExportToExcelButton.OnClientClick    = "javascript: window.open('./ExcelOrCsvFileDownload.aspx?plotId=" + plotId.ToString() + "');";
            PlotIdHiddenField.Value = plotId.ToString();

            try
            {
                // Get the common web service instance.
                ServiceAccess           serviceLoader = ServiceAccess.GetInstance();
                FarmService.FarmService farmService   = serviceLoader.GetFarm();
                int userId = farmService.GetUserIdForPlot(plotId);
                UserIdHiddenField.Value = userId.ToString();
                if (!IsAgentRole)
                {
                    ForAgentLiteral.Visible = true;
                    RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration();
                    RegistrationService.RegistrationInfo    regInfo    = regservice.GetDetails(userId);
                    ForAgentLiteral.Text            = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + "&nbsp;";
                    ForAgentUserIdHiddenField.Value = userId.ToString();
                }
                else
                {
                    ForAgentLiteral.Visible = false;
                }
                FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId);
                PlotNameLabel.Text             = plot.PlotName;
                ContactCountLabel.Text         = plot.ContactCount.ToString();
                CreateDateLabel.Text           = plot.CreateDate.ToShortDateString();
                FarmIdHiddenField.Value        = plot.FarmId.ToString();
                ContactListGridView.DataSource = plot.Contacts;
                ContactListGridView.DataBind();

                //Default Plot flag for validation in Javascript
                if (farmService.IsDefaultPlot(plotId))
                {
                    DefaultPlotFlagHiddenField.Value = "true";
                }
                else
                {
                    DefaultPlotFlagHiddenField.Value = "false";
                }

                //Validation related Data stored in Hidden Field
                if (farmService.IsDefaultPlot(plot.PlotId))
                {
                    DefaultContactHiddenField.Value = "true";
                    MoveToButton.Enabled            = true;

                    //Move to for single contact in a default plot disabled

                    /*if (plot.Contacts.Length < 2)
                     *  MoveToButton.Enabled = false;
                     * else
                     *  MoveToButton.Enabled = true;*/
                }
                else
                {
                    DefaultContactHiddenField.Value = "false";
                    MoveToButton.Enabled            = true;
                }

                ContactCountHiddenField.Value = plot.Contacts.Length.ToString();

                //For Single Contact in Default Plot
                if (IsPrinterRole)
                {
                    for (int i = 0; i < plot.Contacts.Length; i++)
                    {
                        ContactListGridView.Rows[i].Cells[0].FindControl("EditContactHyperLink").Visible = false;
                        ContactListGridView.Rows[i].Cells[0].FindControl("ContactIdCheckBox").Visible    = false;
                    }
                }
            }
            catch (Exception exception)
            {
                log.Error("UNKNOWN ERROR:", exception);
            }
        }
    }