Пример #1
0
 protected void gvAdminList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         // get the categoryID of the clicked row
         int categoryID = Convert.ToInt32(e.CommandArgument);
         // Delete the record
         //BAL_BookAppointment.UpdateAppointment(categoryID.ToString(), "", "", "", "", "", "", "1", "delete", "");
         BAL_BookAppointment.UpdateAppointment(categoryID.ToString(), "1", "1", "1", "1", "1/1/1900", "1 PM", "1", "delete", "", 0);
         //FillGrid();
         Response.Redirect("appointmentlist.aspx");
     }
 }
Пример #2
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        string strAppointmentId = hdnAppointmentId.Value;
        string strCustomerName  = "";
        string phonenumber      = "";
        string emailaddress     = "0";
        string zipcode          = "";
        string carplate         = "";

        BAL_BookAppointment.UpdateAppointment(strAppointmentId, strCustomerName, phonenumber, emailaddress, zipcode, ddlChoosedate.SelectedItem.Text.ToString(), ddlAvailabletimeslot.SelectedItem.Text.ToString(), "0", carplate, "0", 0);

        lblMessage.Text = "Appointment Updated";

        FillGrid();

        this.mdlPopup.Show();
    }
Пример #3
0
    protected void btnBookanAppointment_click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            string strCustomerName = txtCustomerName.Text.Trim();
            string phonenumber     = txtPhone.Text.Trim();
            string emailaddress    = txtEmail.Text.Trim();
            string zipcode         = txtZipcode.Text.Trim();
            string carplate        = txtRegistration.Text.Trim();
            string carValuation    = lblCarValuation.Text.Trim();

            BAL_BookAppointment.UpdateAppointment("0", strCustomerName, phonenumber, emailaddress, zipcode, ddlChoosedate.SelectedItem.Text.ToString(), ddlAvailabletimeslot.SelectedItem.Text.ToString(), "0", carplate, carValuation, int.Parse(ddlBranchName.SelectedItem.Value));
            try { Utilities.RemoveFollowup(txtEmail.Text.Trim().ToLower()); }
            catch (Exception ex)
            {
            }

            lblError.Text = "Appointment booking succesfully";
        }
    }
Пример #4
0
    protected void hlCarButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            trError.Visible = false;

            if (Session["userdata"] != null)
            {
                string strCustomerName = Convert.ToString(Session["CustomerName"]);
                string phonenumber     = Convert.ToString(Session["Phonenumber"]);
                string emailaddress    = Convert.ToString(Session["EmailAddress"]);
                string zipcode         = Convert.ToString(Session["PostCode"]);
                string carplate        = Convert.ToString(Session["CarPlate"]);
                string carValuation    = Convert.ToString(Session["Valuation"]);
                //Response.Write("Customer Name" + strCustomerName + "<br> Phone number" + phonenumber + " <br> Email " + emailaddress + " <br> Zipcode" + zipcode + "<br> CarPlate" + carplate);

                BAL_BookAppointment.UpdateAppointment("0", strCustomerName, phonenumber, emailaddress, zipcode, ddlChoosedate.SelectedItem.Text.ToString(), ddlAvailabletimeslot.SelectedItem.Text.ToString(), "0", carplate, carValuation, int.Parse(ddlChooseBranch.SelectedItem.Value));

                Session["appdate"] = ddlChoosedate.SelectedItem.Text;
                Session["apptime"] = ddlAvailabletimeslot.SelectedItem.Text;

                /*email send code*/

                //Appointment Confirmation Email
                String strCustFileName = Server.MapPath("~/MailContent") + "\\appconfirmation.html";


                if (Session["branchname"] != null)
                {
                    if (Session["branchname"].ToString().ToLower().Trim() == "bridgend")
                    {
                        strCustFileName = Server.MapPath("~/MailContent") + "\\bridgend-appconfirmation.html";
                    }
                    else if (Session["branchname"].ToString().ToLower().Trim() == "bristol")
                    {
                        strCustFileName = Server.MapPath("~/MailContent") + "\\bristol-appconfirmation.html";
                    }
                    else if (Session["branchname"].ToString().ToLower().Trim() == "cardiff")
                    {
                        strCustFileName = Server.MapPath("~/MailContent") + "\\cardiff-appconfirmation.html";
                    }
                    else if (Session["branchname"].ToString().ToLower().Trim() == "swindon")
                    {
                        strCustFileName = Server.MapPath("~/MailContent") + "\\swindon-appconfirmation.html";
                    }
                }

                System.IO.StreamReader    srCustHTML = new System.IO.StreamReader(strCustFileName);
                System.Text.StringBuilder sbMessage  = new System.Text.StringBuilder(srCustHTML.ReadToEnd());
                srCustHTML.Close();
                sbMessage.Replace("@title", Convert.ToString(Session["saluation"]));
                sbMessage.Replace("@surname", Convert.ToString(Session["Lastname"]));
                sbMessage.Replace("@valuation", Convert.ToString(Session["CarValuation"]));
                sbMessage.Replace("@apptime", Convert.ToString(Session["apptime"]).Replace(" ", string.Empty));
                sbMessage.Replace("@appdate", Convert.ToString(Session["appdate"]));
                sbMessage.Replace("@branch", Convert.ToString(Session["branchname"]));
                sbMessage.Replace("@carnumber", Convert.ToString(Session["CarPlate"]));
                sbMessage.Replace("@registration", ((clsCarselection)(Session["userdata"])).Registration);
                sbMessage.Replace("@vehicle", ((clsCarselection)(Session["userdata"])).Model);
                sbMessage.Replace("@mileage", ((clsCarselection)(Session["userdata"])).cs2_CurrentMileage);
                sbMessage.Replace("@footerValue", BAL_CMS.GetDetailsByLinkName("Home Page Footer"));

                string brnchEmailAddress = string.Empty;
                string ccEmail           = string.Empty;

                switch (Session["branchname"].ToString().ToLower().Trim())
                {
                case "bridgend":
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["Bridgend_Phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["Bridgend_Address"].ToString());
                    brnchEmailAddress = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    ccEmail           = ConfigurationManager.AppSettings["Cardiff_Email"].ToString();
                    break;

                case "cardiff":
                    brnchEmailAddress = ConfigurationManager.AppSettings["Cardiff_Email"].ToString();
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["Cardiff_Phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["Cardiff_Address"].ToString());
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;

                case "swansea":
                    brnchEmailAddress = ConfigurationManager.AppSettings["Swansea_Email"].ToString();
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["Swansea_Phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["Swansea_Address"].ToString());
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;

                case "newport":
                    brnchEmailAddress = ConfigurationManager.AppSettings["Newport_Email"].ToString();
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["Newport_Phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["Newport_Address"].ToString());
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;

                case "bristol":
                    brnchEmailAddress = ConfigurationManager.AppSettings["Bristol_Email"].ToString();
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["Bristol_Phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["Bristol_Address"].ToString());
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;

                case "gloucester":
                    brnchEmailAddress = ConfigurationManager.AppSettings["gloucester_email"].ToString();
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["gloucester_phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["gloucester_address"].ToString());
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;

                case "swindon":
                    brnchEmailAddress = ConfigurationManager.AppSettings["swindon_email"].ToString();
                    sbMessage.Replace("@officenumber", ConfigurationManager.AppSettings["swindon_phone"].ToString());
                    sbMessage.Replace("@address", ConfigurationManager.AppSettings["swindon_address"].ToString());
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;

                default:
                    brnchEmailAddress = "";
                    sbMessage.Replace("@officenumber", "01452835619");
                    sbMessage.Replace("@address", "");
                    ccEmail = ConfigurationManager.AppSettings["adminEmailAddress"].ToString();
                    break;
                }

                log.Debug("Sending appointment emails");
                Utilities.SendMail(ConfigurationManager.AppSettings["adminEmailAddress"], brnchEmailAddress, "Appointment Confirmation Email " + ((clsCarselection)(Session["userdata"])).CarPlate, sbMessage.ToString(), ccEmail);
                //Utilities.SendMail("*****@*****.**", "*****@*****.**", "Appointment Confirmation Email " + ((clsCarselection)(Session["userdata"])).CarPlate, sbMessage.ToString());
                Utilities.SendMail(ConfigurationManager.AppSettings["adminEmailAddress"], Convert.ToString(Session["EmailAddress"]), "Appointment Confirmation Email " + ((clsCarselection)(Session["userdata"])).CarPlate, sbMessage.ToString(), string.Empty);

                /*email send code*/
                Utilities.RemoveFollowup(emailaddress);

                Response.Redirect("~/appointment_confirmation.aspx");

                lblError.Text = "Appointment booking succesfully";
            }
            else
            {
                trError.Visible = true;
                lblError.Text   = "Please contact your Administrator";
            }
        }
    }