private void ResetForm() { try { m_Order = new CO(); m_Order.GetCOAllDetails(OrderNo, (int)Common.OrderStatus.Confirmed); if (m_Order != null && !string.IsNullOrEmpty(m_Order.CustomerOrderNo)) { CODetailList = m_Order.CODetailList; dgvCOItemDetails.DataSource = CODetailList; SetHeaderValue(); //RefreshItemList(); // Get Grid View data string errorMessage = string.Empty; ListBatch = CIBatchDetail.GetDefaultBatch(OrderNo, m_LocationID, ref errorMessage); SetGridView(); dgvCOItemDetails.ClearSelection(); dgvInvoiceDetail.ClearSelection(); } else { // Co Detail not Found ErrorCode = "40009"; } } catch (Exception ex) { throw ex; } }
private void dgvOrderSearch_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (e.ColumnIndex > 0 && e.RowIndex >= 0) { string orderno = Convert.ToString(dgvOrderSearch.Rows[e.RowIndex].Cells["OrderNo"].Value); CO order = new CO(); order.GetCOAllDetails(orderno, -1); m_returnObject = order; //add order detail form call DialogResult = DialogResult.OK; this.Close(); //BindCombo(); } } catch (Exception ex) { MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error); Common.LogException(ex); } }
private void btnOk_Click(object sender, EventArgs e) { try { if (dgvOrderSearch.SelectedCells.Count > 0) { string orderno = Convert.ToString(dgvOrderSearch.Rows[dgvOrderSearch.SelectedCells[0].RowIndex].Cells["OrderNo"].Value); CO order = new CO(); order.GetCOAllDetails(orderno, -1); m_returnObject = order; //add order detail form call DialogResult = DialogResult.OK; this.Close(); //BindCombo(); } } catch (Exception ex) { MessageBox.Show(Common.GetMessage("10002"), Common.GetMessage("30007"), MessageBoxButtons.OK, MessageBoxIcon.Error); Common.LogException(ex); } }
public bool ProcessLog(string logNo, int LocationID, int userID, List <CO> lstCo, ref String ErrorCode) { try { bool isSuccess = false; bool isValid = true; string errorMessage = string.Empty; //Check Batch Qty Not Available for all Items of orders //isValid = CI.CheckBatchForLog(logNo, LocationID, ref errorMessage); //if (isValid) { List <CI> CIList = new List <CI>(); errorMessage = string.Empty; if (lstCo != null && lstCo.Count > 0) { DataTaskManager dtManager = null; try { using (dtManager = new DataTaskManager()) { //dtManager.BeginTransaction(); try { foreach (CO o in lstCo) { dtManager.BeginTransaction(); CO COrder = new CO(); COrder.GetCOAllDetails(o.CustomerOrderNo, -1); errorMessage = string.Empty; List <CIBatchDetail> ListBatch = CIBatchDetail.GetDefaultBatch(COrder.CustomerOrderNo, LocationID, ref errorMessage); CI invoice = CreateInvoiceObject(COrder, ListBatch, userID); if (invoice != null) { string ValidationCode = string.Empty; isValid = invoice.ValidateInvoice(COrder.CODetailList, ListBatch, ref ValidationCode); errorMessage = errorMessage + ValidationCode; if (isValid) { bool isSaved = invoice.Save(ref ValidationCode); if (!isSaved) { isSuccess = false; ErrorCode = ValidationCode; dtManager.RollbackTransaction(); //return isSuccess; } else { dtManager.CommitTransaction(); ErrorCode = string.Empty; isSuccess = true; } } else { if (ValidationCode == "40007") { // Not sufficent Batch Qty present ErrorCode = "40008"; } else { ErrorCode = ValidationCode; } isSuccess = false; dtManager.RollbackTransaction(); //break; } } else { ErrorCode = "40029," + COrder.CustomerOrderNo; isSuccess = false; dtManager.RollbackTransaction(); break; } } //dtManager.CommitTransaction(); //ErrorCode = string.Empty; //isSuccess = true; //return isSuccess; } catch (Exception ex) { throw ex; } } //return isSuccess; } catch (Exception ex) { Common.LogException(ex); } } else { //No Order found in confirmed status ErrorCode = "40011"; } } // Error in batch qty check ////else if (!errorMessage.Trim().Equals(string.Empty)) //{ // if (errorMessage.Trim().IndexOf("30001:") >= 0) // { // throw new Exception(errorMessage.Trim()); // } // else // { // ErrorCode = errorMessage.Trim(); // } //} if (!errorMessage.Equals("")) { MessageBox.Show(errorMessage, Common.GetMessage("10004"), MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isSuccess); } catch (Exception ex) { throw ex; } }
public bool ProcessLog(string logNo, int LocationID, int userID, ref String ErrorCode, ref DataTable dtItems) { try { bool isSuccess = false; bool isValid = true; string errorMessage = string.Empty; //Check Batch Qty Not Available for all Items of orders isValid = CI.CheckBatchForLog(logNo, LocationID, ref errorMessage, ref dtItems); if (isValid) { List <CI> CIList = new List <CI>(); CO order = new CO(); order.LogNo = logNo; order.Status = (int)Common.OrderStatus.Confirmed; errorMessage = string.Empty; List <CO> lstCo = order.Search(ref errorMessage); if (errorMessage.Equals(string.Empty) && lstCo != null && lstCo.Count > 0) { DataTaskManager dtManager = null; try { using (dtManager = new DataTaskManager()) { dtManager.BeginTransaction(); try { foreach (CO o in lstCo) { CO m_Order = new CO(); m_Order.GetCOAllDetails(o.CustomerOrderNo, -1); errorMessage = string.Empty; List <CIBatchDetail> ListBatch = CIBatchDetail.GetDefaultBatch(m_Order.CustomerOrderNo, LocationID, ref errorMessage); CI invoice = CreateInvoiceObject(m_Order, ListBatch, userID); if (invoice != null) { string ValidationCode = string.Empty; isValid = invoice.ValidateInvoice(m_Order.CODetailList, ListBatch, ref ValidationCode); if (isValid) { bool isSaved = invoice.Save(ref ValidationCode); if (!isSaved) { isSuccess = false; dtManager.RollbackTransaction(); } } else { if (ValidationCode == "40007") { // Not sufficent Batch Qty present ErrorCode = "40008"; } else { ErrorCode = ValidationCode; } isSuccess = false; dtManager.RollbackTransaction(); break; } } else { ErrorCode = "40029," + m_Order.CustomerOrderNo; isSuccess = false; dtManager.RollbackTransaction(); break; } } dtManager.CommitTransaction(); ErrorCode = string.Empty; isSuccess = true; } catch (Exception ex) { throw ex; } } } catch (Exception ex) { Common.LogException(ex); } } else { //No Order found in confirmed status ErrorCode = "40011"; } } // Error in batch qty check else if (!errorMessage.Trim().Equals(string.Empty)) { if (errorMessage.Trim().IndexOf("30001:") >= 0) { throw new Exception(errorMessage.Trim()); } else { ErrorCode = errorMessage.Trim(); } } return(isSuccess); } catch (Exception ex) { throw ex; } }