Exemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     var shift = new Shift();
     shift.ShiftType = int.Parse(ddlType.SelectedValue);
     shift.WorkerId = new Guid(ddlUser.SelectedValue);
     shift.Date = new DateTime(int.Parse(txtDate.Text.Split('.')[2]), int.Parse(txtDate.Text.Split('.')[1]), int.Parse(txtDate.Text.Split('.')[0]),8,8,8);
     shift.Duration = int.Parse(txtWorkTime.Text);
     shift.BusinessUnitId = Guid.NewGuid();
     shift.CreatedByUserId = Guid.NewGuid();
     BusinessObjects.Data.ShiftData.Create(shift);
 }
Exemplo n.º 2
0
        public List<usp_get_shiftsResult> Create(string userid, int type, int hours, int year, int month, int day)
        {
            var validDateTime = new DateTime(year, month, day);

            var shift = new Shift()
            {
                BusinessUnitId = Guid.NewGuid(),
                CreatedByUserId = Guid.NewGuid(),
                Date = validDateTime,
                Duration = hours,
                ShiftType = type,
                WorkerId = new Guid(userid)
            };

            BusinessObjects.Data.ShiftData.Create(shift);

            return BusinessObjects.Data.ShiftData.GetList(validDateTime);
        }
Exemplo n.º 3
0
        public static Shift Create(Shift shift)
        {
            if (shift.WorkerId == Guid.Empty)
                throw new NullReferenceException("WorkerId");

            if (shift.ShiftTypeEnum.In(eShiftType.NotSet))
                throw new NullReferenceException("ShiftType");

            if (shift.Date == null)
                throw new NullReferenceException("Date");

            using (var appDC = BARDBDataContext.Ready())
            {
                shift.DateCreated = DateTime.Now;
                shift.ShiftId = Guid.NewGuid();
                shift.ShiftType = (int)shift.ShiftTypeEnum;

                appDC.Shifts.InsertOnSubmit(shift);
                appDC.SubmitChanges();
                return shift;
            }
        }
Exemplo n.º 4
0
        private void GenerateShifts(List<User> users)
        {
            var startDay = DateTime.Now.AddDays(-(DateTime.Now.Day + 7));

            var x = 0;

            for (int i = 0; i < 50; i++)
            {
                if(i % 2  == 0)
                {
                    x++;
                }

                var user = new Shift()
                {
                    BusinessUnitId = Guid.NewGuid(),
                    CreatedByUserId = Guid.NewGuid(),
                    Date = DateTime.Now.AddDays(x),
                    ShiftTypeEnum = BusinessObjects.eShiftType.Day,
                    WorkerId = users[new Random().Next(0, users.Count)].UserId
                };
                user = BusinessObjects.Data.ShiftData.Create(user);
            }
        }
Exemplo n.º 5
0
 partial void DeleteShift(Shift instance);
Exemplo n.º 6
0
 partial void UpdateShift(Shift instance);
Exemplo n.º 7
0
 partial void InsertShift(Shift instance);
Exemplo n.º 8
0
 partial void DeleteShift(Shift instance);
Exemplo n.º 9
0
 partial void UpdateShift(Shift instance);
Exemplo n.º 10
0
 partial void InsertShift(Shift instance);