private void BunifuButton2_Click(object sender, EventArgs e) { string code = Conversions.ToString(cboTruckingCompany.SelectedValue); reportList.Clear(); VW_CompanyCompanyType c = (VW_CompanyCompanyType)cboTruckingCompany.SelectedItem; if (!SelectedCarrierCodeList.Contains(Strings.Trim(Conversions.ToString(c.CompanyCode)))) { SelectedCarrierCodeList.Add(Strings.Trim(Conversions.ToString(c.CompanyCode))); } if (!firstLoad) { MdlLoadingSetting.waitForm.Show(); if (!Information.IsNothing(cboTruckingCompany.SelectedValue) & goodToGo()) { if (!fromDatePicker.CustomFormat.Equals("")) { TEFDT = dbCeres.getTableInfo("TEF_Rate", "*", "where FromDate <= '" + Conversions.ToString(fromDatePicker.Value.Date) + "' and (ToDate is null or ToDate <='" + Conversions.ToString(toIDatePicker.Value.Date) + "')"); FSC_Rate = dbCeres.getTableInfo("FSC_Rate", "*", " where From_Date <= '" + Conversions.ToString(fromDatePicker.Value.Date) + "' And (To_Date >= '" + Conversions.ToString(toIDatePicker.Value.Date) + "' or To_Date is null) order by From_Date"); populateServices(); } drayageRates = dbCeres.getTableInfo("DrayageSchemeRate", "*", " where TruckingCompany = '" + Strings.Trim(Conversions.ToString(cboTruckingCompany.SelectedValue)) + "' order by FromDate"); var endDate = Convert.ToDateTime(toIDatePicker.Value.Date.ToShortDateString() + " 23:59:59".ToString()); var StartDate = Convert.ToDateTime(fromDatePicker.Value.Date.ToShortDateString() + " 00:00:00".ToString()); reportList = ContainersInOutDrayageService.GetByDrayageRates(Strings.Trim(Conversions.ToString(cboBookingNumber.SelectedItem)), Strings.Trim(cboPickUp.Text), Strings.Trim(cboDropOff.Text), Strings.Trim(cboDriverId.Text), StartDate, endDate, SelectedCarrierCodeList, streetTurnToggleSwitch.Value, btnRemoveDate.Visible); dgvTest.DataSource = reportList; } populateReport(); filterReportTable(); populateReport(); updateRatesReport(); } if (dgvTest.Rows.Count > 0) { printButton.Enabled = true; } else { printButton.Enabled = false; } foreach (DataGridViewColumn column in dgvTest.Columns) { column.SortMode = DataGridViewColumnSortMode.Automatic; } MdlLoadingSetting.waitForm.Close(); }
private void blockContainerButton_ButtonClick(object sender, EventArgs e) { string container = ""; string lineCode = ""; string lineName = ""; VW_CompanyCompanyType ssLineObj = (VW_CompanyCompanyType)cboShippingLine.SelectedItem; var blockTillDate = DateAndTime.Now; for (int i = 0, loopTo = goodContDataGrid.Rows.Count - 1; i <= loopTo; i++) { container = Conversions.ToString(goodContDataGrid.Rows[i].Cells[0].Value); lineCode = ssLineObj.CompanyCode; lineName = ssLineObj.CompanyName; db.saveBlockedContainers(container, lineCode, lineName, DateAndTime.Now.Date, blockTillDate.AddDays((double)NumericUpDown1.Value).Date); } titleLabel.Text = "The containers were blocked successfuly!"; titleLabel.ForeColor = Color.Green; cleanDataGrids(); }
public void getEDIs(BunifuDataGridView ediDataGrid) { string condition = ""; string table; string EDIMode; decimal GrossWeight = 0m; string inputSource; string TruckDriverName = ""; string gateDate; string gateTime; string TruckNumber = ""; string contSize = ""; decimal tareWeight; DateTime ediModDateTime; DateTime datimeTineInsideFile; string datimeTineInsideFileStr; DateTime gateTimeDate; var ediorgTimeDate = default(DateTime); DateTime dTRequestSent; var dTRequestSentStr = default(string); string ssLineCode; string bkgnRelNumb; DateTime tempDateTime, tempTime; string confHandshakeEdi = ""; string location; string carrierCode; string dateAndTimeRequested; // Set different queries for in-gate EDI and out-gate EDI if (tabinoutGate.SelectedIndex == 0) { EDIMode = "IN-GATE"; InGateDataGridView.Rows.Clear(); condition = "on [In-Out Unique ID] = [Unique ID] "; table = "(select * from [Containers In-Out] where convert(date,[Gate Date In]) >='" + fromInBunifuDatePicker.Value.ToShortDateString() + @"' AND convert(date,[Gate Date In]) <= '" + toInBunifuDatePicker.Value.ToShortDateString() + "' and [Trouble In-Gate] = 0 and [In Gate EDI] = 1 and (" + getEDIssLines() + @")) as c lEFT join (select * from ((select * from[EDI Records] where [Gate Mode] <> 'OUT-GATE') as d LEFT join (select * from [ManualEDILog] ) as m on d.EDIRecID = m.EDIRecordID))as r " ; } else { EDIMode = "OUT-GATE"; OutGateDataGridView.Rows.Clear(); string showOutCans = ""; if (cbShowOutGatedCans.Checked == true) { showOutCans = "and [Gate Date Out] is not null"; } VW_CompanyCompanyType c = (VW_CompanyCompanyType)cboSSLine.SelectedItem; VW_BookingMinibooking b = (VW_BookingMinibooking)bookingComboBox.SelectedItem; var conditionFilter = Operators.AddObject(Operators.AddObject(Operators.AddObject("and ([SS Line Code Out] like '%" + Strings.Trim(Conversions.ToString(c.CompanyCode)) + "%' or [SS Line Code In] like '%" + Strings.Trim(Conversions.ToString(c.CompanyCode)) + "%') and " + " [Booking Number] is not null and [Booking Number] like '%", b.BookingNumber), "%' "), showOutCans); table = Conversions.ToString(Operators.AddObject(Operators.AddObject("(select * from [Containers In-Out] where (" + getEDIssLines() + ") ", conditionFilter), @") as c lEFT join (select * from ((select * from[EDI Records] where [Gate Mode] <> 'IN-GATE') as d LEFT join (select * from [ManualEDILog] ) as m on d.EDIRecID = m.EDIRecordID))as r " )); // toOutBunifuDatePicker.Value.Date + "' and [Trouble In-Gate] = 0 and [In Gate EDI] = 1 condition = "on [Unique ID] = [In-Out Unique ID]"; } if (isRefresh) { InOutEDIRecDT = dbCeres.getTableInfo(table, "*", condition); searchTable = InOutEDIRecDT; } foreach (DataRow row in searchTable.Rows) { if (tabinoutGate.SelectedIndex == 0) { if (row["Yard Code In"] != DBNull.Value) { location = Strings.Trim(Conversions.ToString(row["Yard Code In"])); } else { location = "N/A"; } if (row["Carrier Truck In"] == DBNull.Value) { TruckNumber = ""; } else { TruckNumber = Strings.Trim(Conversions.ToString(row["Carrier Truck In"])); } if (row["Carrier DriverName In"] == DBNull.Value) { TruckDriverName = Strings.Trim("N/A"); } else { TruckDriverName = Strings.Trim(Conversions.ToString(row["Carrier DriverName In"])); } bkgnRelNumb = Strings.Trim(Conversions.ToString(row["Release Number"])); ssLineCode = Strings.Trim(Conversions.ToString(row["SS Line Code In"])); carrierCode = Strings.Trim(Conversions.ToString(row["Carrier Code In"])); if (row["ConfHandShakeDateTime"] != DBNull.Value) { ediorgTimeDate = Conversions.ToDate(row["ConfHandShakeDateTime"]); confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); if (row["EDIModDateTime"] != DBNull.Value) { datimeTineInsideFile = Conversions.ToDate(row["EDIModDateTime"]); datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm"); // ediorgTimeDate = row["EDIOriginalDateTime") confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); } else if (row["In Gate EDI Date Time"] != DBNull.Value) { ediorgTimeDate = Conversions.ToDate(row["ConfHandShakeDateTime"]); confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); datimeTineInsideFile = Conversions.ToDate(row["Gate Date In"]); datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm"); } else { datimeTineInsideFileStr = "N/A"; } if (row["Date and Time"] != DBNull.Value) { dTRequestSent = Conversions.ToDate(row["Date and Time"]); dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm"); } else { dTRequestSent = Conversions.ToDate("N/A"); } } else { datimeTineInsideFileStr = "N/A"; if (row["In Gate EDI Date Time"] != DBNull.Value) { ediorgTimeDate = Conversions.ToDate(row["Gate Date In"]); confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); datimeTineInsideFileStr = confHandshakeEdi; } else { confHandshakeEdi = "N/A"; } if (row["Date and Time"] != DBNull.Value) { dTRequestSent = Conversions.ToDate(row["Date and Time"]); dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm"); } else { dTRequestSentStr = "N/A"; } } gateTimeDate = Conversions.ToDate(row["Gate Date In"]); gateDate = gateTimeDate.ToString("dd-MMM-yyyy"); gateTime = gateTimeDate.ToString("HH:mm"); } else { if (row["Booking Number"] != DBNull.Value) { bkgnRelNumb = Strings.Trim(Conversions.ToString(row["Booking Number"])); } else { bkgnRelNumb = "N/A"; } if (row["SS Line Code Out"] == DBNull.Value) { ssLineCode = ""; } else { ssLineCode = Strings.Trim(Conversions.ToString(row["SS Line Code Out"])); } if (row["Carrier Code Out"] != DBNull.Value) { carrierCode = Strings.Trim(Conversions.ToString(row["Carrier Code Out"])); } else { carrierCode = ""; } if (row["Yard Code Out"] != DBNull.Value) { location = Strings.Trim(Conversions.ToString(row["Yard Code Out"])); } else { location = "N/A"; } if (row["Carrier Truck Out"] == DBNull.Value) { TruckNumber = "N/A"; } else { TruckNumber = Strings.Trim(Conversions.ToString(row["Carrier Truck Out"])); } if (row["Carrier DriverName Out"] == DBNull.Value) { TruckDriverName = "N/A"; } else { TruckDriverName = Strings.Trim(Conversions.ToString(row["Carrier DriverName Out"])); } if (row["ConfHandShakeDateTime"] != DBNull.Value) { ediorgTimeDate = Conversions.ToDate(row["ConfHandShakeDateTime"]); confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); if (row["EDIModDateTime"] != DBNull.Value) { datimeTineInsideFile = Conversions.ToDate(row["EDIModDateTime"]); datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm"); // ediorgTimeDate = row["EDIOriginalDateTime") confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); } else if (row["Out Gate EDI Date Time"] != DBNull.Value) { ediorgTimeDate = Conversions.ToDate(row["ConfHandShakeDateTime"]); confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); if (row["Gate Date Out"] != DBNull.Value) { datimeTineInsideFile = Conversions.ToDate(row["Gate Date Out"]); datimeTineInsideFileStr = datimeTineInsideFile.ToString("dd-MMM-yyyy HH:mm"); } else { datimeTineInsideFileStr = "N/A"; } } else { datimeTineInsideFileStr = "N/A"; } if (row["Date and Time"] != DBNull.Value) { dTRequestSent = Conversions.ToDate(row["Date and Time"]); dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm"); } else { dTRequestSent = Conversions.ToDate("N/A"); } } else { datimeTineInsideFileStr = "N/A"; if (row["Out Gate EDI Date Time"] != DBNull.Value && row["Gate Date Out"] != DBNull.Value) { ediorgTimeDate = Conversions.ToDate(row["Gate Date Out"]); confHandshakeEdi = ediorgTimeDate.ToString("dd-MMM-yyyy HH:mm"); datimeTineInsideFileStr = confHandshakeEdi; } else { confHandshakeEdi = "N/A"; } } if (row["Gate Date Out"] != DBNull.Value) { gateTimeDate = Conversions.ToDate(row["Gate Date Out"]); gateDate = gateTimeDate.ToString("dd-MMM-yyyy"); gateTime = gateTimeDate.ToString("HH:mm"); } else { gateDate = ""; gateTime = ""; } if (row["Date and Time"] != DBNull.Value) { dTRequestSent = Conversions.ToDate(row["Date and Time"]); dTRequestSentStr = dTRequestSent.ToString("dd-MMM-yyyy HH:mm"); } else { dTRequestSentStr = "N/A"; } } try { contSize = Conversions.ToString(row["ContainerSize"]); } catch { contSize = ""; } if (row["Input Source"].Equals("SYSTEM")) { inputSource = "SYSTEM"; } else if (tabinoutGate.SelectedIndex == 1) { if (row["Input Source"] == DBNull.Value) { if (row["Out Gate EDI Date Time"] == DBNull.Value) { inputSource = ""; } else { inputSource = "SYSTEM"; } } else { inputSource = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject("PRE-SEND " + Constants.vbNewLine + "By: ", row["User Name"]), Constants.vbNewLine), "Date/Time: "), ediorgTimeDate.ToString("dd-MMM-yyyy hh:mm tt"))); } } else if (row["Input Source"] == DBNull.Value) { if (row["In Gate EDI Date Time"] == DBNull.Value) { inputSource = ""; } else { inputSource = "SYSTEM"; } } else { inputSource = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject("RESEND " + Constants.vbNewLine + "By: ", row["User Name"]), Constants.vbNewLine), "Date/Time: "), ediorgTimeDate.ToString("dd-MMM-yyyy hh:mm tt"))); } if (row["TARE Weight"] != DBNull.Value) { tareWeight = (decimal)MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["TARE Weight"])); } else { tareWeight = 0m; } // GrossWeight = DoFunctions.CVS(row["Gross Weight"]) if (row["Gross Weight"] != DBNull.Value) { GrossWeight = (decimal)MdlContainerManagement.DoFunctions.CVS(Conversions.ToString(row["Gross Weight"])); } else { GrossWeight = 0m; } ediDataGrid.Rows.Add(row["Unique ID"], null, Strings.Trim(Conversions.ToString(row["Container Number"])), location, datimeTineInsideFileStr, confHandshakeEdi, gateDate + " " + gateTime, dTRequestSentStr, inputSource, ssLineCode, bkgnRelNumb, contSize, (object)GrossWeight, (object)tareWeight, carrierCode, TruckNumber, TruckDriverName); } }