private void dgvDeliveryMaster_CellEnter(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex >= 0 && e.RowIndex >= 0) { int delivertyId = Convert.ToInt32(dgvDeliveryMaster.Rows[e.RowIndex].Cells[colDeliveryId.Name].Value); DataSet dsDeliveryDtls = DeliveriesDB.GetDeliverDetails(delivertyId); if (dsDeliveryDtls != null && dsDeliveryDtls.Tables.Count == 2) { bsDeliveryDetails.Filter = String.Empty; dtDeliveryDetails = dsDeliveryDtls.Tables[0]; //Bind Delivery references to grid BindDeliveryDetailsToGrid(dtDeliveryDetails); //Bind Delivery Solvents to grid BindDeliverySolventsToGrid(dsDeliveryDtls.Tables[1]); } } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }
private void btnGetShipmentRefs_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtShipmentYear.Text.Trim()) && !string.IsNullOrEmpty(txtClassType.Text.Trim())) { int.TryParse(txtShipmentYear.Text.Trim(), out shipmentYear); if (shipmentYear > 0) { DataSet dsDeliveryData = ShipmentManagementDB.GetDeliveryDataOnYearAndClassType(shipmentYear, txtClassType.Text.Trim()); if (dsDeliveryData != null && dsDeliveryData.Tables.Count == 2) { //Bind Delivery Shipment References to grid BindDeliveryDataToGrid(dsDeliveryData.Tables[0]); //Bind Delivery Solvents to grid BindDeliverySolventsToGrid(dsDeliveryData.Tables[1]); //Get Next Mdl No txtMDLNo.Text = DeliveriesDB.GetNextMDLNumber().ToString(); } } } else { dgvRDFRefs.DataSource = null; dgvSolvents.DataSource = null; } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }
private void GetDeliveryMasterDetailsAndBindToGrid() { try { dgvDeliveryMaster.AutoGenerateColumns = false; colDeliveryId.DataPropertyName = "DELIVERY_ID"; colDeliveryName.DataPropertyName = "DELIVERY_NAME"; colDeliveryDate.DataPropertyName = "DELIVERY_DATE"; colDeliveredRefCount.DataPropertyName = "DELIVERED_REFS_CNT"; colDeliveredReactionCount.DataPropertyName = "DELIVERED_REACTION_CNT"; colMdlStartNum.DataPropertyName = "MDL_START_NO"; colMdlEndNum.DataPropertyName = "MDL_END_NO"; colDeliveredBy.DataPropertyName = "CREATED_BY"; colRefName.DataPropertyName = "REFERENCE_NAME"; colClassType.DataPropertyName = "SYS_CLASS_TYPE"; colRefRxnCount.DataPropertyName = "REACTION_CNT"; colDR_ID.DataPropertyName = "DR_ID"; colShipmentRefID.DataPropertyName = "SHIPMENT_REF_ID"; //Get Delivery Master details dtDeliveryMaster = DeliveriesDB.GetDeliveryMasterDetails(); bsDelivery.Filter = String.Empty; if (dtDeliveryMaster != null) { if (dtDeliveryMaster.Rows.Count > 0) { DeliveryRecordCount = dtDeliveryMaster.Rows.Count; bsDelivery.DataSource = dtDeliveryMaster; dgvDeliveryMaster.DataSource = bsDelivery; //Bind delivery master data to chart BindDeliveryDataToChart(dtDeliveryMaster); } else { bsDelivery.DataSource = null; dgvDeliveryMaster.DataSource = bsDelivery; } } else { bsDelivery.DataSource = null; dgvDeliveryMaster.DataSource = bsDelivery; } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }
private void frmShipmentDelivery_Load(object sender, EventArgs e) { try { if (GlobalVariables.DeliveredSolvCatalysts == null) { Thread trdDictionary = new Thread(delegate() { GlobalVariables.DeliveredSolvCatalysts = DeliveriesDB.GetDeliveredSolventCatalysts(); }); trdDictionary.IsBackground = true; trdDictionary.Start(); } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }
private bool SaveDeliverySolvCatsInDatabase(List <DeliverySolvCats> deliverySovCatsList, string deliveryName) { bool blStatus = true; try { if (deliverySovCatsList != null && !string.IsNullOrEmpty(deliveryName)) { foreach (DeliverySolvCats delSolv in deliverySovCatsList) { foreach (NewSolvents newSolv in delSolv.RefNewSolvents) { DeliveriesDB.SaveDeliverySolvCatsDetails(deliveryName, delSolv.ShipmentRefID, newSolv.StructureMolFile.ToString(), newSolv.StructureName, newSolv.StructureInchiKey); } } } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } return(blStatus); }
private void frmDeliveredSolvents_Load(object sender, EventArgs e) { try { this.WindowState = FormWindowState.Maximized; if (GlobalVariables.DeliveredSolvCatalysts == null) { Thread trdDictionary = new Thread(delegate() { GlobalVariables.DeliveredSolvCatalysts = DeliveriesDB.GetDeliveredSolventCatalysts(); }); trdDictionary.IsBackground = true; trdDictionary.Start(); } BindDeliverySolventsToGrid(GlobalVariables.DeliveredSolvCatalysts); } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }
private void btnGenerateRDF_Click(object sender, EventArgs e) { try { string strErrMsg = ""; if (ValidateUserInputs(out strErrMsg)) { bool blClientDelivery = false; if (chkExpClientDelivery.Checked) { DialogResult diaRes = MessageBox.Show("Do you want to export for client's delivery?", GlobalVariables.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (diaRes == System.Windows.Forms.DialogResult.Yes) { blClientDelivery = true; } else { chkExpClientDelivery.Checked = false; blClientDelivery = false; } } int twodigYear = shipmentYear > 0 ? Convert.ToInt32(shipmentYear.ToString().Substring(2, 2)) : 0; DataTable dtTemp = dgvRDFRefs.DataSource as DataTable; DataRow[] rows = dtTemp.Select(); List <int> lstSelRefs = Array.ConvertAll(rows, row => Convert.ToInt32(row["SHIPMENT_REF_ID"])).ToList(); if (lstSelRefs != null && lstSelRefs.Count > 0) { int startMDLNo = Convert.ToInt32(txtMDLNo.Text.Trim()); Delivery objDelivery = new Delivery(); List <DeliverySolvCats> lstDeliverySovCats = null; if (ShipmentExport.ExportReactionsForClientDelivery(lstSelRefs, twodigYear.ToString(), txtFolderPath.Text, startMDLNo, out objDelivery, out lstDeliverySovCats)) { //Update Delivery details in the database if (objDelivery != null && blClientDelivery) { objDelivery.DeliveryName = txtDeliveryName.Text.Trim(); objDelivery.Urid = GlobalVariables.UR_ID; DataTable dtDeliveryTbl = null; //Save delivery details in database if (DeliveriesDB.SaveDeliveryDetails(objDelivery, out dtDeliveryTbl)) { //Save delivered Solvents if (SaveDeliverySolvCatsInDatabase(lstDeliverySovCats, txtDeliveryName.Text.Trim())) { MessageBox.Show("Export to RDFs and delivery details saving are done successfully", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); dgvRDFRefs.DataSource = null; dgvSolvents.DataSource = null; } } else { MessageBox.Show("Error in saving delivery details in the database", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Exported to RDFs successfully", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Error in RDF export", GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show(strErrMsg.Trim(), GlobalVariables.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { ErrorHandling.WriteErrorLog(ex.ToString()); } }