private void DoReturn() { wsINP.IwsINPClient client = new wsINP.IwsINPClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); if (UpdateMode == Public_UpdateMode.Insert) { inpreturn = new tinpreturn(); inpreturn.returnno = this.txtReturnNo.Text; inpreturn.customerid = ((ValueInfo)this.cmbCustomer.SelectedItem).ValueField; inpreturn.retsysid = Function.GetGUID(); inpreturn.returndate = Function.GetCurrentTime(); inpreturn.returnuser = Function.GetCurrentUser(); } inpreturn.returntype = ((ValueInfo)this.cmbReturnType.SelectedItem).ValueField; inpreturn.lastmodifiedtime = Function.GetCurrentTime(); inpreturn.lastmodifieduser = Function.GetCurrentUser(); List<tinpreturndtl> lstreturndtl = new List<tinpreturndtl>(); foreach (UltraGridRow row in this.grdDetail.Rows) { if (row.Cells["ck"].Value.ToString().Equals("Y")) { if (Convert.ToInt16(row.Cells["returnqty"].Value) == 0 && UpdateMode == Public_UpdateMode.Insert) { throw new Exception(UtilCulture.GetString("Msg.R01016", UtilCulture.GetString("Label.R02043"))); } if (Convert.ToInt16(row.Cells["pairqty"].Value) < Convert.ToInt16(row.Cells["returnqty"].Value)) { throw new Exception(UtilCulture.GetString("Msg.R01014", UtilCulture.GetString("Label.R02043"), UtilCulture.GetString("Label.R02026"))); } tinpreturndtl returndtl = new tinpreturndtl(); returndtl.retdtlsysid = Function.GetGUID(); returndtl.retsysid = inpreturn.retsysid; returndtl.customerid = inpreturn.customerid; returndtl.custorderno = row.Cells["custorderno"].Value.ToString(); returndtl.styleno = row.Cells["styleno"].Value.ToString(); returndtl.color = row.Cells["color"].Value.ToString(); returndtl.size = row.Cells["size"].Value.ToString(); returndtl.checktype = row.Cells["checktype"].Value.ToString(); returndtl.pairqty = Convert.ToInt16(row.Cells["returnqty"].Value); lstreturndtl.Add(returndtl); } } if (lstreturndtl.Count == 0 && UpdateMode == Public_UpdateMode.Insert) { throw new Exception(UtilCulture.GetString("Msg.R01018")); } client.DoReturn(baseForm.CurrentContextInfo,inpreturn,lstreturndtl.ToArray<tinpreturndtl>()); 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); } }