public DayViewModule(EmployeeCalendarViewModel viewModel, SchedulerDataStorage storage)
 {
     Initializer.Init();
     InitializeComponent();
     BindingContext           = viewModel;
     this.dayView.DataStorage = storage;
 }
        public async Task <JsonResult> UpdateDefaultCalendar(EmployeeCalendarViewModel model)
        {
            try
            {
                var currentData = await _employeesCalendarsManager.GetSingleItemAsync(c => c.EmployeeId == model.EmployeeId && c.StartDate == model.StartDate && !c.EndDate.HasValue);

                currentData = currentData ?? new EmployeeCalendar
                {
                    EmployeeId = model.EmployeeId
                };

                currentData.ContractWorkTime = model.ContractWorkTime;
                currentData.AttendanceProof  = model.AttendanceProof;
                currentData.StartDate        = model.StartDate.Value.Date;
                currentData.Note             = model.Note;

                if (User.Identity.IsAuthenticated)
                {
                    currentData.UserId = User.Identity.Name.ConvertToInteger();
                }

                if (currentData.Id == 0)
                {
                    var updateResult = await _employeesCalendarsManager.InsertNewAsync(currentData);

                    if (updateResult.Status == RepositoryActionStatus.Created)
                    {
                        return(Json("ok"));
                    }
                    else
                    {
                        return(Json("error"));
                    }
                }
                else
                {
                    var updateResult = await _employeesCalendarsManager.UpdateDataItem(currentData);

                    if (updateResult.Status == RepositoryActionStatus.Updated)
                    {
                        return(Json("ok"));
                    }
                    else
                    {
                        return(Json("error"));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public WeekViewDemo()
 {
     InitializeComponent();
     BindingContext = new EmployeeCalendarViewModel();
 }
Пример #4
0
 public DayViewModule(EmployeeCalendarViewModel viewModel)
 {
     InitializeComponent();
     this.viewModel = viewModel;
     BindingContext = viewModel;
 }
 public MultiDayViewDemo()
 {
     Initializer.Init();
     InitializeComponent();
     BindingContext = new EmployeeCalendarViewModel();
 }
Пример #6
0
 public FirstLookDemo()
 {
     DevExpress.XamarinForms.Scheduler.Initializer.Init();
     InitializeComponent();
     BindingContext = new EmployeeCalendarViewModel();
 }