示例#1
0
        private void btnReturn_Click(object sender, EventArgs e)
        {
            int MiniUnitOrder = Convert.ToInt32(dgvMiniUnit.CurrentRow.Cells[0].Value);
            int MaxMU         = Convert.ToInt32(dgvMiniUnit.CurrentRow.Cells[1].Value);
            int UpdateMaxMU   = MaxMU + Convert.ToInt16(nudMaxSplitMU.Value);
            int count         = 0;

            // 1 - Insert the updated value
            if (gboMain.Text == "Bulk")
            {
                dbCeres.getDataByQuery("update miniunit set TotalBilled = " + UpdateMaxMU.ToString() + " where UnitSourceId = " + UnitSourceId.ToString() + " and MiniUnitOrder = " + MiniUnitOrder.ToString());
            }
            else
            {
                dbCeres.getDataByQuery("update miniunit set PCBilled = " + UpdateMaxMU.ToString() + " where UnitSourceId = " + UnitSourceId.ToString() + " and MiniUnitOrder = " + MiniUnitOrder.ToString());
            }

            // 2 - Deletes the MiniUnit row
            dbCeres.deleteMiniUnit("delete from MiniUnit where MiniUnitId = " + MiniUnitId.ToString());

            // 3 - Updates the order of Mini Units
            foreach (DataRow mini in dbCeres.getTableInfo("MiniUnit", "*", "where UnitSourceId = " + UnitSourceId.ToString() + " order by MiniUnitId").Rows)
            {
                count += 1;
                dbCeres.getDataByQuery("update miniunit set MiniUnitOrder = " + count.ToString() + " where MiniUnitId = " + mini["MiniUnitId"].ToString());
            }

            MessageBox.Show("Return made successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            My.MyProject.Forms.FrmEditAddRailList.PopulateMU();
            Close();
        }
示例#2
0
        private void loadComboBoxes()
        {
            CompanyService.GetAll();
            try
            {
                panelCarriers.Hide();
                object truckingCompanies;
                object terminalsPickUp;
                object terminalsDropOff;
                using (var db = new WTCCeresEntities())
                {
                    truckingCompanies = CompanyService.GetAllByCompanyTypeId((int)MdlEnum.CompanyType.Drayage_Provider, db);
                    terminalsPickUp   = CompanyService.GetAllByType(((int)MdlEnum.CompanyType.Container_Terminal).ToString(), db);
                    terminalsDropOff  = CompanyService.GetAllByCompanyTypeId((int)MdlEnum.CompanyType.Container_Terminal, db);
                }

                var driverId = TruckDriversService.GetAll();
                var tr       = new Company();
                var dtid     = new Truck_Drivers();
                dtid.Port_Pass_ID = "";
                driverId.Insert(0, dtid);
                var bookingsDT = new DataTable();
                firstLoad = true;
                var cp = new Company();
                using (var db = new WTCCeresEntities())
                {
                    dgvExtraCarriers.DataSource = CompanyService.GetAllByCompanyTypeId((int)MdlEnum.CompanyType.Drayage_Provider, db).Where(c => c.CompanyId != 0).ToList();
                }

                cboTruckingCompany.DataSource = truckingCompanies;
                cboPickUp.DataSource          = terminalsPickUp;
                cboDropOff.DataSource         = terminalsDropOff;
                cboDriverId.DataSource        = driverId;
                cboPickUp.SelectedValue       = "";
                cboDropOff.SelectedValue      = "";
                cboDriverId.SelectedValue     = "";
                string truckComp = "(" + Strings.Trim(Conversions.ToString(cboTruckingCompany.SelectedValue)) + ") " + Strings.Trim(cboTruckingCompany.SelectedText);
                cboTruckingCompany.DropDownHeight = Height - 200;
                string query = @"  select * from (select distinct(Trim([Release Number])) as fileNumber from [Containers In-Out] where [Release Number] is not null and [Release Number] <> ''
  union
  select distinct(Trim([BookingNumber])) as fileNumber from booking where [BookingNumber] is not null and [BookingNumber] <> '') fn
  order by fileNumber";
                bookingsDT = dbCeres.getDataByQuery(query);
                var newrow = bookingsDT.NewRow();
                newrow["fileNumber"] = " ALL";
                bookingsDT.Rows.Add(newrow);
                cboBookingNumber.Items.Clear();
                cboBookingNumber.Items.Add("ALL");
                foreach (DataRow booking in bookingsDT.Rows)
                {
                    cboBookingNumber.Items.Add(booking["fileNumber"]);
                }
                cboBookingNumber.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                Debugger.Break();
            }
        }