Exemplo n.º 1
0
        protected void LoadROGraph(string selectedDepartment, DateTime From, DateTime To)
        {
            List <string> departmentcode = new List <string>();
            var           context        = new LogicUniversityEntities();

            var result = context.requisition_order.Where(x => (x.requisition_status == "Approved") && (x.requisition_date >= From) && (x.requisition_date <= To)).ToList();

            foreach (requisition_order dept in result)
            {
                departmentcode.Add(dept.requisition_id.Substring(0, 4));
            }
            var    query  = departmentcode.GroupBy(s => s).Select(g => new { Dept = g.Key, Count = g.Count() });
            Series series = getROBasedDepartmentAndTime.Series["Series1"];

            Departments.ClearSelection();

            foreach (var r in query)
            {
                if ((r.Count != 0) && (selectedDepartment.Contains(r.Dept)))
                {
                    Departments.Items.FindByValue(r.Dept).Selected = true;
                    series.Points.AddXY(r.Dept, r.Count);
                }
            }

            if (getROBasedDepartmentAndTime != null)
            {
                ErrorMSg.Visible = false;
            }
            else
            {
                ErrorMSg.Text = "Please make other selection";
            }
        }