コード例 #1
0
 public void Initialise(System.Web.UI.Page p)
 {
     _page = p;
     if (p.IsPostBack)
     {
         return;
     }
     if (_page.Session["IFleetOverviewController"] != null)
     {
         repopulateFilters();
     }
     else
     {
         ThreeCascadeModel.bind();
         OwnCountryModel.bind();
         CarSegmentModel.clear();
         CarClassModel.clear();
         CarGroupModel.clear();
         VehiclePredicamentModel.bind();
         VehiclePredicamentModel.SelectedIndex = 3;
         if (_page.Session["IForeignNonRevenueController"] != null)
         {
             fromNonRev();
         }
     }
     OperstatModel.bind();
     MoveTypeModel.bind();
     NonRevDaysModel.FirstItem = "";
     NonRevDaysModel.bind();
     PagerMaxModel.bind();
     UpdateView();
 }
コード例 #2
0
        private bool UpdateCarClass(CarClassModel carClass)
        {
            CarClass databaseCarClass = new CarClassCollection().Get(carClass.Id);

            databaseCarClass.SetName(carClass.Name);

            return(databaseCarClass.Update());
        }
コード例 #3
0
        private bool CreateCarClass(CarClassModel carClass)
        {
            CarClass carClassObject = new CarClass()
            {
                Name = carClass.Name
            };

            return(new CarClassCollection().Create(carClassObject));
        }
コード例 #4
0
        private CarClassModel GetCarClass(int carClassId)
        {
            CarClass      databaseCarClass = new CarClassCollection().Get(carClassId);
            CarClassModel carClass         = new CarClassModel()
            {
                Id   = databaseCarClass.Id,
                Name = databaseCarClass.Name
            };

            return(carClass);
        }
コード例 #5
0
 void setFeedback()
 {
     ThreeCascadeModel.DueCountryModel.SetFeedback();
     ThreeCascadeModel.PoolModel.SetFeedback();
     ThreeCascadeModel.LocationGroupModel.SetFeedback();
     OwnCountryModel.SetFeedback();
     CarSegmentModel.SetFeedback();
     CarClassModel.SetFeedback();
     CarGroupModel.SetFeedback();
     VehiclePredicamentModel.SetFeedback();
 }
コード例 #6
0
        private void repopulateFilters()
        {
            IFleetOverviewController foc = (IFleetOverviewController)_page.Session["IFleetOverviewController"];

            ThreeCascadeModel.rebind(foc.ThreeCascadeModel.DueCountryModel.SelectedIndex, foc.ThreeCascadeModel.PoolModel.SelectedIndex, foc.ThreeCascadeModel.LocationGroupModel.SelectedIndex, foc.ThreeCascadeModel.DueCountryModel.SelectedValue, foc.ThreeCascadeModel.PoolModel.SelectedValue);
            OwnCountryModel.rebind(foc.OwnCountryModel.SelectedIndex);
            CarSegmentModel.rebind(foc.CarSegmentModel.SelectedIndex, OwnCountryModel.SelectedValue);
            CarClassModel.rebind(foc.CarClassModel.SelectedIndex, OwnCountryModel.SelectedValue, CarSegmentModel.SelectedValue);
            CarGroupModel.rebind(foc.CarClassModel.SelectedIndex, OwnCountryModel.SelectedValue, CarSegmentModel.SelectedValue, CarClassModel.SelectedValue);
            VehiclePredicamentModel.rebind(foc.VehiclePredicamentModel.SelectedIndex);
            //_page.Session["IFleetOverviewController"] = null;
        }
コード例 #7
0
 public IActionResult Create(CarClassModel carClass)
 {
     if (CreateCarClass(carClass))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         TempData.Add("Alert", "Something went wrong uploading data to the server");
         return(View());
     }
 }
コード例 #8
0
 public IActionResult Delete(CarClassModel carClass)
 {
     if (DeleteCarClass(carClass.Id))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         TempData.Add("Alert", "Something went wrong deleting data from the server");
         return(View(carClass));
     }
 }
コード例 #9
0
 public void CarSegmentSelected()
 {
     if (CarSegmentModel.SelectedIndex <= 0)
     {
         CarClassModel.clear();
     }
     else
     {
         CarClassModel.bind(OwnCountryModel.SelectedValue, CarSegmentModel.SelectedValue);
     }
     CarGroupModel.clear();
     UpdateView();
 }
コード例 #10
0
 void setFeedback()
 {
     OperstatModel.SetFeedback();
     MoveTypeModel.SetFeedback();
     VehiclePredicamentModel.SetFeedback();
     NonRevDaysModel.SetFeedback();
     ThreeCascadeModel.DueCountryModel.SetFeedback();
     ThreeCascadeModel.PoolModel.SetFeedback();
     ThreeCascadeModel.LocationGroupModel.SetFeedback();
     OwnCountryModel.SetFeedback();
     CarSegmentModel.SetFeedback();
     CarClassModel.SetFeedback();
     CarGroupModel.SetFeedback();
 }
コード例 #11
0
 public void Initialise(System.Web.UI.Page p)
 {
     _page = p;
     if (p.IsPostBack)
     {
         checkPostback(); return;
     }
     ThreeCascadeModel.bind();
     OwnCountryModel.bind();
     CarSegmentModel.clear();
     CarClassModel.clear();
     CarGroupModel.clear();
     VehiclePredicamentModel.bind();
     VehiclePredicamentModel.SelectedIndex = 3;
     UpdateView();
 }
コード例 #12
0
 public IActionResult AddCarClass([FromBody] CarClassModel model)
 {
     try {
         if (model == null)
         {
             return(BadRequest("Body content is not valid!"));
         }
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         var entity = model.Map <CarClassEntity>();
         entity = _carClassLogic.AddCarClass(entity);
         if (entity == null)
         {
             throw new Exception("Somthing went wrong while adding model to DB!");
         }
         return(Ok(entity));
     } catch (Exception e) {
         return(StatusCode(500, e));
     }
 }