Exemple #1
0
        public override int GetHashCode()
        {
            int hashCode = -614202023;

            if (Context != null)
            {
                hashCode += Context.GetHashCode();
            }

            if (Shifts != null)
            {
                hashCode += Shifts.GetHashCode();
            }

            if (Cursor != null)
            {
                hashCode += Cursor.GetHashCode();
            }

            if (Errors != null)
            {
                hashCode += Errors.GetHashCode();
            }

            return(hashCode);
        }
Exemple #2
0
        public Shifts GetShiftMasterWithId(Int64 shiftId)
        {
            var objShifts = new Shifts();

            try
            {
                using (var context = new NLTDDbContext())
                {
                    if (shiftId > 0)
                    {
                        objShifts = (from s in context.ShiftMaster
                                     where s.ShiftID == shiftId
                                     select new Shifts
                        {
                            ShiftId = s.ShiftID,
                            ShiftName = s.ShiftDescription,
                            FromTime = s.FromTime,
                            ToTime = s.ToTime
                        }).SingleOrDefault();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(objShifts);
        }
Exemple #3
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
            node.Add(HeightsName, Heights.ExportYAML(true));
            if (HasShifts(container.ExportVersion))
            {
                node.Add(ShiftsName, Shifts.ExportYAML(container));
            }

            node.Add(PrecomputedErrorName, PrecomputedError.ExportYAML());
            node.Add(MinMaxPatchHeightsName, MinMaxPatchHeights.ExportYAML());
            if (HasDefaultPhysicMaterial(container.ExportVersion))
            {
                node.Add(DefaultPhysicMaterialName, DefaultPhysicMaterial.ExportYAML(container));
            }

            node.Add(WidthName, Width);
            node.Add(HeightName, Height);
            if (HasThickness(container.ExportVersion))
            {
                node.Add(ThicknessName, Thickness);
            }

            node.Add(LevelsName, Levels);
            node.Add(ScaleName, Scale.ExportYAML(container));
            return(node);
        }
        private async System.Threading.Tasks.Task loadLookups()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var lookups = await DataService.GetLookups(4);

                lookups.Shifts.ForEach(s => Shifts.Add(s));
                lookups.Tasks.ForEach(t => Tasks.Add(t));
                lookups.Users.ForEach(u => Users.Add(u));
            }
            catch (Exception ex)
            {
                IsBusy = false;
                ExceptionHelper.ShowException(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #5
0
        private void SaveShiftInfo()
        {
            try
            {
                Shifts shift = new Shifts();
                shift.shiftName = ucShifts1.txtShiftName.Text;
                shift.timeStart = ucShifts1.txtTimeStart.Text;
                shift.timeEnd   = ucShifts1.txtTimeEnd.Text;

                if (isAdd == true)
                {
                    _shiftsRepository.Add(shift);
                    MessageBox.Show("Successful added!");
                    isAdd = false;
                    LoadData();
                    Init();
                }
                else if (isUpdate == true)
                {
                    _shiftsRepository.Update(selectedId, shift);
                    MessageBox.Show("Successful updated!");
                    isUpdate = false;
                    LoadData();
                    Init();
                }
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// For a given Employee, returns the number of hours they work in a month.
        /// </summary>
        /// <returns></returns>
        private double CalculateHours(Employee employee, int weeks = 1)
        {
            int id = employee.Employee_ID;
            List <Employee_Works_Shift> employeeShifts = _context.Employee_Works_Shift.Where(c => c.Employee_ID == id).ToList();
            List <Shifts> shifts     = _context.Shifts.ToList();
            double        totalHours = 0;

            foreach (Employee_Works_Shift shift in employeeShifts)
            {
                int    shiftID   = shift.Shift_ID;
                Shifts shiftData = shifts.FirstOrDefault(c => c.Shift_ID == shiftID);
                // Cross-reference the data between the shifts and employee_works_shift tables.
                //We could feasibly actually merge the data, but this is a much simpler approach.
                if (shiftData != null)
                {
                    double hours = CalculateShiftLength(shiftData);
                    totalHours += hours;
                }
            }
            totalHours *= weeks;
            // There are four weeks in a month (give or take), so simply multiplying up the values gets us the monthly total.
            // In the absence of full monthly data, this will have to do.

            return(totalHours);
        }
Exemple #7
0
        public void Write(AssetWriter writer)
        {
            Heights.Write(writer);
            if (HasAlign(writer.Version))
            {
                writer.AlignStream();
            }
            if (HasShifts(writer.Version))
            {
                Shifts.Write(writer);
                writer.AlignStream();
            }

            PrecomputedError.Write(writer);
            MinMaxPatchHeights.Write(writer);
            if (HasDefaultPhysicMaterial(writer.Version))
            {
                DefaultPhysicMaterial.Write(writer);
            }

            writer.Write(Width);
            writer.Write(Height);
            if (HasThickness(writer.Version))
            {
                writer.Write(Thickness);
            }

            writer.Write(Levels);
            Scale.Write(writer);
        }
 private void SetCreateTemplateScheduleClicked()
 {
     Mediator.GetInstance().CreateTemplateScheduleButtonClicked += (templateSchedule) =>
     {
         if (IsVisible)
         {
             if (Shifts.Count == 0)
             {
                 MessageBox.Show("No shifts has been added!");
             }
             else
             {
                 try
                 {
                     TemplateScheduleProxy templateScheduleProxy = new TemplateScheduleProxy();
                     templateSchedule.TemplateShifts = Shifts;
                     templateScheduleProxy.AddTemplateScheduleToDb(templateSchedule);
                     Shifts.Clear();
                     MessageBox.Show("Template schedule is now saved onto database");
                     Clear();
                 }
                 catch (Exception)
                 {
                     MessageBox.Show("Something went wrong! Templateschedule could not be saved! Too bad");
                 }
             }
         }
     };
 }
Exemple #9
0
 /// <summary>
 /// Find
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Shift FindShift(int id)
 {
     lock (BusinessEntity.m_sDS)
     {
         return(Shifts.Find(s => s.ID == id));
     }
 }
Exemple #10
0
        private void PopulateShifts(ActiveShifts shifts)
        {
            _activeShiftsModel = shifts;
            var startTime = DateTime.Now;

            _log.Info("PopulateShifts method call started");
            LoginModel.Shifts = new List <string>();


            foreach (var shift in _activeShiftsModel.Shifts)
            {
                LoginModel.Shifts.Add(shift.DisplayFormat);
                if (!Shifts.ContainsKey(shift.DisplayFormat))
                {
                    Shifts.Add(shift.DisplayFormat, shift.ShiftNumber);
                }
            }

            LoginModel.TillFloat = _activeShiftsModel.CashFloat.ToString("0.00", CultureInfo.InvariantCulture);
            var endTime = DateTime.Now;

            MessengerInstance.Send(new CloseKeyboardMessage());
            _log.Info(string.Format("PopulateShifts method call ended in {0}ms",
                                    (endTime - startTime).TotalMilliseconds));
        }
Exemple #11
0
        public bool CanWork(IShift shift)
        {
            if (_rules == null)
            {
                throw new ArgumentNullException("IBusinessRules", "Business Rules object must be set before CanWork can be called");
            }

            if (ShiftDuration >= MaxShiftDuration)
            {
                return(false);
            }

            if (!_rules.AllowConsecutiveDays)
            {
                if (Shifts.Any(s => s.Day == shift.Day - 1))
                {
                    return(false);
                }
            }

            if (Shifts.Count(s => s.Day == shift.Day) >= _rules.MaxShiftsPerDay)
            {
                return(false);
            }

            return(true);
        }
Exemple #12
0
        private void GetDetailsById(int Id)
        {
            shift   = new Shifts();
            dbShift = new DBShift();
            DataSet DS = new DataSet();

            shift.ShiftId     = Id;
            shift.ShiftName   = string.Empty;
            shift.StartTime   = string.Empty;
            shift.Description = string.Empty;
            shift.EndTime     = string.Empty;
            shift.Flag        = 2;

            DS = dbShift.GetShiftList(shift);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                txtShiftName.Text  = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ShiftName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ShiftName"].ToString();
                txtDesciption.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Description"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Description"].ToString();
                txtStartTime.Text  = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["StartTime"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["StartTime"].ToString();
                txtEndTime.Text    = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["EndTime"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["EndTime"].ToString();
                dpIsActive.ClearSelection();
                if (DS.Tables[0].Rows[0]["IsActive"].ToString() == "True")
                {
                    dpIsActive.Items.FindByValue("1").Selected = true;
                }
                else
                {
                    dpIsActive.Items.FindByValue("2").Selected = true;
                }
            }
            btnSubmit.Visible = false;
            btnUpdate.Visible = true;
            upModal.Update();
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,WorkDays,StartTime,EndTime,RestDay")] Shifts shifts)
        {
            if (id != shifts.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shifts);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShiftsExists(shifts.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shifts));
        }
Exemple #14
0
        private async Task UpdateSelectedUserAsync()
        {
            ucUsers1.txtFullName.Text    = Users.GetInstance().fullName;
            ucUsers1.txtGrossSalary.Text = Users.GetInstance().grossSalary.ToString();
            ucUsers1.txtNetSalary.Text   = Users.GetInstance().netSalary.ToString();
            ucUsers1.txtDob.Text         = Users.GetInstance().dob.ToString();
            ucUsers1.txtHomeAddress.Text = Users.GetInstance().homeAddress;
            ucUsers1.txtNote.Text        = Users.GetInstance().note;
            ucUsers1.txtPIN.Text         = Users.GetInstance().pin;

            Departments tempDepartment = new Departments();

            tempDepartment = await _departmentRepository.GetByIdAsync(Users.GetInstance().departmentId);

            ucUsers1.cbbDepartment.Items.Add(tempDepartment.id + "." + tempDepartment.departmentName);

            Roles tempRole = new Roles();

            tempRole = await _rolesRepository.GetByIdAsync(Users.GetInstance().roleId);

            ucUsers1.cbbRole.Items.Add(tempRole.id + "." + tempRole.roleName);

            Shifts tempShift = new Shifts();

            tempShift = await _shiftsRepository.GetByIdAsync(Users.GetInstance().shiftId);

            ucUsers1.cbbShift.Items.Add(tempShift.id + "." + tempShift.shiftName);
        }
Exemple #15
0
        public void LoadCollections()
        {
            Areas.Clear();
            Operations.Clear();
            Personal.Clear();
            Shifts.Clear();

            foreach (var area in _collectionsRepository.LoadWorkAreas())
            {
                Areas.Add(area);
            }

            foreach (var operation in _collectionsRepository.LoadWorks())
            {
                Operations.Add(operation);
            }

            foreach (var employee in _collectionsRepository.LoadPersonal())
            {
                Personal.Add(employee);
            }

            foreach (var shift in _collectionsRepository.LoadShiftSet())
            {
                Shifts.Add(shift);
            }
        }
        public void SetOnDepartmentSelected()
        {
            Mediator.GetInstance().CBoxDepartmentChanged += (department) =>
            {
                if (department != null)
                {
                    ScheduleProxy scheduleProxy = new ScheduleProxy();
                    try
                    {
                        Clear();
                        Schedule = scheduleProxy.GetScheduleByDepartmentIdAndDate(department.Id, DateBoxes[0].Date);
                        Shifts   = Schedule.Shifts;
                        LoadShiftsIntoCalendar();
                    }
                    catch (Exception)
                    {
                        Shifts.Clear();

                        Schedule = null;
                        Clear();
                        AddTxtNoSchedule();
                    }
                }
                DepartmentId = department.Id;
                return(Schedule);
            };
        }
        public Point GetShift(Position cursor_position)
        {
            LastPosition = cursor_position;
            CursorPositionUpdated?.Invoke(this, new EventArgs());
            var closest_indices = GetClosestShiftIndexes(cursor_position, Options.Instance.calibration_mode.considered_zones_count);

            if (closest_indices == null)
            {
                Debug.Assert(Shifts.Count() == 0);
                return(new Point(0, 0));
            }

            double sum_of_reverse_distances = 0;

            foreach (var index in closest_indices)
            {
                sum_of_reverse_distances += (1 / index.Item2);
            }

            Point resulting_shift = new Point(0, 0);

            foreach (var index in closest_indices)
            {
                resulting_shift.X += (int)(Shifts[index.Item1].Shift.X / index.Item2 / sum_of_reverse_distances);
                resulting_shift.Y += (int)(Shifts[index.Item1].Shift.Y / index.Item2 / sum_of_reverse_distances);
            }

            return(resulting_shift);
        }
Exemple #18
0
        /// <summary>
        /// Delete this shift
        /// </summary>
        /// <param name="shift">Shift</param>
        public void DeleteShift(Shift shift)
        {
            if (!Shifts.Contains(shift))
            {
                return;
            }

            // can't be in use
            foreach (Shift inUseShift in Shifts)
            {
                foreach (Team team in Teams)
                {
                    Rotation rotation = team.Rotation;

                    foreach (TimePeriod period in rotation.GetPeriods())
                    {
                        if (period.Equals(inUseShift))
                        {
                            string msg = String.Format(WorkSchedule.GetMessage("shift.in.use"), shift.Name);
                            throw new Exception(msg);
                        }
                    }
                }
            }

            Shifts.Remove(shift);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Shifts shifts = db.Shifts.Find(id);

            db.Shifts.Remove(shifts);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #20
0
        /// <summary>
        /// 设置班次
        /// </summary>
        public void SetShifts()
        {
            //设置员工默认班次
            if (EmpNote.Shifts.Count > 0)
            {
                if (EmpNote.AutoShift)
                {
                    AutoChangeShift(EmpNote.Shifts);
                }
                else
                {
                    ChangeShift(EmpNote.Shifts[0]);
                }
            }


            //设置当天已更改的默认班次
            EmpChecks.ForEach(p =>
            {
                if (p.Checks.Count > 0)
                {
                    var mc = p.Checks.OrderBy(o => o.CHECKTIME).First();
                    if (mc.Memoinfo != null)
                    {
                        var cshift = Shifts.SingleOrDefault(s => s.ID == mc.Memoinfo);
                        if (cshift != null)
                        {
                            ChangeShift(p, cshift);
                        }
                    }
                }
            });


            EmpChecks.ForEach(p =>
            {
                if (p.Checks.Count > 0)
                {
                    if (p.AfterCheckDay != null)
                    {
                        for (int i = p.Checks.Count - 1; i >= 0; i--)
                        {
                            if (p.AfterCheckDay.Checks.Contains(p.Checks[i]))
                            {
                                if (p.IsRestDay)
                                {
                                    p.Checks.Remove(p.Checks[i]);
                                }
                                else
                                {
                                    p.AfterCheckDay.Checks.Remove(p.Checks[i]);
                                }
                            }
                        }
                    }
                }
            });
        }
Exemple #21
0
        async System.Threading.Tasks.Task ExecuteLoadScreen()
        {
            if (Users.Count < 1)
            {
                if (IsBusy)
                {
                    return;
                }

                IsBusy = true;

                try
                {
                    var lookups = await DataService.GetLookups(this.EntryType);

                    if (lookups.Shifts != null)
                    {
                        lookups.Shifts.ForEach(s => Shifts.Add(s));
                        if (Entry.ShiftId != null)
                        {
                            Shift = lookups.Shifts.FirstOrDefault(x => x.ShiftId == Entry.ShiftId);
                        }
                    }
                    if (lookups.Statuses != null)
                    {
                        lookups.Statuses.ForEach(s => Statuses.Add(s));
                    }
                    lookups.Tasks.ForEach(t => Tasks.Add(t));
                    if (Entry.TaskId != null)
                    {
                        Task = lookups.Tasks.FirstOrDefault(t => t.TaskId == Entry.TaskId);
                    }
                    lookups.Users.ForEach(u => Users.Add(u));
                    if (Entry.UserId != null)
                    {
                        User = lookups.Users.FirstOrDefault(u => u.UserId == Entry.UserId);
                    }
                    if (Entry.EnteredById == null)
                    {
                        var usr = AuthService.UserToken.User;
                        Entry.EnteredBy   = usr;
                        Entry.EnteredById = usr.UserId;
                    }
                }
                catch (Exception ex)
                {
                    IsBusy = false;
                    ExceptionHelper.ShowException(ex);
                }
                finally
                {
                    IsBusy = false;
                }
            }
            RefreshEntrySubtasks();

            OnPropertyChanged("Entry");
        }
Exemple #22
0
 public virtual void AddShift(DeliveryShift deliveryShift)
 {
     if (Shifts.Any(ds => DomainHelper.EqualDomainObjects(ds, deliveryShift)))
     {
         logger.Warn("Смена {0} уже добавлена. Пропускаем...", deliveryShift.Name);
         return;
     }
     ObservableShifts.Add(deliveryShift);
 }
Exemple #23
0
 public int GetMostLikelySleepingMinute()
 {
     return(Shifts
            .SelectMany(s => s.NapTimes)
            .SelectMany(n => n.SleepingMinutes)
            .GroupBy(m => m)
            .OrderByDescending(g => g.Count())
            .First().Key);
 }
        public void Update(int id, Shifts shifts)
        {
            var shift       = JsonConvert.SerializeObject(shifts);
            var buffer      = Encoding.UTF8.GetBytes(shift);
            var byteContent = new ByteArrayContent(buffer);

            byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
            _client.PutAsync($"/api/v1/shifts/update/{id}", byteContent);
        }
 public ActionResult Edit([Bind(Include = "ID,FristWorker,SecondWorker,TimeRange,Date")] Shifts shifts)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shifts).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create", "Reports"));
     }
     return(View(shifts));
 }
Exemple #26
0
    private Shift GetShift(DayOfWeek day, string strShift)
    {
        if (!Shifts.Any(x => x.Start.DayOfWeek == day && x.ShiftName.Trim() == strShift))
        {
            return(null);
        }
        Shift shift = Shifts.First(x => x.Start.DayOfWeek == day && x.ShiftName.Trim() == strShift);

        return(shift);
    }
        /// <summary>
        /// returns the number of hours in a shift
        /// </summary>
        /// <param name="shift"></param>
        /// <returns></returns>
        private double CalculateShiftLength(Shifts shift)
        {
            DateTime start = shift.Shift_Start;
            DateTime end   = shift.Shift_End;
            TimeSpan span  = end - start;
            double   hours = span.TotalHours;

            // Using span allows the shifts to be irrespective of days, allowing theoretical 24h+ Shifts, or nightshifts that start in the evening and finish the next day.
            return(hours);
        }
Exemple #28
0
        private async Task UpdateSelectedDepartmentAsync()
        {
            ucDepartments1.txtDepartmentName.Text = Departments.GetInstance().departmentName;

            Shifts tempShift = new Shifts();

            tempShift = await _shiftsRepository.GetByIdAsync(Departments.GetInstance().shiftId);

            ucDepartments1.cbbShift.Items.Add(tempShift.id + "." + tempShift.shiftName);
        }
        public async Task <Shifts> GetByIdAsync(int id)
        {
            _response = await _client.GetAsync($"/api/v1/shifts/{id}");

            var json = await _response.Content.ReadAsStringAsync();

            Shifts shift = JsonConvert.DeserializeObject <Shifts>(json);

            return(shift);
        }
        public async Task <IActionResult> Create([Bind("Id,Title,WorkDays,StartTime,EndTime,RestDay")] Shifts shifts)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shifts);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shifts));
        }
 public static Shifts ModelToEnity(this ShiftsModel model, bool virtualActive = false)
 {
     Shifts entity = new Shifts()
     {
         EndTime = model.EndTime,
         StartTime = model.StartTime,
         Id = model.Id,
         IsActive = model.IsActive
     };
     if (virtualActive)
     {
         entity.EmployeeShifts = model.EmployeeShifts;
     }
     return entity;
 }
 protected void lnkbtnShifts_Click(object sender, EventArgs e)
 {
     Shifts objShift = new Shifts();
     objShift.FirstHalfStart = TimeSpan.Parse(txtFirstHalfStart.Text);
     objShift.FirstHalfEnd = TimeSpan.Parse(txtFirstHalfEnd.Text);
     objShift.SecondHalfStart = TimeSpan.Parse(txtSecondHalfStart.Text);
     objShift.SecondHalfEnd = TimeSpan.Parse(txtSecondHalfEnd.Text);
     MasterEntries objMasterEntry = new MasterEntries();
     objMasterEntry.AddShift(objShift);
     grdShiftsBind();
 }
 protected void lkbEditShift_Click(object sender, EventArgs e)
 {
     MasterEntries objMasterEntry = new MasterEntries();
     LinkButton b = (LinkButton)sender;
     int Id = Convert.ToInt32(b.CommandArgument);
     Shifts objShift = new Shifts();
     
 }
    /// <summary>
    /// Add a new Shift 
    /// </summary>
    /// <param name="shift">Shift type object</param>
    /// <returns>True if entry is successfull else False</returns>
    public bool AddShift(Shifts shift)
    {
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        List<SqlParameter> lstShift = new List<SqlParameter>();
        lstShift.Add(new SqlParameter("@firstHalfStart", shift.FirstHalfStart));
        lstShift.Add(new SqlParameter("@firstHalfEnd", shift.FirstHalfEnd));
        lstShift.Add(new SqlParameter("@secondHalfStart", shift.SecondHalfStart));
        lstShift.Add(new SqlParameter("@secondHalfEnd", shift.SecondHalfEnd));
        lstShift.Add(new SqlParameter("@isActive", false));
        lstShift.Add(new SqlParameter("@createdOn", DateTime.Now));
        lstShift.Add(new SqlParameter("@updatedOn", DateTime.Now));
        lstShift.Add(new SqlParameter("@isDeleted", false));

        DataTable dt = new DataTable();
        try
        {
            using (DBDataHelper objDDBDataHelper = new DBDataHelper())
            {
                objDDBDataHelper.ExecSQL("spAddShift", SQLTextType.Stored_Proc, lstShift);

            }
            return true;
        }
        catch (Exception ex)
        {
            return false;
        }

    }
    public List<Shifts> GetShiftsById(int Id) //to be edited
    {
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DataTable dt = new DataTable();
        List<SqlParameter> lst = new List<SqlParameter>();
        lst.Add(new SqlParameter ("@id",Id));
        DataSet ds;
        int i = 0;
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            ds = objDDBDataHelper.GetDataSet("spGetShiftsById", SQLTextType.Stored_Proc,lst);
            List<Shifts> lstShifts = new List<Shifts>();

            foreach (DataRow rows in ds.Tables[0].Rows)
            {
                Shifts objShifts = new Shifts();
                objShifts.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]);
                objShifts.FirstHalfStart = TimeSpan.Parse(ds.Tables[0].Rows[i][1].ToString());
                objShifts.FirstHalfEnd = TimeSpan.Parse(ds.Tables[0].Rows[i][2].ToString());
                objShifts.SecondHalfStart = TimeSpan.Parse(ds.Tables[0].Rows[i][3].ToString());
                objShifts.SecondHalfEnd = TimeSpan.Parse(ds.Tables[0].Rows[i][4].ToString());
                objShifts.IsActive = Convert.ToBoolean(ds.Tables[0].Rows[i][5]);
                lstShifts.Add(objShifts);
                i++;
            }
            return lstShifts;
        }
    }
 public bool UpdateShifts(int shiftId, Shifts objShift) // To be Edited
 {
     DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
     List<SqlParameter> lstDuration = new List<SqlParameter>();
     lstDuration.Add(new SqlParameter("@shiftId", shiftId));
     lstDuration.Add(new SqlParameter("@updatedAt", DateTime.Now));
     DataTable dt = new DataTable();
     DataSet ds;
     try
     {
         using (DBDataHelper objDDBDataHelper = new DBDataHelper())
         {
             ds = objDDBDataHelper.GetDataSet("spUpdateDuration", SQLTextType.Stored_Proc, lstDuration);
         }
         return true;
     }
     catch (Exception ex)
     {
         return false;
     }
 }