Пример #1
0
        public ActionResult CreateOrEditDeliveryOrder()
        {
            DeliveryOrderResponse _response = new DeliveryOrderResponse();

            if (Request.QueryString["id"] != null)
            {
                var request = new DeliveryOrderRequest
                {
                    Data = new DeliveryOrderModel
                    {
                        Id = long.Parse(Request.QueryString["id"].ToString())
                    }
                };

                DeliveryOrderResponse resp   = new DeliveryOrderHandler(_unitOfWork).GetDetail(request);
                DeliveryOrderModel    _model = resp.Entity;
                ViewBag.Response = _response;
                return(View(_model));
            }
            else
            {
                ViewBag.Response   = _response;
                ViewBag.ActionType = ClinicEnums.Action.Add;
                return(View());
            }
        }
Пример #2
0
        public bool SaveEdit(DeliveryOrderModel doModel)
        {
            bool         status = true;
            DORepository repo   = new DORepository();

            status = repo.SaveEdit(ParserAddDO(doModel));
            return(status);
        }
Пример #3
0
        public ActionResult ReceivedOrder(int id)
        {
            DeliveryOrderResponse _response = new DeliveryOrderResponse();

            var request = new DeliveryOrderRequest
            {
                Data = new DeliveryOrderModel
                {
                    Id = id
                }
            };

            DeliveryOrderResponse resp = new DeliveryOrderHandler(_unitOfWork).GetDetail(request);

            resp.Entity.Account = (AccountModel)Session["UserLogon"];
            resp.Entity.Recived = 1;
            resp.Entity.approve = 1;
            var receiveddeliveryorder = new DeliveryOrderRequest
            {
                Data   = resp.Entity,
                Action = ClinicEnums.Action.APPROVE.ToString()
            };

            new DeliveryOrderValidator(_unitOfWork).Validate(receiveddeliveryorder, out _response);
            DeliveryOrderModel _model = resp.Entity;

            foreach (var item in resp.Entity.deliveryOrderDetailModels)
            {
                var requestproductingudang = new ProductInGudangRequest
                {
                    Data = new ProductInGudangModel
                    {
                        Account   = (AccountModel)Session["UserLogon"],
                        stock     = Convert.ToInt32(item.qty_request) > 0 ? Convert.ToInt32(item.qty_request) : Convert.ToInt32(item.qty_request),
                        GudangId  = _model.GudangId,
                        ProductId = item.ProductId
                    }
                };

                var requesthistoryproductingudang = new HistoryProductInGudangRequest
                {
                    Data = new HistoryProductInGudangModel
                    {
                        Account   = (AccountModel)Session["UserLogon"],
                        value     = Convert.ToInt32(item.qty_request) > 0 ? Convert.ToInt32(item.qty_request) : Convert.ToInt32(item.qty_request),
                        GudangId  = Convert.ToInt32(_model.GudangId),
                        ProductId = item.ProductId
                    }
                };

                var saveproductingudang        = new ProductInGudangHandler(_unitOfWork).CreateOrEdit(requestproductingudang);
                var savehistoryproductingudang = new HistoryProductInGudangHandler(_unitOfWork).CreateOrEdit(requesthistoryproductingudang);
            }
            return(RedirectToAction("DeliveryOrderList"));
        }
        public void SetDateSource(DeliveryOrderModel deliveryOrder)
        {
            tCreated.Value        = deliveryOrder.created;
            txtConsignIndex.Value = deliveryOrder.waybill_sort.ToString();

            tDealerOrder.Value  = deliveryOrder.related_no;
            txtBoxInfo.Value    = "¹² " + deliveryOrder.box_count + " ¼þ";
            txtDeliveyTip.Value = deliveryOrder.order_tip;

            tRegoin.Value            = deliveryOrder.location_prefix;
            tReciver.Value           = deliveryOrder.location_consignee;
            tContact.Value           = deliveryOrder.location_consignee_mobile;
            tAddress.Value           = deliveryOrder.location_address;
            txtPayThisOrderTop.Value = deliveryOrder.pay_money;

            txtPayed.Value      = deliveryOrder.paidMoney;
            txtWaybillNo.Value  = deliveryOrder.waybill_no;
            tTotal.Value        = deliveryOrder.totalMoney.ToString();
            bcOrderNumber.Value = deliveryOrder.detrusion_no;
            tSM.Value           = deliveryOrder.detrusion_no;
            txtMark.Value       = deliveryOrder.mark;

            txtProductMoney.Value   = deliveryOrder.product_total;
            txtOtherDiscount.Value  = deliveryOrder.other_discount;
            txtTotalThisOrder.Value = deliveryOrder.total_this_order;
            txtDeliveryFee.Value    = deliveryOrder.deliveFee;
            txtCoupon.Value         = deliveryOrder.coupon;
            txtPayThisOrder.Value   = deliveryOrder.pay_money_string;

            List <object> dataSource = new List <object>();
            int           index      = 1;

            foreach (var i in deliveryOrder.data)
            {
                dataSource.Add(
                    new
                {
                    Index           = index++,
                    ProductNumber   = i.code,
                    ProductName     = i.product_name,
                    ProductUnit     = i.unit,
                    MinUnitQuantity = i.buy_qty,
                    IsGift          = i.is_gift,
                    DcReportedQty   = i.actual,
                    ProductPrice    = i.price,
                    PriceCount      = i.total
                });
            }

            this.table1.DataSource = dataSource;
        }
Пример #5
0
        public async Task <DeliveryOrderModel> Edit(int id, DeliveryOrderModel param)
        {
            var response = await Api.Update(id, param);

            if (!Is2XxHttpStatus(response.ResponseMessage.StatusCode))
            {
                throw new ShippoSdkException(response.StringContent);
            }

            var deliveryOrder =
                JsonConvert.DeserializeObject <DeliveryOrderModel>(response.StringContent);

            return(deliveryOrder);
        }
Пример #6
0
        public async Task <DeliveryOrderModel> Create(DeliveryOrderModel param)
        {
            var response = await Api.Create(param);

            if (!Is2XxHttpStatus(response.ResponseMessage.StatusCode))
            {
                throw new ShippoSdkException(response.StringContent);
            }

            var deliveryOrder =
                JsonConvert.DeserializeObject <ResultModel <DeliveryOrderModel> >(response.StringContent);

            return(deliveryOrder.Result);
        }
Пример #7
0
        public JsonResult CreateOrEditDeliveryOrder(DeliveryOrderModel _deliveryorder, List <DeliveryOrderDetailModel> deliveryOrderDetailModels)
        {
            if (Session["UserLogon"] != null)
            {
                _deliveryorder.Account = (AccountModel)Session["UserLogon"];
            }
            _deliveryorder.Id = Convert.ToInt32(_deliveryorder.Id) > 0 ? _deliveryorder.Id : 0;
            var request = new DeliveryOrderRequest
            {
                Data = _deliveryorder
            };

            DeliveryOrderResponse _response = new DeliveryOrderResponse();

            new DeliveryOrderValidator(_unitOfWork).Validate(request, out _response);
            DeliveryOrderDetailResponse _deliveryorderdetailresponse = new DeliveryOrderDetailResponse();

            if (deliveryOrderDetailModels != null)
            {
                foreach (var item in deliveryOrderDetailModels)
                {
                    var deliveryorderdetailrequest = new DeliveryOrderDetailRequest
                    {
                        Data = item
                    };
                    deliveryorderdetailrequest.Data.Account = (AccountModel)Session["UserLogon"];
                    //
                    var requestnamabarang = new ProductRequest
                    {
                        Data = new ProductModel
                        {
                            Id = item.ProductId
                        }
                    };

                    ProductResponse namabarang = new ProductHandler(_unitOfWork).GetDetail(requestnamabarang);
                    deliveryorderdetailrequest.Data.namabarang = namabarang.Entity.Name;
                    new DeliveryOrderDetailValidator(_unitOfWork).Validate(deliveryorderdetailrequest, out _deliveryorderdetailresponse);
                }
            }

            return(Json(new { data = _deliveryorderdetailresponse.Data }, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        private DeliveryOrder ParserAddDO(DeliveryOrderModel doModel)
        {
            DeliveryOrder doEntity = new DeliveryOrder();

            if (doEntity != null)
            {
                doEntity.iDeliveryOrderID   = doModel.iDeliveryOrderID;
                doEntity.iVehicleID         = doModel.iVehicleID;
                doEntity.strCustomerName    = doModel.strCustomerName;
                doEntity.strCurrentDate     = doModel.strCurrentDate;
                doEntity.dtCurrentDate      = doModel.dtCurrentDate;
                doEntity.strExpiryDate      = doModel.strExpiryDate;
                doEntity.dtExpiryDate       = doModel.dtExpiryDate;
                doEntity.strCarDeliveryDate = doModel.strCarDeliveryDate;
                doEntity.dtCarDeliveryDate  = doModel.dtCarDeliveryDate;
                doEntity.ysnDeliveryStatus  = doModel.ysnDeliveryStatus;
            }

            return(doEntity);
        }
Пример #9
0
        public ActionResult PrintDeliveryOrder(int id)
        {
            DeliveryOrderResponse _response = new DeliveryOrderResponse();

            var request = new DeliveryOrderRequest
            {
                Data = new DeliveryOrderModel
                {
                    Id = id
                }
            };

            DeliveryOrderResponse resp   = new DeliveryOrderHandler(_unitOfWork).GetDetail(request);
            DeliveryOrderModel    _model = resp.Entity;

            ViewBag.Response = _response;
            return(new PartialViewAsPdf(_model)
            {
                PageOrientation = Orientation.Portrait,
                PageSize = Size.Folio,

                FileName = "DeliveryOrder" + _model.donumber + ".pdf"
            });
        }
Пример #10
0
        public ActionResult SaveDeliveryOrder(DeliveryOrderModel doModel)
        {
            bool status = true;

            try
            {
                if (ModelState.IsValid)
                {
                    DOServiceClient service = new DOServiceClient();
                    status = service.SaveEdit(doModel);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                status = false;
                throw e;
            }
            //return RedirectToAction("Index");
            //return View();
            return(new JsonResult {
                Data = new { status = status }
            });
        }
        public void DeliveryOrderTest1()
        {
            DeliveryOrderModel deliveryOrderModel = new DeliveryOrderModel();
//            deliveryOrderModel.pickupad
        }
Пример #12
0
        public DeliveryOrderResponse GetListData(DeliveryOrderRequest request)
        {
            List <DeliveryOrderModel> lists = new List <DeliveryOrderModel>();
            dynamic qry             = null;
            var     searchPredicate = PredicateBuilder.New <Data.DataRepository.DeliveryOrder>(true);

            // add default filter to show the active data only
            searchPredicate = searchPredicate.And(x => x.RowStatus == 0);

            if (!String.IsNullOrEmpty(request.SearchValue) && !String.IsNullOrWhiteSpace(request.SearchValue))
            {
                searchPredicate = searchPredicate.And(p => p.donumber.Contains(request.SearchValue));
            }

            if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir)))
            {
                if (request.SortColumnDir == "asc")
                {
                    switch (request.SortColumn.ToLower())
                    {
                    case "donumber":
                        qry = _unitOfWork.DeliveryOrderRepository.Get(searchPredicate, orderBy: q => q.OrderBy(x => x.donumber));
                        break;

                    default:
                        qry = _unitOfWork.DeliveryOrderRepository.Get(searchPredicate, orderBy: q => q.OrderBy(x => x.id));
                        break;
                    }
                }
                else
                {
                    switch (request.SortColumn.ToLower())
                    {
                    case "donumber":
                        qry = _unitOfWork.DeliveryOrderRepository.Get(searchPredicate, orderBy: q => q.OrderByDescending(x => x.donumber));
                        break;

                    default:
                        qry = _unitOfWork.DeliveryOrderRepository.Get(searchPredicate, orderBy: q => q.OrderByDescending(x => x.id));
                        break;
                    }
                }
            }
            else
            {
                qry = _unitOfWork.DeliveryOrderRepository.Get(searchPredicate, null);
            }

            foreach (var item in qry)
            {
                var prData = new DeliveryOrderModel
                {
                    Id           = item.id,
                    poid         = item.poid,
                    donumber     = item.donumber,
                    dodate       = item.dodate,
                    dodest       = item.dodest,
                    approveby    = item.approveby,
                    approve      = item.approve,
                    ModifiedBy   = item.ModifiedBy,
                    CreatedBy    = item.CreatedBy,
                    ModifiedDate = item.ModifiedDate,
                    Recived      = item.Recived,
                    createformat = GeneralHandler.FormatDate(item.CreatedDate)
                };

                lists.Add(prData);
            }

            int totalRequest = lists.Count();
            var data         = lists.Skip(request.Skip).Take(request.PageSize).ToList();

            var response = new DeliveryOrderResponse
            {
                Draw            = request.Draw,
                RecordsFiltered = totalRequest,
                RecordsTotal    = totalRequest,
                Data            = data
            };

            return(response);
        }