예제 #1
0
 public VehicleTypeForm(VehicleType vehicleType)
 {
     _vehicleTypeService = new VehicleTypeBLL();
     InitializeComponent();
     this.vehicleType = vehicleType;
     PopulateForm();
 }
예제 #2
0
        public ActionResult Edit(VehicleTypeList model)
        {
            SetActiveMenuItem();
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                //Set our updater name
                var FullName = Request.Cookies["userInfo"]["FullName"];

                //Now update the record
                VehicleTypeBLL.UpdateVehicleType(model, FullName);

                //Take our ID with us to the confirmation form
                ViewBag.Id = model.Id;

                //Determine the kind of SQL transaction we have performed
                ViewBag.Message = "updated";

                //We can now safely go to the confirmation view
                return(View("AddUpdateConfirm"));
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(Redirect("~/Admin/Home/Error"));
            }
        }
예제 #3
0
        public ActionResult Create(VehicleTypeList model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            try
            {
                //Set our initial return value
                var returnValue = 0;
                //Set our updater name
                var FullName = Request.Cookies["userInfo"]["FullName"];
                //Attempt to add our record
                VehicleTypeBLL.AddVehicleType(model, FullName, out returnValue);

                //Take our ID with us to the confirmation form
                ViewBag.Id = returnValue;

                //Determine the kind of SQL transaction we have performed
                ViewBag.Message = "added";

                //We can now safely go to the confirmation view
                return(View("AddUpdateConfirm"));
            }
            catch (Exception ex)
            {
                TempData["ErrorMessage"] = ex.Message;
                return(Redirect("~/Admin/Home/Error"));
            }
        }
예제 #4
0
        public VehicleForm()
        {
            _vehicleService = new VehicleBLL();
            InitializeComponent();
            vehicleTypeBll = new VehicleTypeBLL();
            stationBll     = new StationBLL();

            vehicleTypes = vehicleTypeBll.GetAll();
            stations     = stationBll.GetAll();

            cmbVehicleTypeId.DataSource = vehicleTypes;
            cmbStationId.DataSource     = stations;
        }
예제 #5
0
 // GET: /Admin/VehicleType/Edit
 public ActionResult Edit(int id)
 {
     SetActiveMenuItem();
     try
     {
         var model = VehicleTypeBLL.GetVehicleType(id);
         return(View(model: model));
     }
     catch (Exception ex)
     {
         TempData["ErrorMessage"] = ex.Message;
         return(Redirect("~/Admin/Home/Error"));
     }
 }
        public StationResponseForm()
        {
            _stationResponseService = new StationResponseBLL();
            InitializeComponent();
            responseBll    = new ResponseBLL();
            stationBLL     = new StationBLL();
            vehicleTypeBLL = new VehicleTypeBLL();

            responses    = responseBll.GetAll();
            stations     = stationBLL.GetAll();
            vehicleTypes = vehicleTypeBLL.GetAll();

            cmbResponseId.DataSource    = responses;
            cmbStationId.DataSource     = stations;
            cmbVehicleTypeId.DataSource = vehicleTypes;
        }
예제 #7
0
 public VehicleTypeListForm()
 {
     _vehicleTypeService = new VehicleTypeBLL();
     InitializeComponent();
 }