private bool DoAdd() { bool result = false; if (string.IsNullOrWhiteSpace(txtAllotTime.Text)) { JscriptMsg("调拨时间不能为空!", ""); return(false); } Model.AllotOrder model = new Model.AllotOrder(); BLL.AllotOrder bll = new BLL.AllotOrder(); model.AllotTime = DateTime.Parse(txtAllotTime.Text); model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; model.Status = 0; model.CreateTime = DateTime.Now; string[] storeInOrderIds = Request.Form.GetValues("StoreInOrderId"); string[] storeInGoodsIds = Request.Form.GetValues("StoreInGoodsId"); string[] sourceStoreIds = Request.Form.GetValues("SourceStoreId"); string[] purposeStoreIds = Request.Form.GetValues("PurposeStoreId"); string[] allotCounts = Request.Form.GetValues("AllotCount"); string[] allotRemarks = Request.Form.GetValues("AllotRemark"); if (storeInOrderIds != null && storeInGoodsIds != null && sourceStoreIds != null && purposeStoreIds != null && allotCounts != null && allotRemarks != null && storeInOrderIds.Length > 0 && storeInGoodsIds.Length > 0 && sourceStoreIds.Length > 0 && purposeStoreIds.Length > 0 && allotCounts.Length > 0 && allotRemarks.Length > 0) { for (int i = 0; i < storeInOrderIds.Length; i++) { decimal allotCount; int storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId; if (int.TryParse(storeInOrderIds[i], out storeInOrderId) && int.TryParse(storeInGoodsIds[i], out storeInGoodsId) && int.TryParse(sourceStoreIds[i], out sourceStoreId) && int.TryParse(purposeStoreIds[i], out purposeStoreId) && decimal.TryParse(allotCounts[i], out allotCount)) { model.AddAllotGoods(new AllotGoods(storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId, allotCount, allotRemarks[i])); } } } if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加调拨货物:" + model.Id); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.AllotOrder bll = new BLL.AllotOrder(); Model.AllotOrder model = bll.GetModel(_id); txtAllotTime.Text = model.AllotTime.ToString("yyyy-MM-dd"); txtAdmin.Text = model.Admin; txtRemark.Text = model.Remark; BLL.AllotGoods goodsVehicleBLL = new BLL.AllotGoods(); DataTable goodsVehicleDT = goodsVehicleBLL.GetList(" and A.AllotOrderId = " + _id + "").Tables[0]; this.rptAllotGoodsList.DataSource = goodsVehicleDT; this.rptAllotGoodsList.DataBind(); }
private bool DoAdd() { bool result = false; if (string.IsNullOrWhiteSpace(txtAllotTime.Text)) { JscriptMsg("调拨时间不能为空!", ""); return false; } Model.AllotOrder model = new Model.AllotOrder(); BLL.AllotOrder bll = new BLL.AllotOrder(); model.AllotTime = DateTime.Parse(txtAllotTime.Text); model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; model.Status = 0; model.CreateTime = DateTime.Now; string[] storeInOrderIds = Request.Form.GetValues("StoreInOrderId"); string[] storeInGoodsIds = Request.Form.GetValues("StoreInGoodsId"); string[] sourceStoreIds = Request.Form.GetValues("SourceStoreId"); string[] purposeStoreIds = Request.Form.GetValues("PurposeStoreId"); string[] allotCounts = Request.Form.GetValues("AllotCount"); string[] allotRemarks = Request.Form.GetValues("AllotRemark"); if (storeInOrderIds != null && storeInGoodsIds != null && sourceStoreIds != null && purposeStoreIds != null && allotCounts != null && allotRemarks != null && storeInOrderIds.Length > 0 && storeInGoodsIds.Length > 0 && sourceStoreIds.Length > 0 && purposeStoreIds.Length > 0 && allotCounts.Length > 0 && allotRemarks.Length > 0) { for (int i = 0; i < storeInOrderIds.Length; i++) { decimal allotCount; int storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId; if (int.TryParse(storeInOrderIds[i], out storeInOrderId) && int.TryParse(storeInGoodsIds[i], out storeInGoodsId) && int.TryParse(sourceStoreIds[i], out sourceStoreId) && int.TryParse(purposeStoreIds[i], out purposeStoreId) && decimal.TryParse(allotCounts[i], out allotCount)) { model.AddAllotGoods(new AllotGoods(storeInOrderId, storeInGoodsId, sourceStoreId, purposeStoreId, allotCount, allotRemarks[i])); } } } if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加调拨货物:" + model.Id); //记录日志 result = true; } return result; }