Example #1
0
        protected void btnSendEmail_Click(object sender, EventArgs e)
        {
            int CustID;

            int.TryParse(drpCustID.SelectedValue, out CustID);
            DBcalls   db        = new DBcalls();
            DataTable datTable  = db.GetCustomerById(CustID);
            DataRow   row       = datTable.Rows[0];
            string    CustName  = row["CustName"].ToString();
            string    CustEmail = row["CustEmail"].ToString();

            spnTo.InnerText   = "TO: " + CustEmail;
            spnSubj.InnerText = "SUBJ: Thank you";
            spnBody.InnerText = "BODY: Hello " + CustName + ", thank you for using Energy Simply.";

            var apiKey           = "";
            var client           = new SendGridClient(apiKey);
            var from             = new EmailAddress(CustEmail, CustName);
            var subject          = "Thank you";
            var to               = new EmailAddress(CustEmail, CustName);
            var plainTextContent = "Hello " + CustName + ", thank you for using Energy Simply.";
            var htmlContent      = "Hello " + CustName + ", thank you for using Energy Simply.";
            var msg              = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
            var response         = client.SendEmailAsync(msg);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBcalls   db       = new DBcalls();
            DataTable datTable = db.ListCustomersAndPlans();

            ListCustomersAndPlans.DataSource = datTable;
            ListCustomersAndPlans.DataBind();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBcalls   db       = new DBcalls();
            DataTable datTable = db.GetPlans();

            drpCustPlanID.DataSource     = datTable;
            drpCustPlanID.DataTextField  = "PlanName";
            drpCustPlanID.DataValueField = "PlanID";
            drpCustPlanID.DataBind();
            drpCustPlanID.Items.Insert(0, new ListItem(String.Empty, String.Empty));
            drpCustPlanID.SelectedIndex = 0;
        }
Example #4
0
        protected void btnAddCustomer_Click(object sender, EventArgs e)
        {
            int CustID;

            int.TryParse(txtCustID.Value, out CustID);
            string CustName  = txtCustName.Value;
            string CustEmail = txtCustEmail.Value;
            int    CustPlanID;

            int.TryParse(drpCustPlanID.SelectedValue, out CustPlanID);
            DBcalls db = new DBcalls();

            db.AddCustomer(CustID, CustName, CustEmail, CustPlanID);
        }
Example #5
0
        protected void btnAddPlan_Click(object sender, EventArgs e)
        {
            int PlanID;

            int.TryParse(txtPlanID.Value, out PlanID);
            string  PlanName = txtPlanName.Value;
            decimal PlanFixedCost;

            decimal.TryParse(txtPlanFixedCost.Value, out PlanFixedCost);
            decimal PlanVarCost;

            decimal.TryParse(txtPlanVarCost.Value, out PlanVarCost);
            DBcalls db = new DBcalls();

            db.AddPlan(PlanID, PlanName, PlanFixedCost, PlanVarCost);
        }
Example #6
0
        protected void btnPreview_Click(object sender, EventArgs e)
        {
            int CustID;

            int.TryParse(drpCustID.SelectedValue, out CustID);
            if (CustID > 0)
            {
                DBcalls   db        = new DBcalls();
                DataTable datTable  = db.GetCustomerById(CustID);
                DataRow   row       = datTable.Rows[0];
                string    CustName  = row["CustName"].ToString();
                string    CustEmail = row["CustEmail"].ToString();
                spnTo.InnerText   = "TO: " + CustEmail;
                spnSubj.InnerText = "SUBJ: Thank you";
                spnBody.InnerText = "BODY: Hello " + CustName + ", thank you for using Energy Simply.";
            }
            else
            {
                spnTo.InnerText   = "TO: ";
                spnSubj.InnerText = "SUBJ: ";
                spnBody.InnerText = "BODY: ";
            }
        }