protected void Page_Load(object sender, EventArgs e) { long id = long.Parse(Request.QueryString["id"]); if (!IsPostBack) { product = bll.GetIvtProductEdit(id); locationList = new InventoryLocationBLL().GetLocationListUnResource(); var pdt = new ProductBLL().GetProduct(product.product_id); is_serialized = pdt.is_serialized == 1 ? true : false; } else { long targetLocationId = long.Parse(Request.Form["warehouse_id"]); int count = int.Parse(remove_quantity.Text); if (bll.TransferProduct(id, targetLocationId, count, pdtSnHidden.Value, note.Text, LoginUserId)) { Response.Write("<script>window.close();self.opener.location.reload();</script>"); Response.End(); } else { product = bll.GetIvtProductEdit(id); locationList = new InventoryLocationBLL().GetLocationListUnResource(); var pdt = new ProductBLL().GetProduct(product.product_id); is_serialized = pdt.is_serialized == 1 ? true : false; backSn = Request.Form["sn"]; backLocation = targetLocationId; } } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; if (!IsPostBack) { if (!string.IsNullOrEmpty(id)) // 编辑 { long pdId = Convert.ToInt64(id); product = bll.GetIvtProductEdit(pdId); isSerialized = new ProductBLL().GetProduct(product.product_id).is_serialized == 1; var snList = bll.GetProductSnList(pdId); if (snList != null && snList.Count > 0) { snCnt = snList.Count; foreach (var s in snList) { sn += s.sn + "\n"; } } locationList = new InventoryLocationBLL().GetLocationList(); } else // 新增 { if (!string.IsNullOrEmpty(Request.QueryString["pdtId"])) { productId = long.Parse(Request.QueryString["pdtId"]); var pdt = new ProductBLL().GetProduct(productId); productName = pdt.name; isSerialized = pdt.is_serialized == 1; } locationList = new InventoryLocationBLL().GetLocationListUnResource(); } } else { var pdt = AssembleModel <ivt_warehouse_product>(); string sn = Request.Form["sn"]; if (string.IsNullOrEmpty(id)) { bll.AddIvtProduct(pdt, sn, LoginUserId); } else { pdt.id = Convert.ToInt64(id); bll.EditIvtProduct(pdt, sn, LoginUserId); } if ("SaveNew".Equals(Request.Form["act"])) { Response.Write("<script>window.location.href='InventoryItem.aspx';self.opener.location.reload();</script>"); Response.End(); } else { Response.Write("<script>window.close();self.opener.location.reload();</script>"); Response.End(); } } }