private static void WorkHoursDataAction(LoggedUser u)
        {
            var wh = DBController.DbShifts.GetWorkHoursData(new WorkHoursSearchParameters {
                Month = DateTime.Now
            }).FirstOrDefault();

            if (!wh.NotNull())
            {
                wh = new WorkHoursData
                {
                    Active            = true,
                    CurrentMonthTotal = new WorkTime {
                        Hour = 0, Minute = 0
                    },
                    CurrentShiftStart = new WorkTime {
                        Hour = 0, Minute = 0
                    },
                    CurrentShiftEnd = new WorkTime {
                        Hour = 0, Minute = 0
                    },
                    Month = DateTime.Now.StartOfMonth(),
                };
                DBController.DbShifts.AddWorkMonthlyData(wh);
            }
            else
            {
                // check unclosed shift
            }
        }
示例#2
0
        public void AddWorkMonthlyData(WorkHoursData w)
        {
            var sqlItems = new SqlItemList();

            sqlItems.Add(new SqlItem("Month", w.Month));
            sqlItems.Add(new SqlItem("Active", w.Active));
            sqlItems.Add(new SqlItem("CurrentMonthTotal", w.CurrentMonthTotal.ToXml()));
            sqlItems.Add(new SqlItem("CurrentShiftStart", w.CurrentShiftStart.ToXml()));
            sqlItems.Add(new SqlItem("CurrentShiftEnd", w.CurrentShiftEnd.ToXml()));
            SetInsertIntoSql(SynnDataProvider.TableNames.WorkHoursData, sqlItems);
            ExecuteSql();
        }
示例#3
0
        public void UpdateWorkMonthlyData(WorkHoursData w)
        {
            var sqlItems = new SqlItemList();

            sqlItems.Add(new SqlItem("Month", w.Month));
            sqlItems.Add(new SqlItem("Active", w.Active));
            sqlItems.Add(new SqlItem("CurrentMonthTotal", w.CurrentMonthTotal.ToXml()));
            sqlItems.Add(new SqlItem("CurrentShiftStart", w.CurrentShiftStart.ToXml()));
            sqlItems.Add(new SqlItem("CurrentShiftEnd", w.CurrentShiftEnd.ToXml()));
            SetUpdateSql(SynnDataProvider.TableNames.WorkHoursData, sqlItems, new SqlItemList {
                new SqlItem {
                    FieldName = "Id", FieldValue = w.Id
                }
            });
            ExecuteSql();
        }