Beispiel #1
0
        /// <summary>
        /// for each user its total packed shipments and its dates
        /// </summary>
        /// <returns>List of cstUserShipmentCount</returns>
        public List <cstUserShipmentCount> GetAllShipmentCountByUser()
        {
            List <cstUserShipmentCount> _lsUserShipmentCount = new List <cstUserShipmentCount>();

            try
            {
                var Shipments = from shp in lent.Packages
                                group shp by new { shp.UserId, Stime = EntityFunctions.TruncateTime(shp.StartTime) } into Gship
                    select new
                {
                    Userid        = Gship.Key.UserId,
                    PackingDate   = Gship.Key.Stime,
                    ShipmentCount = Gship.Count(i => i.ShippingID != null)
                };
                foreach (var item in Shipments)
                {
                    cstUserShipmentCount Uship = new cstUserShipmentCount();
                    Uship.UserID        = item.Userid;
                    Uship.UserName      = lent.Users.SingleOrDefault(i => i.UserID == item.Userid).UserFullName.ToString();
                    Uship.ShipmentCount = Convert.ToInt32(item.ShipmentCount);
                    Uship.Datepacked    = Convert.ToDateTime(item.PackingDate);
                    _lsUserShipmentCount.Add(Uship);
                }
            }
            catch (Exception)
            {}
            return(_lsUserShipmentCount);
        }
        /// <summary>
        /// for each user its total packed shipments and its dates
        /// </summary>
        /// <returns>List of cstUserShipmentCount</returns>
        public List <cstUserShipmentCount> GetAllShipmentCountByUser()
        {
            List <cstUserShipmentCount> _lsUserShipmentCount = new List <cstUserShipmentCount>();

            try
            {
                var Shipments = Service.Get.GetAllShipmentCountByUser();
                foreach (var item in Shipments)
                {
                    cstUserShipmentCount Uship = new cstUserShipmentCount();
                    Uship.UserID        = item.UserID;
                    Uship.UserName      = item.UserName;
                    Uship.ShipmentCount = Convert.ToInt32(item.ShipmentCount);
                    Uship.Datepacked    = Convert.ToDateTime(item.Datepacked);
                    _lsUserShipmentCount.Add(Uship);
                }
            }
            catch (Exception)
            {}
            return(_lsUserShipmentCount);
        }
Beispiel #3
0
        public void ShipmentCountGraph()
        {
            List <cstUserShipmentCount> _lsShipmetCount = Obj.Rcall.GetUserTotalPakedPerDay().OrderByDescending(x => x.Datepacked).ToList();

            List <String>   lsDistinctNames = _lsShipmetCount.Select(x => x.UserName).Distinct().ToList();
            List <DateTime> lsDistinctDates = _lsShipmetCount.Select(x => x.Datepacked).Distinct().ToList();

            String[] strCatagories = new string[lsDistinctDates.Count];
            Series[] Seri          = new Series[lsDistinctNames.Count()];

            int si = 0;

            object[] lobj = new object[lsDistinctDates.Count];

            foreach (String Namei in lsDistinctNames)
            {
                List <Object> lso = new List <object>();

                foreach (DateTime Dt in lsDistinctDates)
                {
                    cstUserShipmentCount Shipc = new cstUserShipmentCount();
                    Shipc = _lsShipmetCount.SingleOrDefault(i => i.UserName == Namei && i.Datepacked == Dt);
                    if (Shipc == null)
                    {
                        lso.Add(0);
                    }
                    else
                    {
                        lso.Add(Shipc.ShipmentCount);
                    }
                }
                lso.CopyTo(lobj);

                Series Seris = new Series {
                    Name = Namei, Data = new Data(lobj.ToArray())
                };
                Seri[si] = Seris;
                si++;
            }

            for (int i = 0; i < lsDistinctDates.Count; i++)
            {
                strCatagories[i] = lsDistinctDates[i].ToString("MMM dd, yyyy");
            }

            DotNet.Highcharts.Highcharts Chart = new DotNet.Highcharts.Highcharts("Chart")
                                                 .InitChart(new Chart
            {
                Type = ChartTypes.Line,
            })
                                                 .SetTitle(new Title
            {
                Text = "Shipment Packing Count"
            })
                                                 .SetXAxis(new XAxis
            {
                Categories = (strCatagories),
                Title      = new XAxisTitle {
                    Text = "Packing Dates"
                }
            })
                                                 .SetYAxis(new YAxis
            {
                Title = new YAxisTitle {
                    Text = "Shipments packed"
                }
            })
                                                 .SetSeries(Seri);


            ltrTodayspacking.Text = Chart.ToHtmlString();
        }