예제 #1
0
        private void cboVehicle_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
        {
            cboVehicle.Items.Clear();

            Orchestrator.Facade.IVehicle facResource = new Orchestrator.Facade.Resource();
            DataSet    ds = facResource.GetAllVehicles();
            List <int> excludedVehicles = null;

            using (var uow = DIContainer.CreateUnitOfWork())
            {
                var repo = DIContainer.CreateRepository <Repositories.IVehicleExcludedFromRevenueReportRepository>(uow);
                excludedVehicles = repo.GetExcludedVehicleIds().ToList();
                if (excludedVehicles == null)
                {
                    excludedVehicles = new List <int>();
                }
            }

            List <Telerik.Web.UI.RadComboBoxItem> comboItems =
                (from row in ds.Tables[0].Rows.Cast <DataRow>()
                 where !excludedVehicles.Contains(Convert.ToInt32(row["ResourceId"]))
                 select new Telerik.Web.UI.RadComboBoxItem
            {
                Value = row["ResourceId"].ToString(),
                Text = row["RegNo"].ToString()
            }).GroupBy(item => item.Value).Select(grp => grp.First()).ToList();

            comboItems.Sort((item1, item2) => item1.Text.CompareTo(item2.Text));
            cboVehicle.Items.AddRange(comboItems);
        }
예제 #2
0
    void btnOK_Click(object sender, EventArgs e)
    {
        Orchestrator.Entities.DriverType dt = null;
        if (this.VS_DriverType != null)
        {
            dt = this.VS_DriverType;
        }
        else
        {
            dt = new DriverType();
        }

        dt.Description = txtDescription.Text;
        dt.Monday      = chkMonday.Checked;
        dt.Tuesday     = chkTuesday.Checked;
        dt.Wednesday   = chkWednesday.Checked;
        dt.Thursday    = chkThursday.Checked;
        dt.Friday      = chkFriday.Checked;
        dt.Saturday    = chkSaturday.Checked;
        dt.Sunday      = chkSunday.Checked;
        dt.StartTime   = rtpStartTime.SelectedDate.Value;
        dt.FinishTime  = rtpFinishTime.SelectedDate.Value;

        Orchestrator.Facade.IDriver facDriver = new Orchestrator.Facade.Resource();
        int retVal = facDriver.UpdateDriverType(dt, this.Page.User.Identity.Name);

        if (retVal > 0)
        {
            InjectScript.Text = @"<script>RefreshParentPage();</script>";
            return;
        }

        lblError.Visible = true;
        lblError.Text    = "There was an error please try again.";
    }
예제 #3
0
    private void LoadDriverType()
    {
        Orchestrator.Facade.IDriver      facDriver = new Orchestrator.Facade.Resource();
        Orchestrator.Entities.DriverType dt        = facDriver.GetDriverType(_driverTypeID);

        this.VS_DriverType         = dt;
        txtDescription.Text        = dt.Description;
        chkMonday.Checked          = dt.Monday;
        chkTuesday.Checked         = dt.Tuesday;
        chkWednesday.Checked       = dt.Wednesday;
        chkThursday.Checked        = dt.Thursday;
        chkFriday.Checked          = dt.Friday;
        chkSaturday.Checked        = dt.Saturday;
        chkSunday.Checked          = dt.Sunday;
        rtpStartTime.SelectedDate  = dt.StartTime == DateTime.MinValue ? DateTime.Now.Date : dt.StartTime;
        rtpFinishTime.SelectedDate = dt.FinishTime == DateTime.MinValue ? DateTime.Now.Date : dt.FinishTime;
    }
예제 #4
0
 void grdNominalCodes_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     Orchestrator.Facade.IDriver facDriver = new Orchestrator.Facade.Resource();
     this.grdNominalCodes.DataSource = facDriver.GetAllDriverTypes();
 }