protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList countryDropDownList = (DropDownList)sender;

        try
        {
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();

            StateDropDownList.Items.Clear();
            int countryId = Convert.ToInt32(countryDropDownList.SelectedValue);

            if (countryId == 0)
            {
                StateDropDownList.Items.Add(new ListItem("<Select a State>", "0"));
            }
            else
            {
                CommonService.CommonService     commonService = serviceLoader.GetCommon();
                IList <CommonService.StateInfo> states        = commonService.GetStates(countryId);

                StateDropDownList.DataSource     = states;
                StateDropDownList.DataValueField = "StateId";
                StateDropDownList.DataTextField  = "Name";
                StateDropDownList.DataBind();
            }
        }
        catch (Exception ex)
        {
            log.Error("UNKNOWN ERROR:", ex);
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(),
                                                CountryDropDownList.ClientID);

        if (!Page.IsPostBack)
        {
            // Get the common web service instance.

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

            // Get the list of contries and populate.
            IList <CommonService.CountryInfo> countries = commonService.GetCountries();

            CountryDropDownList.DataSource     = countries;
            CountryDropDownList.DataValueField = "CountryId";
            CountryDropDownList.DataTextField  = "Name";
            CountryDropDownList.DataBind();

            CountryDropDownList.Items.FindByText("United States").Selected = true;
            CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs());

            if (Session["loginInfo"] != null && Session["loginInfo"] != "")
            {
                InitializeValuesFromSession();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        if (!IsPostBack)
        {
            // Populate agents into dropdown list.
            try
            {
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();

                AgentDropDownList.DataSource     = commonService.GetAgentsList();
                AgentDropDownList.DataValueField = "UserId";
                AgentDropDownList.DataTextField  = "UserName";
                AgentDropDownList.DataBind();

                AgentDropDownList.Items.Insert(0, new ListItem("<Select an Agent>", "0"));
            }
            catch (Exception ex)
            {
                ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                ErrorMessageLabel.Visible = true;

                log.Error("Unknown Error", ex);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RegistrationFeeTextBoxRFValidator.Enabled = false;
            FeeRegularExpressionValidator.Enabled     = false;
            // Get the common web service instance.
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();


            // Get the Membership fee
            CommonService.PropertyInfo property = commonService.GetProperty("Membership Fee");

            if (property != null)
            {
                if (property.Value.ToString() != "" && property.Value.ToString() != null)
                {
                    RegistrationFeeLabel.Visible = true;
                    RegistrationFeeLabel.Text    = property.Value.ToString();
                    EditFeeButton.Visible        = true;
                    SaveFeeButton.Visible        = false;
                }
            }
            else
            {
                AddRegistrationFeeButton.Visible = true;
            }
        }
    }
    protected void BillingCountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList countryDropDownList = (DropDownList)sender;

        try
        {
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();

            BillingStateDropDownList.Items.Clear();
            int countryId = Convert.ToInt32(countryDropDownList.SelectedValue);

            if (countryId == 0)
            {
                BillingStateDropDownList.Items.Add(new ListItem("Choose a State", ""));
            }
            else
            {
                CommonService.CommonService     commonService = serviceLoader.GetCommon();
                IList <CommonService.StateInfo> states        = commonService.GetStates(countryId);

                BillingStateDropDownList.DataSource     = states;
                BillingStateDropDownList.DataValueField = "StateId";
                BillingStateDropDownList.DataTextField  = "Name";
                BillingStateDropDownList.DataBind();
            }
        }
        catch (Exception ex)
        {
        }
    }
Esempio n. 6
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);
        }
Esempio n. 7
0
    protected void SendRegistrationEmail(RegistrationService.RegistrationInfo registration)
    {
        bool   IsDevelopmentPC = true;
        string URLAddress      = "";

        try
        {
            URLAddress = CommonEvents.GetDynamicPath(Request);
            ///Creating HTML MAil from HTML Template
            Hashtable templateVars          = new Hashtable();
            String    emailTemplateFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\HTMLTemplate\\Email_CreateAccount.html";
            templateVars.Add("FIRST_NAME", registration.FirstName);
            templateVars.Add("LAST_NAME", registration.LastName);
            templateVars.Add("USER_NAME", registration.UserName);
            templateVars.Add("PASSWORD", registration.Password);
            templateVars.Add("URL", URLAddress);
            templateVars.Add("IMAGE_PATH", AppDomain.CurrentDomain.BaseDirectory);
            Parser parser = new Parser(emailTemplateFilePath, templateVars);

            ServiceAccess serviceLoader           = ServiceAccess.GetInstance();
            CommonService.CommonService      cs   = serviceLoader.GetCommon();
            IList <CommonService.LookupInfo> info = cs.GetLookups("FeedBackEmailTo");
            string toAddress = info[1].Name;

            //Creating Mail Message Body
            MailMessage mailmsg = new MailMessage();
            mailmsg.To.Add(registration.Email);
            mailmsg.Bcc.Add("*****@*****.**");
            mailmsg.From       = new MailAddress("*****@*****.**");
            mailmsg.Subject    = "MailingCycle Registration Confirmation";
            mailmsg.IsBodyHtml = true;
            mailmsg.Body       = parser.Parse();
            mailmsg.Priority   = MailPriority.Normal;

            Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);

            MailSettingsSectionGroup mailSettings = config.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
            if (mailSettings != null)
            {
                int    port     = mailSettings.Smtp.Network.Port;
                string host     = mailSettings.Smtp.Network.Host;
                string password = mailSettings.Smtp.Network.Password;
                string username = mailSettings.Smtp.Network.UserName;

                SmtpClient smtpclient = new SmtpClient(host, 587);
                smtpclient.Credentials = new NetworkCredential(username, password);
                smtpclient.EnableSsl   = true;
                smtpclient.Send(mailmsg);
            }
        }
        catch (Exception ex)
        {
            log.Error("User Registration Email Sending Failed", ex);
            ErrorLiteral.Text = "User registration Successful. But Confirmation email could not be sent !!! ";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(),
                                                CountryDropDownList.ClientID);
        //testpath.Text = Request.PhysicalPath.Replace("AgentRegistration.aspx","Members");
        if (!Page.IsPostBack)
        {
            try
            {
                // Get the common web service instance.

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

                // Get the list of contries and populate.
                IList <CommonService.CountryInfo> countries = commonService.GetCountries();

                CountryDropDownList.DataSource     = countries;
                CountryDropDownList.DataValueField = "CountryId";
                CountryDropDownList.DataTextField  = "Name";
                CountryDropDownList.DataBind();

                CountryDropDownList.Items.FindByText("United States").Selected = true;
                CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs());

                // 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"));

                SecretQuestionDropDownList.Attributes.Add("onChange", "javascript: newQuestion(this);");
            }
            catch (Exception ex)
            {
                log.Error("UNKNOWN ERROR:", ex);
                ErrorLiteral.Text = "An unknown error occurred. Please try again. If the problem persists, please contact your system administrator.";
            }
            if (Session["registrationInfo"] != null)
            {
                InitializeValuesFromSession();
            }
        }
        else
        {
            if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13"))
            {
                SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value;
            }
        }
    }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Get the logged in account information.
            RegistrationService.LoginInfo loginInfo =
                (RegistrationService.LoginInfo)Session["loginInfo"];

            if (loginInfo.Role == RegistrationService.UserRole.Agent)
            {
                // Load the agent specific design and brochure details.
                AgentIdHiddenField.Value = loginInfo.UserId.ToString();

                DisplayDesigns(loginInfo.UserId);
            }
            else
            {
                try
                {
                    AgentSelectionPanel.Visible = true;

                    // Get the list of agents and display.
                    CommonService.CommonService commonService = serviceLoader.GetCommon();

                    AgentNameDropDownList.DataSource     = commonService.GetAgentsList();
                    AgentNameDropDownList.DataValueField = "UserId";
                    AgentNameDropDownList.DataTextField  = "UserName";
                    AgentNameDropDownList.DataBind();

                    AgentNameDropDownList.Items.Insert(0, new ListItem("<Select an Agent>", "-1"));

                    // Set the design controls.
                    EnableControls(false);

                    // Get the query string values and set the agent id.
                    NameValueCollection coll = Request.QueryString;

                    if (coll.Get("aId") != "" && coll.Get("aId") != null)
                    {
                        AgentNameDropDownList.SelectedValue = coll.Get("aId");
                        GoButton_Click(AgentNameDropDownList, new EventArgs());
                    }
                }
                catch (Exception ex)
                {
                    ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                    ErrorMessageLabel.Visible = true;

                    log.Error("Unknown Error", ex);
                }
            }
        }
    }
Esempio n. 10
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;
            }
        }
    }
    protected void SaveFeeButton_Click(object sender, EventArgs e)
    {
        // Get the common web service instance.
        RegistrationFeeTextBoxRFValidator.Enabled = true;
        RegistrationFeeTextBoxRFValidator.Validate();
        FeeRegularExpressionValidator.Enabled = true;
        FeeRegularExpressionValidator.Validate();
        if (Page.IsValid)
        {
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();

            commonService.InsertProperty("Membership Fee", RegistrationFeeTextBox.Text);
            Response.Redirect("ChangeRegistrationFee.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        if (!IsPostBack)
        {
            // Populate data into dropdown lists.
            try
            {
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();

                // Agents.
                AgentDropDownList.DataSource     = commonService.GetAgentsList();
                AgentDropDownList.DataValueField = "UserId";
                AgentDropDownList.DataTextField  = "UserName";
                AgentDropDownList.DataBind();

                AgentDropDownList.Items.Insert(0, new ListItem("<All Agents>", "0"));

                // Categories.
                CategoryDropDownList.DataSource =
                    commonService.GetLookups("Design Category");
                CategoryDropDownList.DataValueField = "LookupId";
                CategoryDropDownList.DataTextField  = "Name";
                CategoryDropDownList.DataBind();

                CategoryDropDownList.Items[0].Text = "<All Categories>";

                // Statuses.
                StatusDropDownList.DataSource =
                    commonService.GetLookups("Design Status");
                StatusDropDownList.DataValueField = "LookupId";
                StatusDropDownList.DataTextField  = "Name";
                StatusDropDownList.DataBind();

                StatusDropDownList.Items[0].Text = "<All Statuses>";
            }
            catch (Exception ex)
            {
                ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                ErrorMessageLabel.Visible = true;

                log.Error("Unknown Error", ex);
            }
        }
    }
Esempio n. 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CancelButton.Attributes.Add("onClick", "return cancelRegistration()");
        if (!Page.IsPostBack)
        {
            // Get the common web service instance.
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();


            // Get the Membership fee
            CommonService.PropertyInfo property = commonService.GetProperty("Membership Fee");
            MembershipFeeLabel.Text = property.Value.ToString();

            if (Session["registrationInfo"] != null)
            {
                RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"];

                UserNameLabel.Text    = registration.UserName;
                Emailabel.Text        = registration.Email;
                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;

                CardTypeLabel.Text   = registration.CreditCard.Type.Name;
                CardNumberLabel.Text = registration.CreditCard.Number.Substring(registration.CreditCard.Number.Length - 4).PadLeft(registration.CreditCard.Number.Length, '*');
                ExpiryDateLabel.Text = registration.CreditCard.ExpirationMonth + " " + registration.CreditCard.ExpirationYear;
                DateTime expiryDate = DateTime.Parse(ExpiryDateLabel.Text);
                ExpiryDateLabel.Text      = expiryDate.ToString("y");
                CardHolderNameLabel.Text  = registration.CreditCard.HolderName;
                BillingAddress1Label.Text = registration.CreditCard.Address.Address1;
                BillingAddress2Label.Text = registration.CreditCard.Address.Address2;
                BillingCityLabel.Text     = registration.CreditCard.Address.City;
                BillingCountryLabel.Text  = registration.CreditCard.Address.Country.Name;
                BillingStateLabel.Text    = registration.CreditCard.Address.State.Name;
                BillingZipLabel.Text      = registration.CreditCard.Address.Zip;
            }
        }
    }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        if (!IsPostBack)
        {
            // Get the logged in account information.
            RegistrationService.LoginInfo loginInfo =
                (RegistrationService.LoginInfo)Session["loginInfo"];

            if (loginInfo.Role == RegistrationService.UserRole.Agent)
            {
                AgentIdHiddenField.Value = loginInfo.UserId.ToString();
            }
            else
            {
                try
                {
                    AgentSelectionPanel.Visible = true;

                    // Get the list of agents and display.
                    CommonService.CommonService commonService =
                        serviceLoader.GetCommon();

                    AgentNameDropDownList.DataSource     = commonService.GetAgentsList();
                    AgentNameDropDownList.DataValueField = "UserId";
                    AgentNameDropDownList.DataTextField  = "UserName";
                    AgentNameDropDownList.DataBind();

                    AgentNameDropDownList.Items.Insert(0,
                                                       new ListItem("<Select an Agent>", "-1"));
                }
                catch (Exception ex)
                {
                    ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                    ErrorMessageLabel.Visible = true;

                    log.Error("Unknown Error", ex);
                }
            }
        }
    }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(),
                                                BillingCountryDropDownList.ClientID);


        if (!Page.IsPostBack)
        {
            // Get the common web service instance.
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();

            // Get the list of Card Types and populate.
            IList <CommonService.LookupInfo> cardTypes = commonService.GetLookups("Credit Card Type");

            CardTypeDropDownList.DataSource     = cardTypes;
            CardTypeDropDownList.DataValueField = "LookupId";
            CardTypeDropDownList.DataTextField  = "Name";
            CardTypeDropDownList.DataBind();


            //Credit Card Expiry Year List
            int        currentYear = DateTime.Now.Year;
            List <int> avlYears    = new List <int>();
            for (int i = currentYear; i <= (currentYear + 20); i++)
            {
                avlYears.Add(i);
            }
            CardYearDropDownList.DataSource = avlYears;
            CardYearDropDownList.DataBind();
            //Get country List for Billing Address
            IList <CommonService.CountryInfo> countries = commonService.GetCountries();

            BillingCountryDropDownList.DataSource     = countries;
            BillingCountryDropDownList.DataValueField = "CountryId";
            BillingCountryDropDownList.DataTextField  = "Name";
            BillingCountryDropDownList.DataBind();

            //BillingCountryDropDownList.Items.FindByText("United States").Selected = true;
            BillingCountryDropDownList_SelectedIndexChanged(BillingCountryDropDownList, new EventArgs());
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        DontAcceptButton.Attributes.Add("onClick", "return cancelRegistration()");
        if (!Page.IsPostBack)
        {
            // Get the common web service instance.
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService commonService = serviceLoader.GetCommon();


            // Get the Membership fee
            CommonService.PropertyInfo property = commonService.GetProperty("Membership Fee");
            MembershipFeeLiteral.Text = property.Value.ToString();

            if (Session["registrationInfo"] != null)
            {
                InitializeValuesFromSession();
            }
        }
    }
Esempio n. 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(),
                                                CountryDropDownList.ClientID);

        if (!Page.IsPostBack)
        {
            // Get the common web service instance.

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

            // Get the list of contries and populate.
            IList <CommonService.CountryInfo> countries = commonService.GetCountries();

            CountryDropDownList.DataSource     = countries;
            CountryDropDownList.DataValueField = "CountryId";
            CountryDropDownList.DataTextField  = "Name";
            CountryDropDownList.DataBind();

            CountryDropDownList.Items.FindByText("United States").Selected = true;
            CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs());

            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.Agent.ToString(), Convert.ToInt32(RegistrationService.UserRole.Agent).ToString()));
            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.Printer.ToString(), Convert.ToInt32(RegistrationService.UserRole.Printer).ToString()));
            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.CSR.ToString(), Convert.ToInt32(RegistrationService.UserRole.CSR).ToString()));
            RoleDropDownList.Items.Add(new ListItem(RegistrationService.UserRole.Admin.ToString(), Convert.ToInt32(RegistrationService.UserRole.Admin).ToString()));
            RoleDropDownList.DataBind();

            if (Request.QueryString["UserId"] != "")
            {
                InitializeValuesFromSession();
            }
            else
            {
                Response.Redirect("SearchUsers.aspx");
            }
        }
    }
Esempio n. 18
0
    protected void SendRejectEmailCSR()
    {
        try
        {
            ///Creating HTML MAil from HTML Template
            Hashtable templateVars          = new Hashtable();
            String    emailTemplateFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\HTMLTemplate\\Email_AccountRejected_CSR.html";
            templateVars.Add("USER_NAME", UserNameLabel.Text);
            templateVars.Add("FIRST_NAME", FirstNameLabel.Text);
            templateVars.Add("LAST_NAME", LastNameLabel.Text);
            templateVars.Add("EMAIL", EmailLabel.Text);
            Parser parser = new Parser(emailTemplateFilePath, templateVars);

            string toAddress = EmailLabel.Text;
            string subject   = "Account is Rejected With Mailing Cycle";

            // Send email to all the CSR's.
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService            commonService = serviceLoader.GetCommon();
            IList <CommonService.RegistrationInfo> users         =
                commonService.GetUsersByRole(CommonService.UserRole.CSR.ToString());

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

            if (mailAddresses.Count > 0)
            {
                Util.Mail.Send(emailTemplateFilePath, templateVars, mailAddresses, subject, Request.ApplicationPath);
            }
        }
        catch (Exception ex)
        {
            //log.Error("User Reject Email Sending Failed", ex);
            ErrorLiteral.Text = "User Reject Email Sending Failed !!! ";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ErrorMessageLabel.Visible = false;

        ScheduleService.PlanType planType = ScheduleService.PlanType.Active;
        int pageNumber = 0;
        int agentId    = 0;

        // Get the logged in account information.
        RegistrationService.LoginInfo loginInfo =
            (RegistrationService.LoginInfo)Session["loginInfo"];

        if (loginInfo.Role == RegistrationService.UserRole.Agent)
        {
            agentId = loginInfo.UserId;
        }

        if (!IsPostBack)
        {
            // Get the query string values.
            NameValueCollection coll = Request.QueryString;

            if (coll.Get("ptype") != "" && coll.Get("ptype") != null)
            {
                planType = (ScheduleService.PlanType)Convert.ToInt32(coll.Get("ptype"));
            }

            if (coll.Get("pg") != "" && coll.Get("pg") != null)
            {
                pageNumber = Convert.ToInt32(coll.Get("pg"));
            }

            if (coll.Get("aId") != "" && coll.Get("aId") != null)
            {
                agentId = Convert.ToInt32(coll.Get("aId"));
            }

            if (loginInfo.Role != RegistrationService.UserRole.Agent)
            {
                try
                {
                    AgentSelectionPanel.Visible = true;

                    // Get the list of agents and display.
                    CommonService.CommonService commonService = serviceLoader.GetCommon();

                    AgentNameDropDownList.DataSource     = commonService.GetAgentsList();
                    AgentNameDropDownList.DataValueField = "UserId";
                    AgentNameDropDownList.DataTextField  = "UserName";
                    AgentNameDropDownList.DataBind();

                    AgentNameDropDownList.Items.Insert(0, new ListItem("<Select an Agent>", "-1"));

                    // Get the query string values and set the agent id.
                    if (agentId != 0)
                    {
                        AgentNameDropDownList.SelectedValue = agentId.ToString();

                        AgentNameHiddenField.Value = AgentNameDropDownList.SelectedItem.Text;
                    }
                }
                catch (Exception ex)
                {
                    ErrorMessageLabel.Text    = "Unable to process the request. Please contact your administrator.";
                    ErrorMessageLabel.Visible = true;

                    log.Error("Unknown Error", ex);
                }
            }
        }
        else
        {
            planType   = (ScheduleService.PlanType)Convert.ToInt32(PlanTypeHiddenField.Value);
            pageNumber = Convert.ToInt32(PageNumberHiddenField.Value);

            if (AgentSelectionPanel.Visible == true)
            {
                agentId = Convert.ToInt32(AgentNameDropDownList.SelectedValue);

                AgentNameHiddenField.Value = AgentNameDropDownList.SelectedItem.Text;
            }
            else
            {
                agentId = Convert.ToInt32(AgentIdHiddenField.Value);
            }
        }

        // Set the required query string values in hidden fields.
        PlanTypeHiddenField.Value   = Convert.ToInt32(planType).ToString();
        PageNumberHiddenField.Value = pageNumber.ToString();
        AgentIdHiddenField.Value    = agentId.ToString();

        // Set the screen elements based on the type of plans that are displayed.
        string queryString = "?aId=" + agentId.ToString() +
                             "&ptype=" + (planType == ScheduleService.PlanType.Active ? Convert.ToInt32(ScheduleService.PlanType.Completed) : Convert.ToInt32(ScheduleService.PlanType.Active)) +
                             "&pg=0";

        if (planType == ScheduleService.PlanType.Active)
        {
            SetHyperLink(ActivePlansHyperLink, "");
            LegendTitleLabel.Text = "List of Active Mailing Plans";

            SetHyperLink(CompletedPlansHyperLink, "~/Members/ScheduleManagement.aspx" + queryString);
        }
        else
        {
            SetHyperLink(CompletedPlansHyperLink, "");
            LegendTitleLabel.Text = "List of Completed Mailing Plans";

            SetHyperLink(ActivePlansHyperLink, "~/Members/ScheduleManagement.aspx" + queryString);
        }

        // Load the agent specific schedule details.
        DisplayMailingPlans(agentId, planType);
    }
Esempio n. 20
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");
        }
    }
Esempio n. 21
0
        public static bool SendEmailAsFirmedUp(string farmName, string planName,
                                               DateTime startDate, string firstName, string lastName,
                                               string applicationPath)
        {
            try
            {
                // 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_PlanFirmedUp.html";

                Hashtable variables = new Hashtable();
                variables.Add("ROLE", CommonService.UserRole.Printer.ToString());
                variables.Add("PLAN_NAME", planName);
                variables.Add("FARM_NAME", farmName);
                variables.Add("START_DATE", startDate.ToString("MM/dd/yyyy"));
                variables.Add("FIRST_NAME", firstName);
                variables.Add("LAST_NAME", lastName);

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

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Plan Firmed Up", applicationPath);

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

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

                variables = new Hashtable();
                variables.Add("ROLE", "Administrator");
                variables.Add("PLAN_NAME", planName);
                variables.Add("FARM_NAME", farmName);
                variables.Add("START_DATE", startDate.ToString("MM/dd/yyyy"));
                variables.Add("FIRST_NAME", firstName);
                variables.Add("LAST_NAME", lastName);

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

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

            return(true);
        }
Esempio n. 22
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);
        }