Пример #1
0
        public ActionResult TopThreeCustomerGraph()
        {
            pchutEntities2 context1 = new pchutEntities2();
            var            list1    = context1.Database.SqlQuery <TopCustomerViewModel>("select top 3 user_id, sum(total_ammount) as Column1 from invoice group by user_id order by sum(total_ammount) desc").ToList();

            List <BarChartModel> topThreeCustomers = new List <BarChartModel>();

            foreach (TopCustomerViewModel topThree in list1)
            {
                TopCustomerViewModel tcvm = new TopCustomerViewModel();
                UserRepository       user = new UserRepository();
                var userDetails           = user.Get(topThree.User_Id);

                user userInfo = new user();
                userInfo.user_name = userDetails.user_name;

                //tcvm.User_Id = topThree.User_Id;
                tcvm.Column1 = topThree.Column1;

                BarChartModel topChartModel = new BarChartModel(userInfo.user_name, (double)tcvm.Column1);
                topThreeCustomers.Add(topChartModel);
            }

            ViewBag.DataPoints = Newtonsoft.Json.JsonConvert.SerializeObject(topThreeCustomers);
            return(View());
        }
Пример #2
0
        public ActionResult VendorWithMaxBrand()
        {
            pchutEntities2 context1 = new pchutEntities2();
            var            list1    = context1.Database.SqlQuery <VendorMaxBrandViewModel>("select top 1 count(vendor_id) as NumberOfBrand, vendor_id from brand group by vendor_id order by count(vendor_id) desc").ToList();

            int?   id     = null;
            string amount = null;

            foreach (VendorMaxBrandViewModel i in list1)
            {
                id     = i.Vendor_id;
                amount = i.NumberOfBrand.ToString();
            }
            //int id = i
            ViewData["totalAmount"] = amount;

            VendorRepository vendor = new VendorRepository();
            var vendorInfo          = vendor.Get((int)id);

            return(View(vendorInfo));
        }
Пример #3
0
        public ActionResult TopSellerReferenceDetails()
        {
            pchutEntities2 context1 = new pchutEntities2();
            var            list1    = context1.Database.SqlQuery <TopSellerRef>("select top 1 sum(total_ammount) as ToatalSumAmount, seller_refference from invoice group by seller_refference order by sum(total_ammount) desc").ToList();

            int?   id     = null;
            string amount = null;

            foreach (TopSellerRef i in list1)
            {
                id     = i.Seller_Refference;
                amount = i.ToatalSumAmount.ToString();
            }

            ViewData["sumAmount"] = amount;

            UserRepository sellerReference = new UserRepository();
            var            seller          = sellerReference.Get((int)id);

            return(View(seller));
        }