Пример #1
0
 public bool DeleteTransporter(Transporter transporter)
 {
     if (transporter == null) return false;
     _unitOfWork.TransporterRepository.Delete(transporter);
     _unitOfWork.Save();
     return true;
 }
Пример #2
0
 public ActionResult Create(Transporter transporter)
 {
     if (!ModelState.IsValid)
     {
         transportService.AddTransporter(transporter);
     }
     //return RedirectToAction("Edit");
     //return View(transporter);
     return RedirectToAction("Index");
 }
Пример #3
0
 public bool EditTransporter(Transporter transporter)
 {
     _unitOfWork.TransporterRepository.Edit(transporter);
     _unitOfWork.Save();
     return true;
 }
Пример #4
0
 public bool AddTransporter(Transporter transporter)
 {
     _unitOfWork.TransporterRepository.Add(transporter);
     _unitOfWork.Save();
     return true;
 }
Пример #5
0
        public TransporterPOCO ToPOCO(Transporter tm)
        {
            TransporterPOCO transporterPoco = new TransporterPOCO();
            transporterPoco.TransporterID = tm.TransporterID;
            transporterPoco.Name = tm.Name;
            /*
            transporterPoco.Region = _adminUnitService.FindById(tm.Region).Name;
            transporterPoco.Zone = _adminUnitService.FindById(tm.Zone).Name;
            transporterPoco.Woreda = _adminUnitService.FindById(tm.Woreda).Name;
            */
            transporterPoco.Region = tm.Region.ToString();
            transporterPoco.Zone = tm.Zone.ToString();
            transporterPoco.Woreda = tm.Woreda.ToString();

            transporterPoco.SubCity = tm.SubCity;
            transporterPoco.Kebele = tm.Kebele;
            transporterPoco.HouseNo = tm.HouseNo;
            transporterPoco.TelephoneNo = tm.TelephoneNo;
            transporterPoco.MobileNo = tm.MobileNo;
            transporterPoco.Ownership = tm.Ownership;
            transporterPoco.VehicleCount = tm.VehicleCount;
            transporterPoco.LiftCapacityFrom = tm.LiftCapacityFrom;
            transporterPoco.Capital = tm.Capital;
            transporterPoco.EmployeeCountMale = tm.EmployeeCountMale;
            transporterPoco.EmployeeCountFemale = tm.EmployeeCountFemale;
            transporterPoco.OwnerName = tm.OwnerName;
            transporterPoco.OwnerMobile = tm.OwnerMobile;
            transporterPoco.ManagerName = tm.ManagerName;
            transporterPoco.ManagerMobile = tm.ManagerMobile;
            transporterPoco.OwnedByDRMFSS = tm.OwnedByDRMFSS;
            //TransporterPOCO tp= new TransporterPOCO{
            //                                        TransporterID=tm.TransporterID,
            //                                        Name=tm.Name,
            //                                        Region= _adminUnitService.FindById(tm.Region).Name,
            //                                        Zone=_adminUnitService.FindById(tm.Zone).Name,
            //                                        Woreda=_adminUnitService.FindById(tm.Woreda).Name,
            //                                        SubCity = tm.SubCity,
            //                                        Kebele=tm.Kebele,
            //                                        HouseNo=tm.HouseNo,
            //                                        TelephoneNo=tm.TelephoneNo,
            //                                        MobileNo = tm.MobileNo,
            //                                        Ownership=tm.Ownership,VehicleCount=tm.VehicleCount,LiftCapacityFrom=tm.LiftCapacityFrom,
            //                                        Capital=tm.Capital, EmployeeCountMale=tm.EmployeeCountMale,EmployeeCountFemale=tm.EmployeeCountFemale,
            //                                        OwnerName=tm.OwnerName, OwnerMobile=tm.OwnerMobile  ,ManagerName=tm.ManagerName,
            //                                        ManagerMobile=tm.ManagerMobile
            //                                        //, ExperienceFrom=tm.ExperienceFrom  ,ExperienceTo=tm.ExperienceTo
            //                                        };
            return transporterPoco;
        }
Пример #6
0
        public ActionResult EditPartial(int id = 0)
        {
            ViewBag.Regions = _adminUnitService.FindBy(t => t.AdminUnitTypeID == 2);
            //ViewBag.Regions = new SelectList(_adminUnitService.FindBy(t => t.AdminUnitTypeID == 2), "AdminUnitID", "Name");
            Transporter transporter;
            if (id == 0)
            {
                transporter = new Transporter();
            }
            else
            {
                transporter = transportService.FindById(id);
            }
            if (transporter == null)
            {
                return HttpNotFound();
            }

            return View(transporter);
        }
Пример #7
0
        public ActionResult EditPartial(Transporter transporter)
        {
            // return Json(new[] { item }.ToDataSourceResult(request, ModelState));

            if (ModelState.IsValid)
            {
                if (transporter.TransporterID == 0)
                {
                    transportService.AddTransporter(transporter);
                }
                else
                {
                    transportService.EditTransporter(transporter);
                }
                return Json("{}", JsonRequestBehavior.AllowGet);
            }
            return View(transporter);
        }
Пример #8
0
 public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, Transporter transporter)
 {
     transportService.EditTransporter(transporter);
     return Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet);
 }
Пример #9
0
        public ActionResult EditingInline_Destroy([DataSourceRequest] DataSourceRequest request, Transporter transporter)
        {
            if (transporter != null)
            {
                transportService.DeleteById(transporter.TransporterID);
                transportService.DeleteTransporter(transporter);
            }

            return Json(ModelState.ToDataSourceResult());
        }
Пример #10
0
        public ActionResult EditingInline_Create([DataSourceRequest] DataSourceRequest request, Transporter transporter)
        {
            if (transporter != null && ModelState.IsValid)
            {
                transportService.AddTransporter(transporter);
            }

            return Json(new[] { transporter }.ToDataSourceResult(request, ModelState));
        }
Пример #11
0
        public ActionResult Edit(Transporter transporter, string strExperienceFrom, string strExperienceTo)
        {
            DateTime ExperienceFrom;
            DateTime ExperienceTo;

            /*  try
                {
                    ExperienceFrom = DateTime.Parse(strExperienceFrom);
                    ExperienceTo = DateTime.Parse(strExperienceTo);
                    //OpeningDate = DateTime.Parse(Opening);
                }
                catch (Exception)
                {
                    getGregorianDate EthData = new getGregorianDate();
                    ExperienceFrom = EthData.ReturnGregorianDate(strExperienceFrom);
                    ExperienceTo = EthData.ReturnGregorianDate(strExperienceTo);
                }*/
            if (ModelState.IsValid)
            {
                if (transporter.TransporterID == 0)
                {
                    transportService.AddTransporter(transporter);
                }
                else
                {
                    //   transporter.ExperienceFrom = ExperienceFrom;
                    //   transporter.ExperienceTo = ExperienceTo;
                    transportService.EditTransporter(transporter);
                }
                return RedirectToAction("Index");
            }
            return View(transporter);
        }
Пример #12
0
 //
 // GET: /Procurement/Default1/Edit/5
 public ActionResult Edit(int id = 0, int ispartial = 0)
 {
     Transporter transporter;
     if (id == 0)
     {
         transporter = new Transporter();
     }
     else
     {
         ViewBag.Regions = _adminUnitService.FindBy(t => t.AdminUnitTypeID == 2);
         transporter = transportService.FindById(id);
         //ViewBag.Regions = new SelectList(_adminUnitService.FindBy(t => t.AdminUnitTypeID == 2), "AdminUnitID", "Name");
         //ViewBag.zones = new SelectList(_adminUnitService.FindBy(z => z.AdminUnitTypeID == 3 && z.ParentID == transporter.Region), "AdminUnitID", "Name");
         //ViewBag.woredas = new SelectList(_adminUnitService.FindBy(w => w.AdminUnitTypeID == 4 && w.ParentID == transporter.Zone), "AdminUnitID", "Name");
     }
     if (transporter == null)
     {
         return HttpNotFound();
     }
     if (ispartial == 1)
     {
         return RedirectToAction("EditPartial/" + id);
     }
     return View(transporter);
 }