Example #1
0
        // GET: Admin/Shipper
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new ShipperDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
Example #2
0
        public List <Shippers> GetShipperList()
        {
            ShipperDao      SD    = new ShipperDao();
            DataSet         ds    = SD.GetDropDowmDataSet();
            List <Shippers> SList = ds.Tables[0].AsEnumerable().Select(m => new Shippers()
            {
                ShipperID   = m.Field <int>("ShipperID"),
                CompanyName = m.Field <String>("CompanyName"),
                Phone       = m.Field <String>("Phone")
            }).ToList();

            return(SList);
        }
Example #3
0
 public ActionResult Edit(Shipper Shipper)
 {
     if (ModelState.IsValid)
     {
         var dao    = new ShipperDao();
         var result = dao.Update(Shipper);
         if (result)
         {
             return(RedirectToAction("Index", "Shipper"));
         }
         else
         {
             ModelState.AddModelError("", "Modify Shipper successfully");
         }
     }
     return(View("Index"));
 }
Example #4
0
 public ActionResult Create(Shipper Shipper)
 {
     if (ModelState.IsValid)
     {
         var  dao = new ShipperDao();
         long id  = dao.Insert(Shipper);
         if (id > 0)
         {
             return(RedirectToAction("Index", "Shipper"));
         }
         else
         {
             ModelState.AddModelError("", "Add Shipper successfully");
         }
     }
     return(View("Index"));
 }
        public ShipperAM getShipper(int ShipperID = 0)
        {
            ShipperAM  oShipper = new ShipperAM();
            ShipperDao dao      = new ShipperDao();

            try
            {
                oShipper = dao.getShipper(ShipperID);
            }
            catch (Exception ex)
            {
                ErrMsgInfo oErr = new ErrMsgInfo();
                oErr.ex = ex;
                HttpResponseMessage RepMsg = oErr.RepMsg;
                throw new HttpResponseException(RepMsg);
            }
            return(oShipper);
        }
        public List <ShipperAM> getShippers()
        {
            List <ShipperAM> oShippers = new List <ShipperAM>();
            ShipperDao       dao       = new ShipperDao();

            try
            {
                oShippers = dao.getShipprs();
            }
            catch (Exception ex)
            {
                ErrMsgInfo oErr = new ErrMsgInfo();
                oErr.ex = ex;
                HttpResponseMessage RepMsg = oErr.RepMsg;
                throw new HttpResponseException(RepMsg);
            }
            return(oShippers);
        }
        public JsonRltInfo UpdateItem([FromBody] ShipperAM oShipper)
        {
            JsonRltInfo oRlt = new JsonRltInfo();
            ShipperDao  dao  = new ShipperDao();

            try
            {
                string rc = dao.ChgShipper(oShipper);
                if (rc == "Success")
                {
                    oRlt.rltCode = 0;
                    oRlt.rltMsg  = "更新成功";
                }
            }
            catch (Exception ex)
            {
                oRlt.rltCode = 417;
                oRlt.rltMsg  = ex.Message;
            }
            return(oRlt);
        }
        public JsonRltInfo DelItem(int ShipperID)
        {
            JsonRltInfo oRlt = new JsonRltInfo();
            ShipperDao  dao  = new ShipperDao();

            try
            {
                string rc = dao.DelShipper(ShipperID);
                if (rc == "Success")
                {
                    oRlt.rltCode = 0;
                    oRlt.rltMsg  = "刪除成功";
                }
            }
            catch (Exception ex)
            {
                oRlt.rltCode = 417;
                oRlt.rltMsg  = ex.Message;
            }
            return(oRlt);
        }
Example #9
0
        /// <summary>
        /// shipper 下拉式選單
        /// </summary>
        /// <returns></returns>
        public List <SelectListItem> GetShipper()
        {
            ShipperDao shipperDao = new ShipperDao();

            return(shipperDao.GetShipper());
        }