private void FillCombo()
        {
            try
            {
                using (TaxiDataContext db = new TaxiDataContext())
                {
                    //var listofZones = db.Gen_Zones.Where(c => c.MaxLatitude != null).OrderBy(c => c.OrderNo).ToList();
                    //ComboFunctions.FillCombo(listofZones, ddlZone, "ZoneName", "Id");


                    var listofDrvs = (from a in db.Fleet_DriverQueueLists
                                      where a.Status != null && a.Status == true && a.DriverId != null && a.Fleet_Driver.HasPDA == true
                                      select new
                    {
                        Id = a.DriverId,
                        DriverName = a.Fleet_Driver.DriverNo + " - " + a.Fleet_Driver.DriverName
                    }).ToList();

                    ComboFunctions.FillCombo(listofDrvs, ddlDriver, "DriverName", "Id");
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #2
0
        void frmPlotDriver_Shown(object sender, EventArgs e)
        {
            if (IsPlotting)
            {
                if (AppVars.objPolicyConfiguration.EnablePDA.ToBool())
                {
                    ComboFunctions.FillFreezePlottedDriverNoCombo(ddl_Driver);
                }
                else
                {
                    ComboFunctions.FillDriverNoCombo(ddl_Driver);
                }

                ComboFunctions.FillZonesPlottedCombo(ddlZone);
                ComboFunctions.FillVehicleCombo(ddlVehicle);
            }
            else
            {
                Pg_Ordering.Item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                Pg_Main.Text = "Un-Plot";

                ddlZone.Enabled    = false;
                ddlVehicle.Enabled = false;
                lblZone.Enabled    = false;

                var list1 = General.GetQueryable <Fleet_DriverQueueList>(a => a.DriverId != null && a.Status == true);

                var query = from a in list1

                            orderby a.QueueDateTime
                            select new
                {
                    Id       = a.Id,
                    DriverNo = a.Fleet_Driver.DriverNo + " - " + a.Fleet_Driver.DriverName,
                };

                ComboFunctions.FillCombo(query.ToList(), ddl_Driver, "DriverNo", "Id");
            }

            ddl_Driver.RootElement.Focus();
            ddl_Driver.RootElement.Children[0].Focus();

            IsFormLoaded = true;


            if (DriverId != 0)
            {
                DriverQueueBO objMaster = new DriverQueueBO();
                objMaster.GetByPrimaryKey(DriverId);

                ddl_Driver.SelectedValue = objMaster.Current.DriverId.ToInt();
                ddlZone.SelectedValue    = objMaster.Current.ZoneId.ToInt();
                ddlVehicle.SelectedValue = objMaster.Current.FleetMasterId.ToInt();
            }
        }
        private void ddlCompany_SelectedValueChanged(object sender, EventArgs e)
        {
            if (grdLister.Columns.Count == 0)
            {
                return;
            }

            int?companyId = ddlCompany.SelectedValue.ToIntorNull();


            if (companyId == null)
            {
                SetOrderNoColumn(false);
                SetPupilNoColumn(false);
                SetBookedByColumn(false);
                ClearDepartment();
                ClearCostCenter();
                ClearOrderNo();
            }
            else
            {
                Gen_Company obj = General.GetObject <Gen_Company>(c => c.Id == companyId);
                if (obj != null)
                {
                    this.companyEmail = obj.Email.ToStr().Trim();
                    FillDepartmentCombo(obj.Id);
                    FillCostCenterCombo(obj.Id);
                    bool orderNo = obj.HasOrderNo.ToBool();
                    bool pupilNo = obj.HasPupilNo.ToBool();

                    bool HasBookedBy = obj.HasBookedBy.ToBool();
                    SetOrderNoColumn(orderNo);
                    SetPupilNoColumn(pupilNo);
                    SetBookedByColumn(HasBookedBy);


                    if (orderNo)
                    {
                        var list = General.GetQueryable <Booking>(c => c.CompanyId == obj.Id && (c.OrderNo != null && c.OrderNo != ""))
                                   .Select(args => new { Id = args.OrderNo, OrderNo = args.OrderNo }).Distinct().ToList();

                        ComboFunctions.FillCombo(list, ddlOrderNo, "OrderNo", "Id");

                        ddlOrderNo.Visible = true;
                        label5.Visible     = true;
                    }
                    else
                    {
                        ddlOrderNo.Visible = false;
                        label5.Visible     = false;
                    }
                }
            }
        }
        private void FillCombo()
        {
            var list = (from a in General.GetQueryable <Gen_ShuttleZone>(null)
                        select new
            {
                Id = a.Id,
                ZoneName = a.ZoneName + " ( " + a.PostCodes + " ) "
            }).ToList();



            ComboFunctions.FillCombo(list, ddlZone, "ZoneName", "Id");
        }
 void ddlSubCompany_SelectedValueChanged(object sender, EventArgs e)
 {
     if (IsLoaded)
     {
         int Id = ddlSubCompany.SelectedValue.ToInt();
         if (Id > 0)
         {
             var list = (from a in General.GetQueryable <Fleet_Driver>(c => (c.SubcompanyId == Id) && (c.DriverTypeId == Enums.DRIVERTYPES.RENT) && (c.IsActive == true))
                         orderby a.DriverNo
                         select new
             {
                 Id = a.Id,
                 DriverName = a.DriverNo + " - " + a.DriverName
             }).ToList();
             ComboFunctions.FillCombo(list, ddl_Driver, "DriverName", "Id");
         }
     }
 }