Пример #1
0
        public void GetDriver()
        {
            try
            {
                int Id = objMaster.Current == null ? 0 : objMaster.Current.Id;
                //if (Id > 0)
                //{
                //    btnSaveShift.Enabled = true;
                //}
                //else
                //{
                //    btnSaveShift.Enabled = false;
                //}
                using (TaxiDataContext db = new TaxiDataContext())
                {
                    var list2 = db.stp_GetDriverShifts(Id).ToList();

                    var list = (list2.AsEnumerable().OrderBy(item => item.DriverNo, new NaturalSortComparer <string>())).ToList();
                    list = list.OrderByDescending(c => c.Fleet_Driver_ShiftsId).ToList();
                    grdDriverShift.RowCount = list.Count;
                    for (int i = 0; i < list.Count; i++)
                    {
                        grdDriverShift.Rows[i].Cells[COLS.DriverId].Value              = list[i].Id;
                        grdDriverShift.Rows[i].Cells[COLS.Check].Value                 = list[i].Fleet_Driver_ShiftsId != null?true:false;
                        grdDriverShift.Rows[i].Cells[COLS.DriverNo].Value              = list[i].DriverNo;
                        grdDriverShift.Rows[i].Cells[COLS.Driver].Value                = list[i].DriverName;
                        grdDriverShift.Rows[i].Cells[COLS.Driver_Shift_ID].Value       = list[i].Driver_Shift_ID;
                        grdDriverShift.Rows[i].Cells[COLS.Fleet_Driver_Shift_ID].Value = list[i].Fleet_Driver_ShiftsId;
                    }
                }
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }