Exemplo n.º 1
0
 public bool GetProportionDataDetail(string proportioned)
 {
     if (ProportionData.IndexOf(proportioned) >= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        public ActionResult OrderCountryData(DateTime st, DateTime et, string a, string p)
        {
            var sqlWhere          = SqlWhere(st, et, a, p);
            IList <object[]> objs = NSession.CreateQuery(string.Format("select Country,COUNT(Id) from OrderType {0} group by Country", sqlWhere)).List <object[]>();
            object           obj  =
                NSession.CreateQuery(string.Format("select COUNT(Id) from OrderType {0} ", sqlWhere))
                .UniqueResult();
            decimal sum = Convert.ToDecimal(obj);
            List <ProportionData> list = new List <ProportionData>();

            foreach (object[] objectse in objs)
            {
                ProportionData pd = new ProportionData();
                pd.Count      = Convert.ToInt32(objectse[1]);
                pd.Key        = objectse[0].ToString();
                pd.Proportion = Math.Round((Convert.ToDecimal(pd.Count) / sum) * 100, 2);
                list.Add(pd);
            }
            List <object> footers = new List <object>();

            footers.Add(new { Count = sum });
            return(Json(new { rows = list.OrderByDescending(f => f.Proportion), footer = footers, total = list.Count }));
        }
 public ActionResult OrderCountryData(DateTime st, DateTime et, string a, string p)
 {
     var sqlWhere = SqlWhere(st, et, a, p);
     IList<object[]> objs = NSession.CreateQuery(string.Format("select Country,COUNT(Id) from OrderType {0} group by Country", sqlWhere)).List<object[]>();
     object obj =
         NSession.CreateQuery(string.Format("select COUNT(Id) from OrderType {0} ", sqlWhere))
             .UniqueResult();
     decimal sum = Convert.ToDecimal(obj);
     List<ProportionData> list = new List<ProportionData>();
     foreach (object[] objectse in objs)
     {
         ProportionData pd = new ProportionData();
         pd.Count = Convert.ToInt32(objectse[1]);
         pd.Key = objectse[0].ToString();
         pd.Proportion = Math.Round((Convert.ToDecimal(pd.Count) / sum) * 100, 2);
         list.Add(pd);
     }
     List<object> footers = new List<object>();
     footers.Add(new { Count = sum });
     return Json(new { rows = list.OrderByDescending(f => f.Proportion), footer = footers, total = list.Count });
 }