Beispiel #1
0
        public ActionResult DetailsMgr(int id)
        {
            TransportRecordModel model = businessProvider.GetTransportRecordModel(id);

            ViewBag.DefaultTrayNo = businessProvider.GetNextTrayNo(model.ClientName);
            return(View(model));
        }
Beispiel #2
0
 public void UpdateTransportModel(TransportRecordModel model, string userID)
 {
     using (SQLDBDataContext context = new SQLDBDataContext())
     {
         TransportRecords record = context.TransportRecords.FirstOrDefault(x => x.ID == model.ID);
         record.AccountPayble = model.AccountPayble;
         record.CarLicense    = model.CarLicense;
         record.ClientName    = model.ClientName;
         record.Comment       = model.Comment;
         record.Deductions    = model.Deductions;
         record.DeliverDate   = model.DeliverDate;
         record.DeliverPrice  = model.DeliverPrice;
         record.DeliverType   = model.DeliverType;
         record.Driver        = model.Driver;
         record.Error         = model.Error;
         record.ErrorMessage  = model.ErrorMessage;
         record.FromLocation  = model.FromLocation;
         record.HandlingFee   = model.HandlingFee;
         record.OilCard       = model.OilCard;
         record.PackageName   = model.PackageName;
         record.Paid          = model.Paid;
         record.PayDate       = model.PayDate;
         record.PrePay        = model.PrePay;
         record.Quantity      = model.Quantity;
         record.Received      = model.Received;
         record.ReceivedDate  = model.ReceivedDate;
         record.Reparations   = model.Reparations;
         record.ShortBargeFee = model.ShortBargeFee;
         record.Status        = model.Status;
         record.ToLocation    = model.ToLocation;
         record.TrayNo        = model.TrayNo;
         record.Volume        = model.Volume;
         context.SubmitChanges();
     }
 }
Beispiel #3
0
        public ActionResult UpdateComment(TransportRecordModel model)
        {
            String returnUrl = Request["backUrl"];

            businessProvider.UpdateTransportComment(model.ID, model.Comment, this.cacheProvider.GetCurrentLoggedUser().UserID);
            return(Redirect(returnUrl));
        }
Beispiel #4
0
        public ActionResult FillPrice(TransportRecordModel model)
        {
            UserModel user = this.cacheProvider.GetCurrentLoggedUser();

            businessProvider.UpdateTransportPrice(model.ID, model.DeliverPrice, model.ShortBargeFee, model.AccountPayble, user.UserID);
            model = businessProvider.GetTransportRecordModel(model.ID);
            return(View(model));
        }
Beispiel #5
0
        public ActionResult FillTransportRecord(TransportRecordModel model)
        {
            string supdateindex = Request["updateindex"];
            bool   updateindex  = supdateindex == "1"? true: false;

            businessProvider.UpdateTransportModel(model.ID, model.TrayNo, model.Volume, model.Quantity, updateindex, this.cacheProvider.GetCurrentLoggedUser().UserID);
            model = businessProvider.GetTransportRecordModel(model.ID);
            return(RedirectToAction("DetailsMgr", "Business", new { id = model.ID }));
        }
Beispiel #6
0
        public ActionResult UpdateErr(TransportRecordModel model)
        {
            UserModel user = this.cacheProvider.GetCurrentLoggedUser();

            businessProvider.UpdateTransportErrorStatus(model.ID, model.Error, model.ErrorMessage, user.UserID);
            model           = businessProvider.GetTransportRecordModel(model.ID);
            ViewBag.Message = "更新数据成功";
            return(View(model));
        }
Beispiel #7
0
        public ActionResult UpdateTransportRecord(TransportRecordModel model)
        {
            ViewBag.Clients = (from x in businessProvider.QueryClient()
                               select new SelectListItem()
            {
                Text = x.ClientName,
                Value = x.ClientName
            }).ToList();
            string actionType = Request["actionType"];

            if (actionType == "updtRecord")
            {
                UserModel user = this.cacheProvider.GetCurrentLoggedUser();
                businessProvider.UpdateTransportModel(model, user.UserID);
            }
            else if (actionType == "fillDetails")
            {
                string detailNo    = Request["detailNo"];
                string packageName = Request["packagename"];
                int    quantity    = 0;
                double volume      = 0f;

                if (string.IsNullOrEmpty(detailNo))
                {
                    ViewBag.ErrorMessage = "单据编号为空";
                    return(View(model));
                }
                if (string.IsNullOrEmpty(packageName))
                {
                    ViewBag.ErrorMessage = "货物名称为空";
                    return(View(model));
                }
                if (!int.TryParse(Request["quantity"], out quantity))
                {
                    ViewBag.ErrorMessage = "数量没有正确填写,必须填写整数数字";
                    return(View(model));
                }
                if (!double.TryParse(Request["volume"], out volume))
                {
                    ViewBag.ErrorMessage = "体积没有正确填写,必须填写数字";
                    return(View(model));
                }
                TransportRecordDetailModel newDetail = new TransportRecordDetailModel()
                {
                    DetailNo          = detailNo,
                    PackageName       = packageName,
                    Quantity          = quantity,
                    TransportRecordID = model.ID,
                    Volume            = volume
                };
                UserModel user = this.cacheProvider.GetCurrentLoggedUser();
                businessProvider.InsertNewTransportDetail(newDetail, user.UserID);
            }
            model = businessProvider.GetTransportRecordModel(model.ID);
            return(View(model));
        }
Beispiel #8
0
 public ActionResult FillCa(TransportRecordModel model)
 {
     if (model.Paid && (model.Error || !model.Received))
     {
         ViewBag.ErrorMessage = "错误:必须已到货并且无错误的单据才能进行结算操作";
         model.Paid           = false;
         return(View(model));
     }
     businessProvider.UpdateTransportPaymentData(model.ID, model.PayDate, model.AccountPayble, model.Deductions, model.Reparations, model.HandlingFee, model.Paid, this.cacheProvider.GetCurrentLoggedUser().UserID);
     model = businessProvider.GetTransportRecordModel(model.ID);
     return(View(model));
 }
Beispiel #9
0
        public ActionResult NewTransportRecord()
        {
            ViewBag.Clients = (from x in businessProvider.QueryClient()
                               select new SelectListItem()
            {
                Text = x.ClientName,
                Value = x.ClientName
            }).ToList();
            TransportRecordModel model = new TransportRecordModel();

            model.DeliverDate = DateTime.Now;
            return(View(model));
        }
Beispiel #10
0
        public ActionResult UpdateTransportRecord(int id)
        {
            ViewBag.Clients = (from x in businessProvider.QueryClient()
                               select new SelectListItem()
            {
                Text = x.ClientName,
                Value = x.ClientName
            }).ToList();
            TransportRecordModel model = businessProvider.GetTransportRecordModel(id);

            ViewBag.DefaultTrayNo = businessProvider.GetNextTrayNo(model.ClientName);
            return(View(model));
        }
Beispiel #11
0
        public ActionResult UpdateReceived(TransportRecordModel model)
        {
            string returnUrl = Request["returnUrl"];
            string received  = Request["received"];
            bool   breceived = true;

            bool.TryParse(received, out breceived);
            UserModel user = this.cacheProvider.GetCurrentLoggedUser();

            businessProvider.UpdateTransportReceivedStatus(model.ID, model.Received, model.ReceivedDate, user.UserID);
            model           = businessProvider.GetTransportRecordModel(model.ID);
            ViewBag.Message = "更新到货状态成功";
            return(View(model));
        }
Beispiel #12
0
        public ActionResult FillCa()
        {
            string sid = TryGetRequiredString("id");
            int    id;

            if (!int.TryParse(sid, out id))
            {
                ViewBag.ErrorMessage = "请正确选择要编辑的纪录";
                return(View("Error"));
            }
            TransportRecordModel model = businessProvider.GetTransportRecordModel(id);

            return(View(model));
        }
Beispiel #13
0
 public int InsertTransprotModel(TransportRecordModel model)
 {
     using (SQLDBDataContext context = new SQLDBDataContext())
     {
         TransportRecords newRecord = new TransportRecords()
         {
             AccountPayble = model.AccountPayble,
             CarLicense    = model.CarLicense,
             ClientName    = model.ClientName,
             Comment       = model.Comment,
             Deductions    = model.Deductions,
             DeliverDate   = model.DeliverDate,
             DeliverPrice  = model.DeliverPrice,
             DeliverType   = model.DeliverType,
             Driver        = model.Driver,
             FromLocation  = model.FromLocation,
             HandlingFee   = model.HandlingFee,
             PackageName   = model.PackageName,
             PayDate       = model.PayDate,
             PrePay        = model.PrePay,
             Quantity      = model.Quantity,
             Reparations   = model.Reparations,
             ShortBargeFee = model.ShortBargeFee,
             Status        = model.Status,
             ToLocation    = model.ToLocation,
             Volume        = model.Volume,
             TrayNo        = model.TrayNo,
             OilCard       = model.OilCard,
             BusinessArea  = model.BusinessArea,
             Error         = model.Error,
             Paid          = model.Paid,
             Received      = model.Received,
             ReceivedDate  = model.ReceivedDate
         };
         newRecord.TransportRecordsOptionHistory.AddRange(from x in model.HistoryItem
                                                          select new TransportRecordsOptionHistory()
         {
             Description       = x.Description,
             LogDateTime       = DateTime.Now,
             Operation         = x.Operation,
             TransportRecordID = newRecord.ID,
             UserID            = x.UserID
         });
         context.TransportRecords.InsertOnSubmit(newRecord);
         context.SubmitChanges();
         return(newRecord.ID);
     }
 }
Beispiel #14
0
 public ActionResult NewTransportRecord(TransportRecordModel model)
 {
     model.HistoryItem  = new List <TransportRecordsHistoryModel>();
     model.BusinessArea = Request["businessarea"];
     model.HistoryItem.Add(new TransportRecordsHistoryModel()
     {
         Description = "创建动态单",
         Operation   = "创建",
         UserID      = this.cacheProvider.GetCurrentLoggedUser().UserID
     });
     try
     {
         int newid = businessProvider.InsertTransprotModel(model);
         return(RedirectToAction("DetailsMgr", "Business", new { id = newid }));
     }
     catch (Exception ex)
     {
         ViewBag.ErrorMessage = "请正确选择要编辑的纪录";
         return(View("Error"));
     }
 }
Beispiel #15
0
        public ActionResult DetailsMgr(TransportRecordModel model)
        {
            string detailNo        = Request["detailNo"];
            string packageName     = Request["packagename"];
            int    quantity        = 0;
            double volume          = 0f;
            string actionType      = Request["actionType"];
            string strreceiptcount = Request["receiptcount"];
            int?   receiptcount    = null;

            if (!String.IsNullOrEmpty(strreceiptcount))
            {
                receiptcount = int.Parse(strreceiptcount);
            }
            string comment = Request["comment"];
            int    id;
            string viewName = "";

            if (actionType == "fillDetails")
            {
                id       = int.Parse(Request["recordID"]);
                viewName = "UpdateTransportRecord";
            }
            else
            {
                id       = model.ID;
                viewName = "DetailsMgr";
            }

            if (string.IsNullOrEmpty(detailNo))
            {
                ViewBag.ErrorMessage = "单据编号为空";
                return(View(viewName, model));
            }
            if (string.IsNullOrEmpty(packageName))
            {
                ViewBag.ErrorMessage = "货物名称为空";
                return(View(viewName, model));
            }
            if (!int.TryParse(Request["quantity"], out quantity))
            {
                ViewBag.ErrorMessage = "数量没有正确填写,必须填写整数数字";
                return(View(viewName, model));
            }
            if (!double.TryParse(Request["volume"], out volume))
            {
                ViewBag.ErrorMessage = "体积没有正确填写,必须填写数字";
                return(View(viewName, model));
            }
            TransportRecordDetailModel newDetail = new TransportRecordDetailModel()
            {
                DetailNo          = detailNo,
                PackageName       = packageName,
                Quantity          = quantity,
                TransportRecordID = id,
                Volume            = volume,
                ReceiptCount      = receiptcount,
                Comment           = comment
            };
            UserModel user = this.cacheProvider.GetCurrentLoggedUser();

            businessProvider.InsertNewTransportDetail(newDetail, user.UserID);
            model = businessProvider.GetTransportRecordModel(model.ID);
            return(RedirectToAction(string.Format("{0}/{1}", viewName, id)));
        }
Beispiel #16
0
        public ActionResult TransportDetails(int id)
        {
            TransportRecordModel model = businessProvider.GetTransportRecordModel(id);

            return(View(model));
        }
Beispiel #17
0
        public ActionResult UpdateReceived(int id)
        {
            TransportRecordModel model = this.businessProvider.GetTransportRecordModel(id);

            return(View(model));
        }