private void DoSupplement() { wsINP.IwsINPClient client = new wsINP.IwsINPClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); if (!isExistOrder(((ValueInfo)this.cmbCustomer.SelectedItem).ValueField,this.txtCustOrderNo.Text)) { throw new Exception(UtilCulture.GetString("Msg.R01021", this.txtCustOrderNo.Text)); } tinpsupplement supplement = new tinpsupplement(); supplement.suplsysid = Function.GetGUID(); supplement.supplementno = this.txtSupplementNo.Text; supplement.customerid = ((ValueInfo)this.cmbCustomer.SelectedItem).ValueField; supplement.custorderno = this.txtCustOrderNo.Text; supplement.step = ((ValueInfo)this.cmbStep.SelectedItem).ValueField; supplement.workgroup = ((ValueInfo)this.cmbWorkGroup.SelectedItem).ValueField; supplement.factory = this.txtFactory.Text; supplement.supplementdate = Function.GetCurrentTime(); supplement.supplementuser = Function.GetCurrentUser(); supplement.lastmodifiedtime = Function.GetCurrentTime(); supplement.lastmodifieduser = Function.GetCurrentUser(); List<tinpsupplementdtl> lstsupplementdtl = new List<tinpsupplementdtl>(); foreach (UltraGridRow row in this.grdDetail.Rows) { if (row.Cells["styleno"].Value.ToString().Equals(string.Empty)) { throw new Exception(UtilCulture.GetString("Msg.R01020", UtilCulture.GetString("Label.R01026"))); } if (row.Cells["color"].Value.ToString().Equals(string.Empty)) { throw new Exception(UtilCulture.GetString("Msg.R01020", UtilCulture.GetString("Label.R01027"))); } if (row.Cells["size"].Value.ToString().Equals(string.Empty)) { throw new Exception(UtilCulture.GetString("Msg.R01020", UtilCulture.GetString("Label.R01028"))); } if (Convert.ToInt16(row.Cells["pairqty"].Value) == 0) { throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R02026"))); } tinpsupplementdtl supplementdtl = new tinpsupplementdtl(); supplementdtl.supldtlsysid = Function.GetGUID(); supplementdtl.suplsysid = supplement.suplsysid; supplementdtl.customerid = ((ValueInfo)this.cmbCustomer.SelectedItem).ValueField; supplementdtl.custorderno = supplement.custorderno; supplementdtl.styleno = row.Cells["styleno"].Value.ToString(); supplementdtl.color = row.Cells["color"].Value.ToString(); supplementdtl.size = row.Cells["size"].Value.ToString(); supplementdtl.checktype = row.Cells["checktype"].Value.ToString(); supplementdtl.pairqty = Convert.ToInt16(row.Cells["pairqty"].Value); supplementdtl.isreinspect = row.Cells["isreinspect"].Value.ToString(); lstsupplementdtl.Add(supplementdtl); } if (lstsupplementdtl.Count == 0) { throw new Exception(UtilCulture.GetString("Msg.R01019")); } client.DoSupplement(baseForm.CurrentContextInfo, supplement, lstsupplementdtl.ToArray<tinpsupplementdtl>()); baseForm.CreateMessageBox(Public_MessageBox.Information, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00002")); this.Close(); } catch (Exception ex) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ex.Message); } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }