public void lbDelete_Click(Object sender, EventArgs e)
        {
            DeleteAccess();
            var userInSession = (Users)Session["userinsession"];

            BackLink = DriversHelper.BackDriverLinkBuilder(stbDID.Text, stbPhone.Text, sddlStatus.SelectedValue, stbFirstName.Text);
            var lb      = (LinkButton)sender;
            var drivers = new Drivers();

            drivers.Delete(Convert.ToInt32(lb.CommandArgument), userInSession.ID, OtherMethods.GetIPAddress(), "DriversView");
            Page.Response.Redirect("~/ManagerUI/Menu/Souls/DriversView.aspx?" + BackLink);
        }
Beispiel #2
0
        public void lbDelete_Click(Object sender, EventArgs e)
        {
            DeleteAccess();
            var userInSession = (Users)Session["userinsession"];

            BackLink = CarsHelper.BackCarLinkBuilder(stbAID.Text, stbModel.Text, stbNumber.Text, sddlType.SelectedValue);
            var lb     = (LinkButton)sender;
            var driver = new Drivers {
                CarID = Convert.ToInt32(lb.CommandArgument)
            };
            var ds = driver.GetAllItems("ID", "ASC", "CarID");

            if (ds.Tables[0].Rows.Count > 0)
            {
                lblError.Text =
                    "К автомобилю привязаны водители. Перед удалением отвяжите всех водителей от удаляемого автомобиля.";
                return;
            }
            var car = new Cars();

            car.Delete(Convert.ToInt32(lb.CommandArgument), userInSession.ID, OtherMethods.GetIPAddress(), "CarsView");
            Page.Response.Redirect("~/ManagerUI/Menu/Souls/CarsView.aspx?" + BackLink);
        }