private void FrmCarrierAssignment_Load(object sender, EventArgs e) { CarrierAssignments1.AskForWeekDateRange(DateAndTime.Today.Date); // Dim StDate As Date, FnDate As Date // StDate = GiveStartOfWeek(Today.Date) // FnDate = DateAdd("d", 6, StDate) // Stop }
private void CarrierAssignments1_RequestAssignmentForWeek(DateTime StartDate, DateTime EndDate) { int x = 0; string BlankCans = DoFunctions.MKI(0) + DoFunctions.MKI(0) + DoFunctions.MKI(0); string TempLine = ""; string Terminals = ""; string CanInfo = ""; string TestLine = ""; string DeliveredCans = FetchAllDeliveredCans(); var DbObjDataTable = new DataTable(); var DbObjAdapter = new System.Data.SqlClient.SqlDataAdapter("Select * From [VW_ActiveCarrierBookings] Where LRD >=' " + StartDate + "' And LRD < = '" + EndDate + "'", StrConnWTCCeres); var DbObjCommand = new System.Data.SqlClient.SqlCommandBuilder(DbObjAdapter); DbObjAdapter.Fill(DbObjDataTable); foreach (DataRow ThisRow in DbObjDataTable.Rows) { CanInfo = GiveCanInfo(DoFunctions.PadToString(Conversions.ToString(ThisRow["Booking Number"]), 40), Conversions.ToShort(ThisRow["Number Of Containers"]), DeliveredCans); var loopTo = Strings.Len(TempLine); for (x = 1; x <= loopTo; x += 26) { if ((DoFunctions.PadToString(Conversions.ToString(ThisRow["Carrier ID"]), 10) + DoFunctions.PadToString(Conversions.ToString(ThisRow["Terminal Code"]), 10) ?? "") == (Strings.Mid(TempLine, x, 20) ?? "") & (Strings.Mid(TempLine, 20 + x, 6) ?? "") != (BlankCans ?? "")) { var midTmp = AddCanInfo(Strings.Mid(TempLine, x + 20, 6), CanInfo); StringType.MidStmtStr(ref TempLine, x + 20, 6, midTmp); goto MoveOn; } } TempLine += DoFunctions.PadToString(Conversions.ToString(ThisRow["Carrier ID"]), 10) + DoFunctions.PadToString(Conversions.ToString(ThisRow["Terminal Code"]), 10) + CanInfo; MoveOn: ; } Terminals = GiveTerminals(TempLine); CarrierAssignments1.TakeCarrierAssignments(Terminals, TempLine); }