コード例 #1
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();
            }
        }
コード例 #2
0
        public bool Delete(string PortPassID)
        {
            bool isDelete = true;

            try
            {
                td = db.Truck_Drivers.Find(PortPassID);
                db.Truck_Drivers.Remove(td);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
コード例 #3
0
        public bool Update(string PortPassId, string FirstName, string LastName, string TruckCompanyCode, string TruckCompanyName, string TruckNumber, bool SuspendyTruckDriver)
        {
            bool isSave = true;

            try
            {
                td = db.Truck_Drivers.Find(PortPassId);
                td.Port_Pass_ID         = PortPassId;
                td.First_Name           = FirstName;
                td.Last_Name            = LastName;
                td.Truck_Company_ID     = TruckCompanyCode;
                td.Truck_Company_Name   = TruckCompanyName;
                td.Truck_Number         = TruckNumber.ToString();
                td.Suspend_Truck_Driver = SuspendyTruckDriver;
                db.Truck_Drivers.AddOrUpdate(td);
                db.SaveChanges();
            }
            catch (Exception)
            {
                isSave = false;
            }
            return(isSave);
        }