예제 #1
0
        public PurchasedPartDetailForm(PurchasedPartForm quantityForm, Purchasemodel2 pmodel)
        {
            InitializeComponent();

            QuantityForm = quantityForm;
            Model = pmodel;
        }
예제 #2
0
        private void chartControl1_SelectedItemsChanged(object sender, DevExpress.XtraCharts.SelectedItemsChangedEventArgs e)
        {
            Purchasemodel2 selectedItem = chartControl1.SelectedItems[0] as Purchasemodel2;

            if (selectedItem == null)
            {
                return;
            }

            PurchasedPartDetailForm newPurchasedPart = new PurchasedPartDetailForm(this, selectedItem);

            newPurchasedPart.Show();
        }
예제 #3
0
        public List <Purchasemodel2> GetPurchasemodelModels()
        {
            {
                using (var context = DbContextCreator.Create())
                {
                    var partNames = context.Items.ToDictionary(x => x.ItemId, x => x.Name);

                    var query = from p in context.Orders
                                where p.IsSale == false
                                select new
                    {
                        Order      = p,
                        Quantity   = p.Quantity,
                        CategoryId = p.Item.CategoryId
                    };

                    var query2 = from x in query
                                 group x by x.CategoryId into g
                                 select g;

                    var models = new List <Purchasemodel2>();

                    foreach (var @group in query2)
                    {
                        Purchasemodel2 model = new Purchasemodel2();
                        model.CategoryId = group.Key;
                        model.Quantity   = group.Sum(x => x.Quantity);

                        if (model.CategoryId == 2)
                        {
                            model.CategoryName = "판";
                        }
                        else if (model.CategoryId == 3)
                        {
                            model.CategoryName = "다리";
                        }
                        else if (model.CategoryId == 4)
                        {
                            model.CategoryName = "볼트 & 너트";
                        }

                        models.Add(model);
                    }
                    return(models);
                }
            }
        }