private void SavePo() { try { var poItems = new List <ProductionOrderItem>(); int seq = 0; foreach (DataRow row in dtPoItem.Rows) { seq++; poItems.Add(new ProductionOrderItem { PoNo = txtPoNo.Text, Seq = seq, Product = new Product { ProductCode = row["product_code"].ToString(), ProductName = row["product_name"].ToString(), }, PoQty = row["issue_unit_method"].ToString() == "Q" ? Convert.ToInt16(row["qty_wgh"]) : 0, PoWgh = row["issue_unit_method"].ToString() == "W" ? Convert.ToDecimal(row["qty_wgh"]) : 0, }); } var po = new ProductionOrder { PoNo = txtPoNo.Text, PoDate = dtpPoDate.Value, Comments = txtComment.Text, PoFlag = 0, Active = chkActive.Checked, CreateBy = "system", ModifiedBy = "system", ProductionOrderItem = poItems, }; if (string.IsNullOrEmpty(txtPoNo.Text)) { ProductionOrderController.Insert(po); } else { ProductionOrderController.Update(po); } //ProductionOrderController.InsertOrUpdate(order); } catch (Exception) { throw; } }
private void LoadOrder() { //var farmCtrl = new FarmController(); var coll = ProductionOrderController.GetAllProductionOrders(dtpPoDate.Value); gv.DataSource = coll; gv.Columns[2].HeaderText = "เลขที่ใบเบิก"; gv.Columns[3].HeaderText = "วันที่เบิก"; gv.Columns[4].HeaderText = "หมายเหตุ"; gv.Columns[5].HeaderText = "สถานะ"; gv.Columns[6].HeaderText = "ใช้งาน"; gv.Columns[7].HeaderText = "วันเวลาสร้าง"; gv.Columns[8].HeaderText = "ผู้สร้าง"; LoadItem(""); }
private void LoadData() { txtPoNo.Enabled = false; ProductionOrder po = ProductionOrderController.GetProductionOrder(this.poNo); if (po != null) { txtPoNo.Text = po.PoNo; dtpPoDate.Value = po.PoDate; txtComment.Text = po.Comments; chkActive.Checked = po.Active; dtpPoDate.Enabled = false; BtnSaveAndNew.Visible = false; } else { BtnCancel.Visible = false; } LoadDetail(); }
private void CancelOrder() { try { var po = new ProductionOrder { PoNo = txtPoNo.Text, PoDate = dtpPoDate.Value, Comments = txtComment.Text, PoFlag = 0, Active = false, CreateBy = "system", ModifiedBy = "system" }; ProductionOrderController.Cancel(po); } catch (Exception) { throw; } }