コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tID"></param>
        /// <returns></returns>
        public ActionResult GetTaskDetailByID(int ID)
        {
            ImplementTask itask = new CWTask().Find(tsk => tsk.ID == ID);
            DisplayITask  dtask = new DisplayITask();

            if (itask != null)
            {
                dtask = new DisplayITask
                {
                    ID               = itask.ID,
                    Warehouse        = itask.Warehouse,
                    DeviceCode       = itask.DeviceCode,
                    Type             = PlusCvt.ConvertTaskType(itask.Type),
                    Status           = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail),
                    SendStatusDetail = PlusCvt.ConvertSendStateDetail(itask.SendStatusDetail),
                    CreateDate       = itask.CreateDate.ToString(),
                    SendDtime        = itask.SendDtime.ToString(),
                    HallCode         = itask.HallCode,
                    FromLctAddress   = itask.FromLctAddress,
                    ToLctAddress     = itask.ToLctAddress,
                    ICCardCode       = itask.ICCardCode,
                    Distance         = itask.Distance,
                    CarSize          = itask.CarSize,
                    CarWeight        = itask.CarWeight
                };
            }
            return(Json(dtask, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult GetTaskList(int?pageSize, int?pageIndex, string sortOrder, string sortName)
        {
            Page <ImplementTask> page = new Page <ImplementTask>();

            if (pageSize != null)
            {
                page.PageSize = (int)pageSize;
            }
            if (pageIndex != null)
            {
                page.PageIndex = (int)pageIndex;
            }
            OrderParam orderParam = null;

            if (!string.IsNullOrEmpty(sortName))
            {
                orderParam = new OrderParam();
                orderParam.PropertyName = sortName;
                if (!string.IsNullOrEmpty(sortOrder))
                {
                    orderParam.Method = sortOrder.ToLower() == "asc" ? OrderMethod.Asc : OrderMethod.Desc;
                }
                else
                {
                    orderParam.Method = OrderMethod.Asc;
                }
            }
            Page <ImplementTask> pageTask = new CWTask().FindPageList(page, orderParam);

            List <DisplayITask> dispTaskLst = new List <DisplayITask>();

            foreach (ImplementTask itask in pageTask.ItemLists)
            {
                DisplayITask dtask = new DisplayITask
                {
                    ID               = itask.ID,
                    Warehouse        = itask.Warehouse,
                    DeviceCode       = itask.DeviceCode,
                    Type             = PlusCvt.ConvertTaskType(itask.Type),
                    Status           = PlusCvt.ConvertTaskStatus(itask.Status, itask.SendStatusDetail),
                    SendStatusDetail = PlusCvt.ConvertSendStateDetail(itask.SendStatusDetail),
                    CreateDate       = itask.CreateDate.ToString(),
                    SendDtime        = itask.SendDtime.ToString(),
                    HallCode         = itask.HallCode,
                    FromLctAddress   = itask.FromLctAddress,
                    ToLctAddress     = itask.ToLctAddress,
                    ICCardCode       = itask.ICCardCode,
                    Distance         = itask.Distance,
                    CarSize          = itask.CarSize,
                    CarWeight        = itask.CarWeight
                };
                dispTaskLst.Add(dtask);
            }
            int rcdNum = pageTask.TotalNumber;
            var data   = new
            {
                total = pageTask.TotalNumber,
                rows  = dispTaskLst
            };

            return(Json(data));
        }