protected void BtnCancelCheckout_Click(object sender, EventArgs e)
        {
            CustomerVehicleInfo    vi = (CustomerVehicleInfo)Session["VehicleInfo"];
            List <VehicleFeatures> vf = (List <VehicleFeatures>)Session["VehicleFeatures"];
            Financial fin             = (Financial)Session["FinancialInfo"];

            //Delete all entries
            bool vehicleDelete   = CustomerVehicleInfo.Delete(vi.Id);
            bool featuresDelete  = VehicleFeatures.DeleteVehicleFeatures(vi.Id);
            bool financialDelete = Financial.DeleteRecord(fin.Id, vi.Id);

            ClearSession();
            Response.Redirect("~/Account/myaccount.aspx");
        }
Beispiel #2
0
        protected void GvMyVehicles_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Page")
            {
                return;
            }
            string[] args      = e.CommandArgument.ToString().Split(',');
            int      VehicleId = Convert.ToInt32(args[0]);
            int      FinId     = Convert.ToInt32(args[1]);

            switch (e.CommandName)
            {
            case "Edit":
                Response.Redirect("viewmycarad.aspx?id=" + e.CommandArgument);
                break;

            case "Remove":
                VehicleImage imgs = VehicleImage.SelectByVehicleId(VehicleId);
                if (imgs != null)
                {
                    if (Directory.Exists(Server.MapPath(imgs.ImgPath)))
                    {
                        Directory.Delete(Server.MapPath(imgs.ImgPath));
                    }
                }
                if (CustomerVehicleInfo.Delete(VehicleId))
                {
                    GvMyVehicles.DataBind();
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", "alert('Your vehicle #" + e.CommandArgument + " has been deleted.');", true);
                }

                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", "alert('Failed deleteing vehicle #" + e.CommandArgument + ".');", true);
                }
                break;

            case "Sold":
                ChangeStatus(FinId, VehicleId, "Sold");
                break;

            case "SoldButMore":
                ChangeStatus(FinId, VehicleId, "Sold but more");
                break;

            default:
                break;
            }
        }