protected void btnSave_Click(object sender, EventArgs e) { var result = new StringBuilder(); var dal = new MachItemDAL(); var machItem = dal.GetMachItemById(MIId); foreach (RepeaterItem item in rpParams.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { CheckBox cbParam = item.FindControl("cbParam") as CheckBox; HiddenField hdId = item.FindControl("hdId") as HiddenField; if (cbParam.Checked) { result.Append(hdId.Value).Append("|"); } } } if (string.Equals(Type, "l", StringComparison.OrdinalIgnoreCase)) { machItem.LongMachList = result.ToString(); } else if (string.Equals(Type, "w", StringComparison.OrdinalIgnoreCase)) { machItem.WidthMachList = result.ToString(); } else if (string.Equals(Type, "d", StringComparison.OrdinalIgnoreCase)) { machItem.DeepthMachList = result.ToString(); } dal.Save(); this.RegisterClientScriptBlock("closeparam", "<script>closeWindow();</script>"); }
public override void BindControl() { if (IsRefineInstead) { ddlRefineList.Visible = true; txtRefineIntro.Visible = true; //btnSave.Visible = true; RefineDAL refDAL = new RefineDAL(); var refineList = refDAL.GetRefineBySource(SysConst.SourceTypeOrder, OrderNo); var result = (from r in refineList select new NameValueItem() { Name = r.Refine_No, Value = r.Refine_No }).ToList(); Utility.BindDataToDropdown(ddlRefineList, result); if (!string.IsNullOrEmpty(RefineNo)) { ddlRefineList.SelectedValue = RefineNo; } txtRefineIntro.Text = RefineIntro; } MachItemDAL dal = new MachItemDAL(); var machItems = dal.GetMachItemsByMachId(MachId); Utility.BindDataToRepeater(rpItems, machItems); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int machId = int.Parse(Request.QueryString["machId"]); MachItemDAL dal = new MachItemDAL(); var machItems = dal.GetMachItemsByMachId(machId); Utility.BindDataToRepeater(rpItemExport, machItems); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MachItemDAL dal = new MachItemDAL(); var machItem = dal.GetMachItemById(MIId); LongMachList = machItem.LongMachList; WidthMachList = machItem.WidthMachList; DeepthMachList = machItem.DeepthMachList; BindControl(); } }
protected void rpItems_ItemCommand(object source, RepeaterCommandEventArgs e) { MachItemDAL dal = new MachItemDAL(); if (e.CommandName == "Add") { MachItem item = new MachItem(); TextBox txtIntroAdd = e.Item.FindControl("txtIntroAdd") as TextBox; TextBox txtProductAdd = e.Item.FindControl("txtProductAdd") as TextBox; TextBox txtCodeAdd = e.Item.FindControl("txtCodeAdd") as TextBox; TextBox txtLongAdd = e.Item.FindControl("txtLongAdd") as TextBox; TextBox txtWidthAdd = e.Item.FindControl("txtWidthAdd") as TextBox; TextBox txtDeepAdd = e.Item.FindControl("txtDeepAdd") as TextBox; TextBox txtQtyAdd = e.Item.FindControl("txtQtyAdd") as TextBox; TextBox txtRemarkAdd = e.Item.FindControl("txtRemarkAdd") as TextBox; int longValue = !string.IsNullOrEmpty(txtLongAdd.Text) ? int.Parse(txtLongAdd.Text) : 0; int width = !string.IsNullOrEmpty(txtWidthAdd.Text) ? int.Parse(txtWidthAdd.Text) : 0; int deepth = !string.IsNullOrEmpty(txtDeepAdd.Text) ? int.Parse(txtDeepAdd.Text) : 0; int qty = !string.IsNullOrEmpty(txtQtyAdd.Text) ? int.Parse(txtQtyAdd.Text) : 0; item.Mach_Id = MachId; item.Intro = txtIntroAdd.Text; item.Product_Code = txtProductAdd.Text; item.Code = txtCodeAdd.Text; item.Long = longValue; item.Width = width; item.Deepth = deepth; item.Quantity = qty; item.Square = ((double)(longValue * width * qty)) / (1000 * 1000); item.MachIntro = txtRemarkAdd.Text; dal.AddMachItem(item); dal.Save(); } if (e.CommandName == "Save") { HiddenField hdId = e.Item.FindControl("hdId") as HiddenField; var item = dal.GetMachItemById(int.Parse(hdId.Value)); TextBox txtIntro = e.Item.FindControl("txtIntro") as TextBox; TextBox txtProduct = e.Item.FindControl("txtProduct") as TextBox; TextBox txtCode = e.Item.FindControl("txtCode") as TextBox; TextBox txtLong = e.Item.FindControl("txtLong") as TextBox; TextBox txtWidth = e.Item.FindControl("txtWidth") as TextBox; TextBox txtDeep = e.Item.FindControl("txtDeep") as TextBox; TextBox txtQty = e.Item.FindControl("txtQty") as TextBox; TextBox txtRemark = e.Item.FindControl("txtRemark") as TextBox; int longValue = !string.IsNullOrEmpty(txtLong.Text) ? int.Parse(txtLong.Text) : 0; int width = !string.IsNullOrEmpty(txtWidth.Text) ? int.Parse(txtWidth.Text) : 0; int deepth = !string.IsNullOrEmpty(txtDeep.Text) ? int.Parse(txtDeep.Text) : 0; int qty = !string.IsNullOrEmpty(txtQty.Text) ? int.Parse(txtQty.Text) : 0; item.Mach_Id = MachId; item.Intro = txtIntro.Text; item.Product_Code = txtProduct.Text; item.Code = txtCode.Text; item.Long = longValue; item.Width = width; item.Deepth = deepth; item.Quantity = qty; item.Square = ((double)(longValue * width * qty)) / (1000 * 1000); item.MachIntro = txtRemark.Text; dal.Save(); } if (e.CommandName == "Delete") { HiddenField hdId = e.Item.FindControl("hdId") as HiddenField; dal.DeleteMachItem(int.Parse(hdId.Value)); } BindControl(); SetFocus(btnExport); }
protected void btnCreatePurchase_Click(object sender, EventArgs e) { //get no SeedDAL sdal = new SeedDAL(); string no = sdal.GetNoByTableName(SysConst.TablePurchaseOrder, SysConst.SuffixPurchaseOrder); //get enqordman string enqOrdMan = string.Empty; string companyName = string.Empty; string contact = string.Empty; string address = string.Empty; string email = string.Empty; string qq = string.Empty; string phone1 = string.Empty; string phone2 = string.Empty; string other = string.Empty; if (string.Equals(SourceType, SysConst.SourceTypeOrder, StringComparison.OrdinalIgnoreCase)) { OrderDAL soDAL = new OrderDAL(); var so = soDAL.GetOrderByNo(SourceNo); so.Status = "申请采购"; soDAL.Save(); enqOrdMan = so.OrderMan; companyName = so.CustomerCompanyName; contact = so.CustomerContactName; address = so.CustomerAddress; email = so.CustomerEmail; qq = so.CustomerQQ; phone1 = so.CustomerPhone1; phone2 = so.CustomerPhone2; other = so.CustomerOthers; } else if (string.Equals(SourceType, SysConst.SourceTypeMaching, StringComparison.OrdinalIgnoreCase)) { MachiningDAL mDAL = new MachiningDAL(); var mach = mDAL.GetMachByNo(SourceNo); companyName = mach.CustomerCompanyName; contact = mach.CustomerContactName; address = mach.CustomerAddress; email = mach.CustomerEmail; qq = mach.CustomerQQ; phone1 = mach.CustomerPhone1; phone2 = mach.CustomerPhone2; other = mach.CustomerOthers; } //new refine PurchaseOrderDAL dal = new PurchaseOrderDAL(); PurchaseOrder po = new PurchaseOrder() { Purchase_No = no, Status = FirstStatusConsts.Purchase, EnqOrdMan = enqOrdMan, SourceType = SourceType, SourceNo = SourceNo, CreatedDate = DateTime.Now, CreatedAt = DateTime.Now, CreatedBy = SMSContext.Current.User.UserName }; dal.AddPO(po); dal.Save(); int poid = po.Purchase_Id; string pono = po.Purchase_No; //poitem if (string.Equals(SourceType, SysConst.SourceTypeMaching, StringComparison.OrdinalIgnoreCase)) { MachiningDAL mDAL = new MachiningDAL(); var mach = mDAL.GetMachByNo(SourceNo); MachItemDAL miDAL = new MachItemDAL(); var machItems = miDAL.GetMachItemsByMachId(mach.Mach_Id); POItemDAL pDAL = new POItemDAL(); foreach (var item in machItems) { PurchaseOrderItem poItem = new PurchaseOrderItem() { Code = item.Code, Deepth = item.Deepth, Intro = item.Intro, Long = item.Long, PO_Id = poid, Product_Code = item.Product_Code, Quantity = item.Quantity, Square = item.Square, Width = item.Width }; pDAL.AddPOItem(poItem); } pDAL.Save(); } string url = Page.ResolveUrl(string.Format("~/PurchaseForm.aspx?poid={0}&pono={1}&sourcetype={2}&sourceno={3}", poid, pono, SourceType, SourceNo)); string script = string.Format("<script>window.open('{0}')</script>", url); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createpo", script); BindControl(); SetFocus(btnCreatePurchase); }