コード例 #1
0
        protected void BtnApprove_Click(object sender, EventArgs e)
        {
            string[] args      = Request.QueryString["id"].Split(',');
            int      VehicleId = Convert.ToInt32(args[0]);
            int      FinId     = Convert.ToInt32(args[1]);

            if (CustomerVehicleInfo.SetApprovedStatus(VehicleId, FinId, true))
            {
                Financial.ChangeAdStatus(FinId, VehicleId, true);
                NotifyCustomer(Convert.ToInt32(Session["Seller"].ToString()), VehicleId, FinId);
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", "alert('The vehicle posting #" + Request.QueryString["id"] + " has been approved.');", true);
                Response.Redirect("~/admin/vehicles.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", "alert('Failed activating vehicle #" + Request.QueryString["id"] + ".');", true);
            }
        }
コード例 #2
0
        protected void GvVehicles_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]);

            //string declined = args[2];

            switch (e.CommandName)
            {
            case "Activate":
                Response.Redirect("~/admin/reviewvehicle.aspx?id=" + e.CommandArgument);
                break;

            case "Deactivate":
                if (CustomerVehicleInfo.SetApprovedStatus(VehicleId, FinId, false))
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", "alert('The ad #" + VehicleId + " has been deactivated.');", true);
                    GvVehicles.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", "alert('Failed deleteing ad #" + VehicleId + ".');", true);
                }
                break;

            case "Repost":
                lblVehicleId.Text = e.CommandArgument.ToString();

                CustomerVehicleInfo cvi = CustomerVehicleInfo.GetCustomerVehicleInfoDetails(VehicleId, FinId, false);
                Financial           f   = Financial.GetFinancialDetailsByVehicleId(VehicleId, FinId);

                int[]  cars          = { 22, 23, 26, 27, 30, 34, 35, 38 };
                int[]  suvs          = { 25, 32, 36 };
                int[]  trucks        = { 24, 28, 37 };
                string selectedVtype = string.Empty;

                if (cars.Contains(cvi.VehicleCategoryId))
                {
                    selectedVtype = "22";
                }
                else if (suvs.Contains(cvi.VehicleCategoryId))
                {
                    selectedVtype = "25";
                }
                else if (trucks.Contains(cvi.VehicleCategoryId))
                {
                    selectedVtype = "24";
                }

                BindModelDdl(cvi.Manufacturer, cvi.Model, cvi.OtherModel);
                rblVehicleType.SelectedValue = selectedVtype;
                ddlYear.SelectedValue        = cvi.ModelYear.ToString();
                DdlMakes.SelectedValue       = cvi.Manufacturer;
                if (cvi.Manufacturer.Equals("Other"))
                {
                    TxtMakeOther.Enabled = true;
                    TxtMakeOther.Visible = true;
                    TxtMakeOther.Text    = cvi.OtherMake;
                }
                DdlModel.SelectedValue = cvi.Model;
                if (cvi.Model == "Other")
                {
                    TxtModelOther.Enabled = true;
                    TxtModelOther.Visible = true;
                    TxtModelTrim.Visible  = true;
                    TxtModelTrim.Enabled  = true;
                    TxtModelTrim.Text     = cvi.OtherTrim;
                    DdlTrim.Enabled       = false;
                    DdlTrim.Visible       = false;
                }
                else
                {
                    TxtModelTrim.Visible = false;
                    TxtModelTrim.Enabled = false;
                    DdlTrim.Enabled      = true;
                    DdlTrim.Visible      = true;
                    BindTrim(cvi.Manufacturer, cvi.Model, cvi.ModelTrim.ToString());
                    DdlTrim.SelectedValue = cvi.ModelTrim.ToString();
                }
                txtPurchasePrice.Text     = f.PurchasePrice.ToString();
                ddlPayCycle.SelectedValue = f.PaymentCycle;
                txtMonthlyWithTax.Text    = f.PaymentWithTax.ToString();
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Info", " $('#myModal').modal('show');", true);
                break;

            default:
                break;
            }
        }