//Конструктор при редактировании комплектации в заявке
        public EquipmentBidSaveWindow(EquipmentBid equipmentBid)
        {
            InitializeComponent();
            Title = "Редактирование комплектации в заявке №" + equipmentBid.Id_bid.ToString();

            setViewSources();

            Equipment equipment = EquipmentViewModel.instance().getById(equipmentBid.Id_equipment);

            if (equipment != null)
            {
                cbxEquipment.SelectedItem = equipment;
            }

            if (equipmentBid.Id_modification != null)
            {
                Modification modification = ModificationViewModel.instance().getById((int)equipmentBid.Id_modification);
                if (modification != null)
                {
                    cbxModification.SelectedItem = modification;
                }
            }

            DataContext = new
            {
                ComplectationCollection = equipmentBid.ComplectationCollection
            };

            this.equipmentBid      = equipmentBid;
            cbxEquipment.IsEnabled = false;
        }
Example #2
0
        private bool loadModels()
        {
            CRMSettingViewModel.instance();

            ComplectationItemViewModel.instance();

            EquipmentViewModel.instance();
            ModificationViewModel.instance();
            SellerViewModel.instance();
            BuyerViewModel.instance();
            BidStatusViewModel.instance();
            PaymentStatusViewModel.instance();
            MessageTemplatesViewModel.instance();

            RoleViewModel.instance();
            ManagerViewModel.instance();

            BidViewModel.instance();



            //EquipmentBidViewModel.instance();
            //ComplectationViewModel.instance();

            //ComplectationItemViewModel.instance();

            return(true);
        }
        public EquipmentWindow()
        {
            InitializeComponent();


            viewSource.Source  = EquipmentViewModel.instance().Collection;
            viewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Equipment equipment = e.Item as Equipment;
                if (equipment == null)
                {
                    return;
                }
                e.Accepted = equipment.IsVisible;
            };

            modificationViewSource.Source  = ModificationViewModel.instance().Collection;
            modificationViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Modification modification = e.Item as Modification;
                Equipment    equipment    = dgvEquipment.SelectedItem as Equipment;
                if (modification == null)
                {
                    return;
                }
                if (equipment == null)
                {
                    e.Accepted = false;
                    return;
                }

                if (modification.Id_equipment == equipment.Id)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };

            viewSource.SortDescriptions.Add(new SortDescription("Row_order", ListSortDirection.Descending));
            modificationViewSource.SortDescriptions.Add(new SortDescription("Row_order", ListSortDirection.Descending));
            DataContext = new
            {
                EquipmentCollection    = viewSource.View,
                ModificationCollection = modificationViewSource.View
            };
        }
        //Установка коллекций
        void setViewSources()
        {
            defaultBrush = cbxEquipment.Background;

            equipmentViewSource.Source = EquipmentViewModel.instance().Collection;
            equipmentViewSource.SortDescriptions.Add(new SortDescription("Row_order", ListSortDirection.Descending));

            cbxEquipment.ItemsSource = equipmentViewSource.View;


            modificationViewSource.Source = ModificationViewModel.instance().Collection;
            modificationViewSource.SortDescriptions.Add(new SortDescription("Row_order", ListSortDirection.Descending));

            modificationViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Modification modification = e.Item as Modification;
                if (modification == null)
                {
                    return;
                }
                if (cbxEquipment.SelectedIndex == -1)
                {
                    e.Accepted = false;
                    return;
                }
                Equipment equipment = cbxEquipment.SelectedItem as Equipment;
                if (equipment == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (modification.Id_equipment == equipment.Id)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };

            cbxModification.ItemsSource = modificationViewSource.View;

            cbxEquipment.SelectedIndex    = -1;
            cbxModification.SelectedIndex = -1;
        }
Example #5
0
        //Восьмая строка (модификации)
        private bool createModificationRow()
        {
            string modificationName = "";

            if (equipmentBid.Id_modification != null)
            {
                Modification modification = ModificationViewModel.instance().getById((int)equipmentBid.Id_modification);
                if (modification != null)
                {
                    modificationName = modification.Name;
                }
            }

            ReportRow row = new ReportRow();

            row.Cells.Add(new ReportCell("Модификация")
            {
                Height    = 16.50,
                TextStyle = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
                VerticalAlignment = VerticalAlignment.Bottom
            });
            AddEmptyCell(row, 2);
            row.Cells.Add(new ReportCell(modificationName)
            {
                ColumnSpan  = 12,
                BorderColor = System.Drawing.Color.Black
            });
            AddEmptyCell(row, 11);
            row.Cells.Add(new ReportCell()
            {
                VerticalAlignment = VerticalAlignment.Bottom,
            });

            Rows.Add(row);

            return(true);
        }
Example #6
0
        public override bool Save()
        {
            Bid bid = BidViewModel.instance().getById(equipmentBid.Id_bid);

            if (bid == null)
            {
                LastError = "Bid not found!";
                return(false);
            }
            Buyer buyer = BuyerViewModel.instance().getById(bid.Id_buyer);

            if (buyer == null)
            {
                LastError = "Buyer not found!";
                return(false);
            }

            Equipment equipment = EquipmentViewModel.instance().getById(equipmentBid.Id_equipment);

            if (equipment == null)
            {
                LastError = "Equipment not found!";
                return(false);
            }
            Modification modification = null;

            if (equipmentBid.Id_modification != null)
            {
                modification = ModificationViewModel.instance().getById((int)equipmentBid.Id_modification);
                if (modification != null)
                {
                    modificationString = modification.Name;
                }
            }

            ReportRow row = new ReportRow();

            row.Cells.Add(new ReportCell(buyer.Name.ToUpper())
            {
                ColumnSpan = 6,
                Height     = 20.25,
                TextStyle  = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
            });
            row.Cells.Add(new ReportCell());
            row.Cells.Add(new ReportCell());
            row.Cells.Add(new ReportCell());
            row.Cells.Add(new ReportCell());
            row.Cells.Add(new ReportCell());
            row.Cells.Add(new ReportCell()
            {
                Width = 0.58, VerticalAlignment = VerticalAlignment.Bottom
            });
            row.Cells.Add(new ReportCell(buyer.City.ToUpper())
            {
                ColumnSpan          = 2,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
            });
            row.Cells.Add(new ReportCell()
            {
                Width               = 7.29,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Right
            });
            Rows.Add(row);

            ReportRow row_1 = new ReportRow();

            row_1.Cells.Add(new ReportCell(buyer.Contact_person.ToUpper())
            {
                ColumnSpan = 6,
                TextStyle  = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
            });
            row_1.Cells.Add(new ReportCell());
            row_1.Cells.Add(new ReportCell());
            row_1.Cells.Add(new ReportCell());
            row_1.Cells.Add(new ReportCell());
            row_1.Cells.Add(new ReportCell());
            row_1.Cells.Add(new ReportCell());
            row_1.Cells.Add(new ReportCell(buyer.Phone.ToUpper())
            {
                ColumnSpan = 2,
                TextStyle  = new List <TextStyle>()
                {
                    TextStyle.Bold
                },
                HorizontalAlignment = HorizontalAlignment.Right
            });
            Rows.Add(row_1);

            Rows.Add(new ReportRow());

            ReportRow row_2 = new ReportRow();

            row_2.Cells.Add(new ReportCell(equipment.Name.ToUpper())
            {
                ColumnSpan = 6,
                TextStyle  = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            row_2.Cells.Add(new ReportCell());
            row_2.Cells.Add(new ReportCell());
            row_2.Cells.Add(new ReportCell());
            row_2.Cells.Add(new ReportCell());
            row_2.Cells.Add(new ReportCell());
            row_2.Cells.Add(new ReportCell());
            row_2.Cells.Add(new ReportCell(serialNumber.ToUpper())
            {
                RowSpan             = 1,
                ColumnSpan          = 2,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom,
                TextStyle           = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            Rows.Add(row_2);

            ReportRow row_3 = new ReportRow();

            row_3.Cells.Add(new ReportCell(modificationString.ToUpper())
            {
                ColumnSpan = 6,
                TextStyle  = new List <TextStyle>()
                {
                    TextStyle.Bold
                }
            });
            Rows.Add(row_3);

            AllDocumentFontSize = 14;

            return(Create());
        }