Exemple #1
0
        public RequestPanel(ShortRequestWithAttachments shortRequest, MainMenu.MainMenuModel mainMenuHandle)
        {
            this.shortRequestWithAttachments = shortRequest;

            _mainMenuHandle = mainMenuHandle;
            _shortRequest   = shortRequest;

            this.Resources.Add("this", this);

            AttachmentIcons = new ObservableCollection <AttachmentIcon>();
            foreach (var item in shortRequest.attachmentList)
            {
                AttachmentIcons.Add(new AttachmentIcon(item, true)
                {
                    DataContext = mainMenuHandle
                });
            }
            this.DataContext = this;

            InitializeComponent();

            bool fromMe = mainMenuHandle.contract.myLogin == shortRequest.Request.login_senderId;

            this.FromOrToTB.Text = fromMe ? "От меня" : "Ко мне";

            this.FromOrToTB.Background = fromMe ? Brushes.LightGreen : Brushes.LightPink;

            this.DateFromTB.Text      = shortRequest.Request.date_from.ToLongDateString();
            this.DateToTB.Text        = shortRequest.Request.date_to.ToLongDateString();
            this.StatusTB.Text        = shortRequest.Request.RequestStatusId.ToString();
            this.LoginSenderTB.Text   = shortRequest.Request.login_senderId;
            this.LoginRecieverTB.Text = shortRequest.Request.login_recieverId;
            this.CaptionTB.Text       = shortRequest.Request.caption;
        }
Exemple #2
0
        public RequestCreationWindow(MainMenu.MainMenuModel mainMenuHandle)
        {
            menuHandle = mainMenuHandle;

            this.DataContext = this;

            InitializeComponent();
        }
Exemple #3
0
        public RequestDetailsModel(ShortRequestWithAttachments shortRequestWithAttachments, MainMenu.MainMenuModel modelHandle, bool FromUser)
        {
            this.RemoveRequest        = modelHandle.RemoveRequest;
            this.removeRequestCommand = new RelayCommand((x) => { RemoveRequest(shortRequestWithAttachments); requestDetailsForm.Close(); });

            this.UpdateRequest = modelHandle.UpdateRequest;
            if (FromUser)
            {
                this.updateRequestCommand = new RelayCommand((x) =>
                {
                    ShortRequestWithAttachments request = shortRequestWithAttachments;
                    request.Request.recourse            = requestDetailsForm.MessageTextBox.Text;
                    request.Request.RequestStatusId     = requestDetailsForm.CompletionStage.SelectedIndex;

                    if (requestDetailsForm.dtTo != null)
                    {
                        request.Request.date_to = requestDetailsForm.dtTo;
                    }

                    UpdateRequest(request);
                });
            }
            else
            {
                this.updateRequestCommand = new RelayCommand((x) =>
                {
                    ShortRequestWithAttachments request = shortRequestWithAttachments;
                    request.Request.RequestStatusId     = requestDetailsForm.CompletionStage.SelectedIndex;

                    UpdateRequest(request);
                });
            }

            this.AddAttachment = (x) => {
                var result = modelHandle.AddAttachment(x);
                attachmentIcons.Add(result);
            };
            this.addAttachmentCommand = new RelayCommand((x) => { AddAttachment(shortRequestWithAttachments); });

            this.RemoveAttachment        = modelHandle.RemoveAttachment;
            this.removeAttachmentCommand = new RelayCommand((x) => { modelHandle.RemoveAttachment(((AttachmentIcon)x)); attachmentIcons.Remove((AttachmentIcon)x); });

            attachmentIcons = new ObservableCollection <AttachmentIcon>();
            foreach (var item in shortRequestWithAttachments.attachmentList)
            {
                attachmentIcons.Add(new AttachmentIcon(item, true)
                {
                    DataContext = modelHandle
                });
            }

            requestDetailsForm = new RequestDetailsForm(shortRequestWithAttachments, FromUser)
            {
                DataContext = this
            };
        }
        //RequestCreationWindow requestCreation;

        public RequestCreationModel(MainMenu.MainMenuModel handle)
        {
            //requestCreation = new RequestCreationWindow() { DataContext = this };
        }