コード例 #1
0
 public bool DeleteDeliveryReconcile(DeliveryReconcile deliveryReconcile)
 {
     if (deliveryReconcile == null) return false;
     _unitOfWork.DeliveryReconcileRepository.Delete(deliveryReconcile);
     _unitOfWork.Save();
     return true;
 }
コード例 #2
0
        public ActionResult DeliveryReconcileUpdate([DataSourceRequest] DataSourceRequest request, DispatchViewModelForReconcile dispatchViewModelForReconcile)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if(dispatchViewModelForReconcile.DeliveryReconcileID!=null)
                    {
                        var deliveryReconcile =
                            _deliveryReconcileService.FindById((int) dispatchViewModelForReconcile.DeliveryReconcileID);
                        deliveryReconcile.GRN = dispatchViewModelForReconcile.GRN;
                        deliveryReconcile.FDPID = dispatchViewModelForReconcile.FDPID;
                        deliveryReconcile.DispatchID = dispatchViewModelForReconcile.DispatchID;
                        deliveryReconcile.WayBillNo = dispatchViewModelForReconcile.WayBillNo;
                        deliveryReconcile.RequsitionNo = dispatchViewModelForReconcile.RequisitionNo;
                        deliveryReconcile.HubID = dispatchViewModelForReconcile.HubID;
                        deliveryReconcile.GIN = dispatchViewModelForReconcile.GIN;
                        deliveryReconcile.ReceivedAmount = (dispatchViewModelForReconcile.ReceivedAmount ?? 0);
                        deliveryReconcile.ReceivedDate = (dispatchViewModelForReconcile.ReceivedDate ?? DateTime.Now);
                        deliveryReconcile.LossAmount = dispatchViewModelForReconcile.LossAmount;
                        deliveryReconcile.LossReason = dispatchViewModelForReconcile.LossReasonId;
                        _deliveryReconcileService.EditDeliveryReconcile(deliveryReconcile);
                        ModelState.AddModelError("Success", @"Success: Delivery Reconcilation Data Updated.");
                    }
                    else
                    {
                        var dvmfr = dispatchViewModelForReconcile;
                        if (dvmfr.GRN != null  && dvmfr.RequisitionNo != null && dvmfr.GIN != null
                            && dvmfr.ReceivedAmount != null && dvmfr.ReceivedDate != null)
                        {
                            var deliveryReconcile = new DeliveryReconcile
                            {
                                GRN = dvmfr.GRN,
                                FDPID = dvmfr.FDPID,
                                DispatchID = dvmfr.DispatchID,
                                WayBillNo = dvmfr.WayBillNo,
                                RequsitionNo = dvmfr.RequisitionNo,
                                HubID = dvmfr.HubID,
                                GIN = dvmfr.GIN,
                                ReceivedAmount =
                                    (dvmfr.ReceivedAmount ?? 0),
                                ReceivedDate =
                                    (dvmfr.ReceivedDate ?? DateTime.Now),
                                LossAmount = dvmfr.LossAmount,
                                LossReason = dvmfr.LossReasonId
                            };
                            _deliveryReconcileService.AddDeliveryReconcile(deliveryReconcile);
                            _transactionService.PostDeliveryReconcileReceipt(deliveryReconcile.DeliveryReconcileID);
                            ModelState.AddModelError("Success", @"Success: Delivery Reconcilation Data Added.");
                        }
                    }

                    //return RedirectToAction("Index", new {regionID = });
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Errors", @"Error: FDP not registered. All fields need to be filled.");
                }
            }
            return Json(new[] { dispatchViewModelForReconcile }.ToDataSourceResult(request, ModelState));
        }
コード例 #3
0
 public bool EditDeliveryReconcile(DeliveryReconcile deliveryReconcile)
 {
     _unitOfWork.DeliveryReconcileRepository.Edit(deliveryReconcile);
     _unitOfWork.Save();
     return true;
 }