예제 #1
0
        static void Main(string[] args)
        {
            var _manager = new PigDealManager();
            var mailClient = new MailManager();

            var publicationParams = new Dictionary<string, string>();
            publicationParams.Add("#OutLetName#", "Steers");
            publicationParams.Add("#Username#", "*****@*****.**");
            publicationParams.Add("#Password#", "password");
           
            mailClient.SendPublication("*****@*****.**", publicationParams);


        }
예제 #2
0
        //Send Forgot Password
        public bool SendPasswordReminder(string outletEmail)
        {
            try
            {
                //Get outlet Information
                var outletQuery = (from allOutlets in _pigdealRepo.GetOutlets().Where(a => a.LoginEmail == outletEmail)
                                   select allOutlets).FirstOrDefault();

                if (outletQuery != null)
                {
                    if (ConfigurationManager.AppSettings["IsMailEnabled"] == "true")
                    {
                        //fire off email
                        var mailClient = new MailManager();
                        var publicationParams = new Dictionary<string, string>();
                        publicationParams.Add("#OutLetName#", outletQuery.OutletName);
                        publicationParams.Add("#Username#", outletQuery.LoginEmail);
                        publicationParams.Add("#Password#", outletQuery.Password);

                        mailClient.SendPublication(outletEmail, publicationParams);
                    }

                    return true;
                }
                else
                {
                    //Email Not Found
                    return false;
                }
            }
            catch (Exception)
            {

                throw;
            }

        }
예제 #3
0
        protected void CreateOutlet(object sender, EventArgs e)
        {
            // Check if Terms has been checked:
            if (cboxTerms.Checked == false)
            {

                validationMessage.Text = "<div ID='error'>You need to accept the terms in order to continue.</div>";
                return;
            }

            
                
            

            try
            {
                //Reset
                txbOutletName.Attributes.Add("Class", "removeValidation");
                txbOutletLoginEmail.Attributes.Add("Class", "removeValidation");
                validationMessage.Text = string.Empty;

                // Duplicate outlet name and email check
                if (_outletManager.IsOutletRegistered(txbOutletName.Text, txbOutletLoginEmail.Text))
                {
                    txbOutletName.Attributes.Add("Class", "validation");
                    txbOutletLoginEmail.Attributes.Add("Class", "validation");

                    validationMessage.Text = "<div ID='error'>The Outlet name and email address combination is already registered.</div>";

                    validationMessage.Visible = true;
                    txbOutletName.Focus();
                }

                else // Not duplicate so insert
                {
                    pnlRegisterOutlet.Visible = false;
                    var outletId = _outletManager.CreateOutlet(new OutletEntity
                    {
                        ContactNumber = txbOutletTelephone.Text,
                        ContactPerson = txbOutletContactPerson.Text,
                        Description = txbOutletDescription.Text,
                        LoginEmail = txbOutletLoginEmail.Text.ToLower(),
                        OutletName = txbOutletName.Text,
                        Password = txbOutletPassword1.Text,
                    });

                    regConfirmation.Text = "<div class='forms'><br/>Outlet successfully registered. Please click <a href='Login.aspx'>here</a> to login and verify your account.<br/></div>";
                    pnlBranches.Visible = false;

                    //** DEBUG - switch off mail untill setup.
                    if(ConfigurationManager.AppSettings["IsMailEnabled"] == "true")
                    {
                    //fire off email
                    var mailClient = new MailManager();
                    var publicationParams = new Dictionary<string, string>();
                    publicationParams.Add("#OutLetName#", txbOutletName.Text);
                    publicationParams.Add("#Username#", txbOutletLoginEmail.Text);
                    publicationParams.Add("#Password#", txbOutletPassword1.Text);

                    mailClient.SendPublication(txbOutletLoginEmail.Text, publicationParams);
                    }


                }


            }
            catch (Exception)
            {
                //LOG
                regConfirmation.Text = ConfigurationManager.AppSettings["SiteError"];
            }

            
            
          

        }