Пример #1
0
        private void UpdateAppointmentWindow(AppointmentWindow appointmentWindow)
        {
            if (_appointmentWindow == null)
            {
                return;
            }
            if (OverrideType.HasFlag(PlanningOverrideType.Window))
            {
                return;
            }

            // take the predefined start and end date of the appointment window
            // only the date portion will vary
            var startTimeSpan = new TimeSpan(AppointmentWindow.WindowStart.Hours,
                                             AppointmentWindow.WindowStart.Minutes,
                                             AppointmentWindow.WindowStart.Seconds);

            WindowStart = new DateTimeOffset(new DateTime(WindowStart.Year, WindowStart.Month, WindowStart.Day), WindowStart.Offset).Add(startTimeSpan);

            var endTimeSpan = new TimeSpan(AppointmentWindow.WindowEnd.Hours,
                                           AppointmentWindow.WindowEnd.Minutes,
                                           AppointmentWindow.WindowEnd.Seconds);

            WindowEnd = new DateTimeOffset(new DateTime(WindowEnd.Year, WindowEnd.Month, WindowEnd.Day), WindowEnd.Offset).Add(endTimeSpan);
        }
Пример #2
0
        private void NewAppointmentButton_Click(object sender, RoutedEventArgs e)
        {
            AppointmentWindow AppointmentWindow = new AppointmentWindow();

            AppointmentWindow.Owner = mainWindow;
            AppointmentWindow.Show();
        }
        private void ShowAppointmentForm()
        {
            UserController        userController = new UserController();
            AppointmentController controllerForSelectedAppointment = new AppointmentController(selectedAppointment, userController);
            AppointmentWindow     newAppointmentWindow             = new AppointmentWindow(controllerForSelectedAppointment, sourceSessionController);

            newAppointmentWindow.ShowDialog();
        }
Пример #4
0
 public ShipmentStop()
 {
     appointmentWindow = new AppointmentWindow();
     location          = new Location();
 }
Пример #5
0
        public void ShowCmdWindow(string cmd, int lscId, int id)
        {
            try {
                StaIncludedField.Clear();
                DevIncludedField.Clear();
                StartTimeTextField.Clear();
                EndTimeTextField.Clear();
                BookingUserNameTextField.Clear();
                BookingUserPhoneTextField.Clear();
                LscCheckbox.Checked   = false;
                ProjStatusBox.Checked = false;

                WLscsComboBox.Disabled             = false;
                WProjectComboBox.Disabled          = false;
                StaIncludedField.Disabled          = false;
                DevIncludedField.Disabled          = false;
                StartTimeTextField.Disabled        = false;
                EndTimeTextField.Disabled          = false;
                BookingUserPhoneTextField.Disabled = false;
                LscCheckbox.Disabled   = false;
                ProjStatusBox.Disabled = false;
                JsonValueHF.Clear();
                AppointmentStatusBar.ClearStatus();

                var bt = DateTime.Now.AddMinutes(30);
                var et = bt.AddDays(1);
                StartTimeTextField.Text = WebUtility.GetDateString(bt);
                EndTimeTextField.Text   = WebUtility.GetDateString(et);

                switch (cmd)
                {
                case "Add":
                    AppointmentWindow.Title = "新增预约";
                    AppointmentWindow.Icon  = Icon.TagBlueAdd;
                    ProjStatusBox.Hide();

                    WLscsComboBox.GetStore().DataBind();
                    AppointmentWindow.Show();
                    break;

                case "Edit":
                    AppointmentWindow.Title = "编辑预约";
                    AppointmentWindow.Icon  = Icon.TagBlueEdit;
                    ProjStatusBox.Show();

                    var lsc = new BLsc().GetLsc(lscId);
                    if (lsc == null)
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无法获取Lsc信息");
                        return;
                    }

                    var connectionString = WebUtility.CreateLscConnectionString(lsc);
                    var appt             = new BAppointment().GetAppointment(lsc.LscID, lsc.LscName, id, connectionString);
                    if (appt == null)
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无法获取预约信息");
                        return;
                    }

                    if (!UserData.LscUsers.Any(lu => lu.LscID == appt.LscID && lu.UserID == appt.CreaterId))
                    {
                        WebUtility.ShowMessage(EnmErrType.Warning, "无编辑权限,仅预约设置人有此权限。");
                        return;
                    }

                    WLscsComboBox.Disabled    = true;
                    WProjectComboBox.Disabled = true;
                    if (appt.Status == EnmProjStatus.Using)
                    {
                        StaIncludedField.Disabled          = true;
                        DevIncludedField.Disabled          = true;
                        StartTimeTextField.Disabled        = true;
                        EndTimeTextField.Disabled          = true;
                        BookingUserPhoneTextField.Disabled = true;
                        LscCheckbox.Disabled = true;
                    }

                    JsonValueHF.Text = JsonConvert.SerializeObject(appt);
                    WLscsComboBox.SetValueAndFireSelect(appt.LscID);
                    AppointmentWindow.Show();
                    break;

                default:
                    break;
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }