Example #1
0
        public ClientsForm()
        {
            InitializeComponent();

            db = new BrickWorksModel();
            LoadClients();
        }
Example #2
0
        private async void lnkEdit_Click(object sender, EventArgs e)
        {
            int   id  = Convert.ToInt32(ordersGrid.SelectedRows[0].Cells[0].Value);
            Order ord = db.Orders.First(o => o.Id == id);

            if (ord != null)
            {
                using (OrderAddEditForm frm = new OrderAddEditForm(ord))
                {
                    frm.StyleManager = styleManager;
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {
                            await db.SaveChangesAsync();

                            db = new BrickWorksModel();
                            LoadOrders();
                        }
                        catch (Exception ex)
                        {
                            MetroFramework.MetroMessageBox.Show(this, ex.Message, "Ошибка", MessageBoxButtons.OK,
                                                                MessageBoxIcon.Error);
                        }
                    }
                    ordersGrid.Refresh();
                }
            }
        }
Example #3
0
 public BricksFrom()
 {
     InitializeComponent();
     db = new BrickWorksModel();
     manufacturedBrickBindingSource.DataSource = db.ManufacturedBricks.OrderByDescending(m => m.Id).ToList();
     brickBindingSource.DataSource             = db.Bricks.ToList();
 }
Example #4
0
 public BricksCostForm()
 {
     InitializeComponent();
     db = new BrickWorksModel();
     brickCostBindingSource.DataSource = db.BrickCosts.OrderByDescending(d => d.Date).ToList();
     brickBindingSource.DataSource     = db.Bricks.ToList();
 }
Example #5
0
 public BricksCostsForm()
 {
     InitializeComponent();
     costGrid.Theme = this.Theme;
     costGrid.Style = this.Style;
     db             = new BrickWorksModel();
     deliveryCostBindingSource.DataSource = db.DeliveryCosts.OrderByDescending(d => d.Date).ToList();
 }
Example #6
0
 public OrderAddEditForm(Order obj)
 {
     db        = new BrickWorksModel();
     OrderInfo = obj;
     InitializeComponent();
     orderBindingSource.DataSource  = OrderInfo;
     clientBindingSource.DataSource = db.Clients.ToList();
     LoadBricks();
 }
Example #7
0
 public ClientAddEditForm(Client obj)
 {
     InitializeComponent();
     ClientInfo = obj;
     db         = new BrickWorksModel();
     clientBindingSource.DataSource   = ClientInfo;
     buildingBindingSource.DataSource = db.Buildings.Where(c => c.ClientID == ClientInfo.Id).ToList();
     buildingsGrid.Refresh();
 }
Example #8
0
 public ManufacturedBrickAddEditFrom(ManufacturedBrick obj)
 {
     db     = new BrickWorksModel();
     MFInfo = obj;
     InitializeComponent();
     brickBindingSource.DataSource             = db.Bricks.ToList();
     manufacturedBrickBindingSource.DataSource = MFInfo;
     mDate.Select();
 }
Example #9
0
 public BrickCostAddEditForm(BrickCost obj)
 {
     InitializeComponent();
     BrickCostInfo = obj;
     db            = new BrickWorksModel();
     if (BrickCostInfo.Id == 0)
     {
         BrickCostInfo.BrickId = db.Bricks.First().Id;
     }
     brickCostBindingSource.DataSource = BrickCostInfo;
     this.mdtDate.Select();
     brickBindingSource.DataSource = db.Bricks.ToList();
 }
Example #10
0
        public BricksInOrderAddEditFrom(OrderedBrick obj)
        {
            InitializeComponent();
            OrderedBrickInfo = obj;
            db = new BrickWorksModel();
            if (OrderedBrickInfo.Id == 0)
            {
                OrderedBrickInfo.BrickId = db.Bricks.First().Id;
            }
            orderedBrickBindingSource.DataSource = OrderedBrickInfo;
            brickBindingSource.DataSource        = db.Bricks.ToList();

            CalcRemaindedBricks();
        }
Example #11
0
 public OrdersForm()
 {
     try
     {
         db = new BrickWorksModel();
         InitializeComponent();
         this.StyleManager  = styleManager;
         styleManager.Theme = MetroFramework.MetroThemeStyle.Light;
         styleManager.Style = MetroFramework.MetroColorStyle.Orange;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #12
0
        public DeliveryCostCalc(int ClientId, DateTime OrderDate)
        {
            InitializeComponent();
            DeliveryCost            = 0;
            mlvBuildings.CheckBoxes = true;
            this.ClientId           = ClientId;
            this.OrderDate          = OrderDate;
            db = new BrickWorksModel();
            var buildings = db.Buildings.Where(b => b.ClientID == ClientId);

            foreach (var building in buildings)
            {
                var item = new ListViewItem();
                item.Tag  = building.Id;
                item.Text = building.Address;
                mlvBuildings.Items.Add(item);
            }
        }
Example #13
0
        public CalcBricksFrom(int ClientId, int BrickId)
        {
            InitializeComponent();
            Quantity = 0;
            mlvBuildings.CheckBoxes = true;
            this.ClientId           = ClientId;
            this.BrickId            = BrickId;
            db = new BrickWorksModel();
            var buildings = db.Buildings.Where(b => b.ClientID == ClientId);

            foreach (var building in buildings)
            {
                var item = new ListViewItem();
                item.Tag  = building.Id;
                item.Text = building.Address;
                mlvBuildings.Items.Add(item);
            }
        }
Example #14
0
 public BricksInOrderView()
 {
     db = new BrickWorksModel();
 }
Example #15
0
 public BricksTypesForm()
 {
     InitializeComponent();
     db = new BrickWorksModel();
     brickBindingSource.DataSource = db.Bricks.ToList();
 }