예제 #1
0
        private void LoadDataGridView()
        {
            using (var db = new WTCCeresEntities())
            {
                listTruckDriver = TruckDriverService.GetDriverTruckDropBox(db);
            }

            var L = (from b in listTruckDriver
                     where b.TruckDriverId.Equals(DriverId)
                     select b).ToList();

            TruckDriverListBindingSourceGridView.DataSource = L.ToList();
        }
예제 #2
0
        public bool VerifyPortPassId(string PortPass, int TruckDriverId)
        {
            bool   isPort      = false;
            string PortPassOld = "";
            var    L           = TruckDriverService.GetByTruckId(TruckDriverId);

            foreach (var item in L)
            {
                PortPassOld = item.PortPassId;
            }
            if ((PortPass ?? "") == (PortPassOld ?? ""))
            {
                isPort = true;
                return(isPort);

                return(default);
예제 #3
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */

        public void LoadForm()
        {
            if (TruckDriverId == 0)
            {
                tblTruckDriver.Visible = true;
                // tblPassCard.Visible = True
                CompaniesNameBindingSource.DataSource = CompanyService.GetCompaniesDropBoxByType("Drayage Provider", true);
                txtPassID.Text        = "";
                txtFirstName.Text     = "";
                txtLastName.Text      = "";
                txtTruckNumber.Text   = "";
                ddlTruckCompanie.Text = "";
                lblTitle.Text         = "Add New Driver";
                ClearForm(true);
                txtPassID.Select();
            }
            else
            {
                tblTruckDriver.Visible = false;
                // tblPassCard.Visible = False
                var listDriver = TruckDriverService.GetByTruckId(TruckDriverId);
                foreach (TruckDriver item in listDriver)
                {
                    txtFirstName.Text = item.FirstName.TrimEnd();
                    txtLastName.Text  = item.LastName.TrimEnd();
                    if (Information.IsNothing(item.SuspendTruckDriver))
                    {
                        ckbSuspend.Checked = false;
                    }
                    else
                    {
                        ckbSuspend.Checked = item.SuspendTruckDriver == true;
                    }

                    txtPassID.Text      = item.PortPassId;
                    txtTruckNumber.Text = item.TruckNumber;
                }

                lblTitle.Text = "Update Info Driver";
                ClearForm(false);
            }
        }
예제 #4
0
        public void LoadForm()
        {
            using (var db = new WTCCeresEntities())
            {
                CompaniesNameBindingSource.DataSource = CompanyService.GetCompaniesDropBoxByTypeId(6, db);
                listTruckDriver = TruckDriverService.GetDriverTruckDropBox(db);
            }

            if (DriverId != 0)
            {
                var List = (from b in listTruckDriver
                            where b.TruckDriverId.Equals(DriverId)
                            select b).ToList();
                foreach (var item in List)
                {
                    lblNameDriver.Text = item.FirstName + " " + item.LastName;
                }
                TruckDriverListBindingSourceGridView.DataSource = List.ToList();
            }
        }
예제 #5
0
        public bool VerifyPortPassId(string PortPass, int TruckCompanyId)
        {
            bool   isPort      = false;
            string PortPassOld = "";
            var    L           = TruckDriverCompanyService.GetById(TruckCompanyId);

            foreach (var item in L)
            {
                var Li = TruckDriverService.GetByTruckId((int)item.TruckDriverId);
                foreach (var itemd in Li)
                {
                    PortPassOld = itemd.PortPassId;
                }
            }

            if ((PortPass ?? "") == (PortPassOld ?? ""))
            {
                isPort = true;
                return(isPort);
            }

            return(isPort);
        }
예제 #6
0
        /* TODO ERROR: Skipped RegionDirectiveTrivia */

        private void btnSuspend_Click(object sender, EventArgs e)
        {
            // Se activeToggleSwitch = True na base de dados tem que estar false
            if (activeToggleSwitch.Value == true)
            {
                if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to suspend the selected truck driver?", "", My.Resources.Resources.warning, this) == DialogResult.Yes)
                {
                    foreach (DataGridViewRow row in dgvTruckDrivers.Rows)
                    {
                        try
                        {
                            string value         = Conversions.ToString(row.Cells[0].Value);
                            short  IdTruckDriver = Conversions.ToShort(row.Cells[1].Value);
                            if (!Information.IsNothing(value) && value.Equals("✔"))
                            {
                                if (TruckDriverService.SuspendTruckDriver(IdTruckDriver, false) == false)
                                {
                                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error updating data. Contact the IT department. Code Error #1365.", "", this);
                                    return;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            string a = ex.ToString();
                        }
                    }

                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Information updated successfully.", "", this);
                    // btnSuspend.Visible = False
                }
            }
            else if (My.MyProject.Forms.MessageBoxCeresYesNo.ShowDialog("Are you sure you want to revoke suspend the selected truck driver?", "", My.Resources.Resources.warning, this) == DialogResult.Yes)
            {
                foreach (DataGridViewRow row in dgvTruckDrivers.Rows)
                {
                    try
                    {
                        string value         = Conversions.ToString(row.Cells[0].Value);
                        short  IdTruckDriver = Conversions.ToShort(row.Cells[1].Value);
                        if (!Information.IsNothing(value) && value.Equals("✔"))
                        {
                            if (TruckDriverService.SuspendTruckDriver(IdTruckDriver, false) == true)
                            {
                                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Error updating data. Contact the IT department. Code Error #1365.", "", this);
                                return;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        string a = ex.ToString();
                    }
                }

                My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Information updated successfully.", "", this);
                // btnSuspend.Visible = False
            }

            waitLoading.Show();
            using (var db = new WTCCeresEntities())
            {
                listTruckDriver = TruckDriverService.GetTruckDriverAllList(db);
            }

            SearchByColumn();
            waitLoading.Close();
        }