public RecipientsPage()
        {
            InitializeComponent();
            DataContext = new
            {
                Collection = RecipientsController.instance().ViewSource.View
            };

            RecipientsController.instance().ViewSource.SortDescriptions.Add(new SortDescription(OrderSettings.RecipientsSortColumn, OrderSettings.RecipientsSortDirection));

            btnAdd.Click += delegate
            {
                RecipientsSaveWindow recipientsSaveWindow = new RecipientsSaveWindow();
                recipientsSaveWindow.ShowDialog();
            };
            btnEdit.Click += delegate
            {
                Recipients selectedRecipient = (Recipients)dgRecipients.SelectedItem;
                if (selectedRecipient == null)
                {
                    MessageBox.Show("Выберите редактируемую запись!");
                    return;
                }
                RecipientsSaveWindow recipientsSaveWindow = new RecipientsSaveWindow(selectedRecipient);
                recipientsSaveWindow.ShowDialog();
            };
            btnDelete.Click += delegate
            {
                Recipients selectedRecipient = (Recipients)dgRecipients.SelectedItem;
                if (selectedRecipient == null)
                {
                    MessageBox.Show("Выберите удаляемую запись!");
                    return;
                }
                if (MessageBox.Show("Подтвердите удаление!", "Подтвердите удаление!", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    selectedRecipient.remove();
                }
            };

            btnUp.Click += delegate
            {
                Recipients recipient = dgRecipients.SelectedItem as Recipients;
                if (recipient == null)
                {
                    return;
                }
                up(recipient);
            };

            btnDown.Click += delegate
            {
                Recipients recipient = dgRecipients.SelectedItem as Recipients;
                if (recipient == null)
                {
                    return;
                }
                down(recipient);
            };
        }
        public void Get_ViewResult_Newsletter()
        {
            RecipientsController controller = new RecipientsController();
            var result = controller.Newsletter();

            Assert.IsType <ViewResult>(result);
        }
示例#3
0
 private void loadModels()
 {
     OvenController.instance();
     DetailsController.instance();
     RecipientsController.instance();
     SupplyController.instance();
     SupplyDetailsController.instance();
     WriteoffController.instance();
     WriteoffDetailsController.instance();
     ReportsSettingController.instance();
 }
        public void Get_ViewResult_Index_Test()
        {
            //Arrange
            RecipientsController controller = new RecipientsController();

            //Act
            var result = controller.Create();

            //Assert
            Assert.IsType <ViewResult>(result);
        }
        public bool up()
        {
            int index = RecipientsController.instance().prevRowOrderIndex(RowOrder);

            if (index == 0)
            {
                return(true);
            }
            Recipients recipient = RecipientsController.instance().getByOrderIndex(index);

            if (orderChange(recipient))
            {
                RecipientsController.instance().ViewSource.View.Refresh();
                return(true);
            }
            return(false);
        }
示例#6
0
        public WriteoffPage()
        {
            InitializeComponent();

            DataContext = new
            {
                Collection = wodh_collection.Collection
            };
            cbxRecipients.ItemsSource = RecipientsController.instance().Collection;

            WriteoffDetailsHelper writeoffDetailsHelper = new WriteoffDetailsHelper();

            wodh_collection.add(writeoffDetailsHelper);

            btnSaveWriteoff.Click += delegate
            {
                saveWriteoff();
            };
        }
示例#7
0
        public override bool Save(DateTime startDate, DateTime endDate)
        {
            setLandscapeOrientation();

            ColumnCount = 9;

            columnsWidth.Add(1, 14);
            columnsWidth.Add(2, 9.29);
            columnsWidth.Add(3, 11.29);
            columnsWidth.Add(4, 14.29);
            columnsWidth.Add(5, 10.86);

            columnsWidth.Add(6, 5.29);
            columnsWidth.Add(7, 11);
            columnsWidth.Add(8, 29.86);
            columnsWidth.Add(9, 16.86);

            List <Writeoff>  writeoffForPeriod = WriteoffController.instance().getByPeriod(startDate, endDate);
            List <ReportRow> reportData        = new List <ReportRow>();

            int currentRowIndex = 3;

            merge(1, 2, 1, 9);

            foreach (Writeoff writeoff in writeoffForPeriod)
            {
                ReportRow emptyRow = new ReportRow();
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                emptyRow.Row.Add("");
                reportData.Add(emptyRow);
                currentRowIndex++;

                ReportRow reportRow = new ReportRow();

                reportRow.Row.Add("№ накладной");
                reportRow.Row.Add(writeoff.Id.ToString());
                reportRow.Row.Add("Дата");
                reportRow.Row.Add(writeoff.WriteoffDate.ToString("dd.MM.yyyy"));
                reportRow.Row.Add("№ заявки");
                reportRow.Row.Add(writeoff.AppNumber);
                reportRow.Row.Add("Получатель");
                reportRow.Row.Add(RecipientsController.instance().getById(writeoff.IdRecipient).FullName);

                selection(currentRowIndex, currentRowIndex, 1, 9);

                reportData.Add(reportRow);
                currentRowIndex++;

                reportRow.Style.Add(ReportRow.RowStyle.Bold);
                reportRow.Style.Add(ReportRow.RowStyle.TextAlignCenter);


                ReportRow reportRowHead = new ReportRow();

                reportRowHead.Row.Add("№");
                reportRowHead.Row.Add("Печь");
                reportRowHead.Row.Add("Артикул");
                reportRowHead.Row.Add("Наименование");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("");
                reportRowHead.Row.Add("Количество");

                merge(currentRowIndex, currentRowIndex, 4, 8);
                border(currentRowIndex, currentRowIndex, 1, 9);
                reportRowHead.Style.Add(ReportRow.RowStyle.Bold);
                reportRowHead.Style.Add(ReportRow.RowStyle.TextAlignCenter);

                reportData.Add(reportRowHead);
                currentRowIndex++;

                List <WriteoffDetails> writeoffDetails = WriteoffDetailsController.instance().getByIdWriteoff(writeoff.Id);
                for (int i = 0; i < writeoffDetails.Count; i++)
                {
                    Details currentDetail = DetailsController.instance().getById(writeoffDetails[i].IdDetails);
                    if (currentDetail == null)
                    {
                        continue;
                    }

                    ReportRow detailRow = new ReportRow();

                    detailRow.Row.Add((i + 1).ToString());
                    detailRow.Row.Add(currentDetail.OvenName);
                    detailRow.Row.Add(currentDetail.VendorCode);
                    detailRow.Row.Add(currentDetail.Name);

                    detailRow.Row.Add("");
                    detailRow.Row.Add("");
                    detailRow.Row.Add("");
                    detailRow.Row.Add("");

                    detailRow.Row.Add(writeoffDetails[i].DetailsCount.ToString());

                    merge(currentRowIndex, currentRowIndex, 4, 8);
                    border(currentRowIndex, currentRowIndex, 1, 9);

                    reportData.Add(detailRow);
                    currentRowIndex++;
                }
            }

            Data = reportData;
            return(Create());
        }
 public static int GetNewRowOrder()
 {
     return(RecipientsController.instance().maxRowOrderIndex() + 1);
 }
 protected override IController controller()
 {
     return(RecipientsController.instance());
 }