public ActionResult DeleteDetails(int id) { TransportRecordDetailModel model = businessProvider.GetTransportRecordDetailModel(id); businessProvider.DeleteTransportRecordDetail(id); return(RedirectToAction("DetailsMgr", "Business", new { id = model.TransportRecordID })); }
public void InsertNewTransportDetail(TransportRecordDetailModel detail, string userID) { using (SQLDBDataContext context = new SQLDBDataContext()) { context.TransportRecordDetail.InsertOnSubmit( new TransportRecordDetail() { DetailNo = detail.DetailNo, PackageName = detail.PackageName, Quantity = detail.Quantity, TransportRecordID = detail.TransportRecordID, Volume = detail.Volume, ReceiptCount = detail.ReceiptCount, Comment = detail.Comment } ); context.TransportRecordsOptionHistory.InsertOnSubmit( new TransportRecordsOptionHistory() { Description = string.Format("插入新货物明细, 编号:{0},货物{1},数量:{2},体积:{3}", detail.DetailNo, detail.PackageName, detail.Quantity, detail.Volume), LogDateTime = DateTime.Now, Operation = "新货物明细", UserID = userID, TransportRecordID = detail.TransportRecordID } ); context.SubmitChanges(); } }
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)); }
public void UpdateTransportDetailModel(TransportRecordDetailModel model) { using (SQLDBDataContext context = new SQLDBDataContext()) { TransportRecordDetail detail = context.TransportRecordDetail.FirstOrDefault(x => x.ID == model.ID); if (detail == null) { return; } detail.DetailNo = model.DetailNo; detail.PackageName = model.PackageName; detail.Quantity = model.Quantity; detail.Volume = model.Volume; detail.ReceiptCount = model.ReceiptCount; detail.Comment = model.Comment; context.SubmitChanges(); } }
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))); }
public ActionResult UpdateDetails(TransportRecordDetailModel model) { businessProvider.UpdateTransportDetailModel(model); model = businessProvider.GetTransportRecordDetailModel(model.ID); return(RedirectToAction("DetailsMgr", "Business", new { id = model.TransportRecordID })); }
public ActionResult UpdateDetails(int id) { TransportRecordDetailModel model = businessProvider.GetTransportRecordDetailModel(id); return(View(model)); }