Exemple #1
0
        public ProductDetailForm(PostgresDataBaseContext db, Product product = null)
        {
            this.db = db;
            InitializeComponent();

            BindingList <ProductGroup>
            groups = new BindingList <ProductGroup>(this.db.ProductGroups.ToList());

            CbGroup.ValueMember = null;
            // CbGroup.DisplayMember = "Name";
            CbGroup.DataSource = groups;

            BindingList <TradeDepartment>
            departments = new BindingList <TradeDepartment>(this.db.TradeDepartments.ToList());

            CbDepartment.ValueMember = null;
            // CbDepartment.DisplayMember = "Name";
            CbDepartment.DataSource = departments;

            this.product = product;
            if (product != null)
            {
                this.TbName.Text = product.Name;
                // this.NuCount.Value = product.Count;
                this.NuPriceRetail.Value       = product.RetailPrice;
                this.NuPriceWholesale.Value    = product.WholesalePrice;
                this.CbGroup.SelectedItem      = product.Group;
                this.CbDepartment.SelectedItem = product.Department;
                this.cbUnit.SelectedItem       = product.Unit;
                this.TbCountry.Text            = product.Country;
            }
        }
        public CustomerDetailForm(PostgresDataBaseContext db, Customer customer = null)
        {
            this.db       = db;
            this.customer = customer;
            InitializeComponent();

            BindingList <TradeDepartment>
            objects = new BindingList <TradeDepartment>(this.db.TradeDepartments.ToList());

            CbTradeDepartment.ValueMember   = null;
            CbTradeDepartment.DisplayMember = "Name";
            CbTradeDepartment.DataSource    = objects;

            if (customer != null)
            {
                this.TbShortName.Text               = customer.ShortName;
                this.TbFullName.Text                = customer.FullName;
                this.TbOKPO.Text                    = customer.OKPO;
                this.TbINN.Text                     = customer.INN;
                this.TbKPP.Text                     = customer.KPP;
                this.TbAdress.Text                  = customer.Address;
                this.TbPhoneNumber.Text             = customer.PhoneNumber;
                this.TbStatus.Text                  = customer.Status;
                this.CbTradeDepartment.SelectedItem = customer.Department;
            }
        }
Exemple #3
0
        public OrderDetailForm(PostgresDataBaseContext db, Order order = null)
        {
            this.order = order;
            this.db    = db;


            InitializeComponent();

            this.db.Customers.Load();
            this.comboBox1.Items.AddRange(this.db.Customers.ToArray());
            this.CbType.DataSource =
                Enum.GetValues(typeof(OrderType))
                .Cast <OrderType>()
                .Select(p => new { Name = Enum.GetName(typeof(OrderType), p), Value = (int)p })
                .ToList();

            this.CbType.DisplayMember = "Name";
            this.CbType.ValueMember   = "Name";


            this.db.Products.Load();
            var products = this.db.Products;
            Dictionary <int, string> comboSource = new Dictionary <int, string>();

            foreach (var product in products)
            {
                comboSource.Add(product.Id, product.Name);
            }

            (dataGridView1.Columns["ProductType"] as DataGridViewComboBoxColumn).DataSource =
                new BindingList <Product>(this.db.Products.ToList());
            (dataGridView1.Columns["ProductType"] as DataGridViewComboBoxColumn).ValueMember   = "Id";
            (dataGridView1.Columns["ProductType"] as DataGridViewComboBoxColumn).DisplayMember = "Name";

            (dataGridView1.Columns["PriceType"] as DataGridViewComboBoxColumn).DataSource =
                Enum.GetValues(typeof(PriceType))
                .Cast <PriceType>()
                .Select(p => new { Name = Enum.GetName(typeof(PriceType), p), Value = (int)p })
                .ToList();

            (dataGridView1.Columns["PriceType"] as DataGridViewComboBoxColumn).DisplayMember = "Name";
            (dataGridView1.Columns["PriceType"] as DataGridViewComboBoxColumn).ValueMember   = "Name";


            if (order != null)
            {
                this.dateTimePicker1.Value  = order.DateTime;
                this.comboBox1.SelectedItem = order.Customer;
                this.TbComment.Text         = order.Comment;
                this.CbType.SelectedItem    = order.Type.ToString();

                foreach (var product in order?.ProductInOrders)
                {
                    dataGridView1.Rows.Add(product.Product.Id, product.ProductCount, product.PriceType.ToString(),
                                           product.Discount);
                }
            }
        }
Exemple #4
0
 public TradeDepartmentDetailForm(PostgresDataBaseContext db, TradeDepartment department = null)
 {
     InitializeComponent();
     this.db         = db;
     this.department = department;
     if (department != null)
     {
         this.TbName.Text = this.department.Name;
     }
 }
 public ProductGroupDetailForm(PostgresDataBaseContext db, ProductGroup group = null)
 {
     InitializeComponent();
     this.db    = db;
     this.group = group;
     if (group != null)
     {
         this.TbName.Text = this.group.Name;
     }
 }
Exemple #6
0
        public MenuForm()
        {
            this.db = new PostgresDataBaseContext();

            db.ProductsInOrders.Load();
            db.Customers.Load();
            db.Orders.Load();
            db.Products.Load();

            InitializeComponent();
        }
Exemple #7
0
 public TradeDepartmentsList(PostgresDataBaseContext db)
 {
     this.db = db;
     InitializeComponent();
 }
Exemple #8
0
 public ProductsForm(PostgresDataBaseContext db)
 {
     this.db = db;
     InitializeComponent();
 }
Exemple #9
0
 public ProductGroupsList(PostgresDataBaseContext db)
 {
     this.db = db;
     InitializeComponent();
 }
 public CustomersList(PostgresDataBaseContext db)
 {
     this.db = db;
     InitializeComponent();
 }