Пример #1
0
    public void WeekDataLoad()
    {
        //获取本周全局安全状况
        string textWeek   = @"<br /><b>本周安全动态:</b><br /><br />";
        var    YHdataWeek = GetSafeInfo.GetMainLeaderJTYH(System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek), System.DateTime.Today).Tables[0];
        var    SWdataWeek = GetSafeInfo.GetMainLeaderJTSW(System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek), System.DateTime.Today).Tables[0];

        if (YHdataWeek.Rows.Count <= 0 && SWdataWeek.Rows.Count <= 0)
        {
            textWeek += "&nbsp;&nbsp;本周无安全动态!";
        }
        else
        {
            if (YHdataWeek.Rows.Count > 0)
            {
                //textWeek += "全局隐患信息:<br />";
                for (int i = 0; i < YHdataWeek.Rows.Count; i++)
                {
                    textWeek += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条</span> <br />", YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek).ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), YHdataWeek.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
            if (SWdataWeek.Rows.Count > 0)
            {
                //textWeek += "全局三违信息:<br />";
                for (int i = 0; i < SWdataWeek.Rows.Count; i++)
                {
                    textWeek += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", SWdataWeek.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(SWdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek).ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), SWdataWeek.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
        }
        this.WeekPanel.Html = textWeek;
    }
Пример #2
0
    public void storebind()
    {
        if (dfBegin.SelectedDate > dfEnd.SelectedDate)
        {
            Ext.Msg.Alert("提示", "请选择正确日期").Show();
            return;
        }
        //var data = dc.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate);

        if (SessionBox.GetUserSession().rolelevel.Contains("1") || SessionBox.GetUserSession().rolelevel.Contains("0"))
        {
            if (cbbUnit.SelectedIndex > -1 && cbbUnit.SelectedItem.Value != "-1")
            {
                var data = GetSafeInfo.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate, cbbUnit.SelectedItem.Value);
                Store1.DataSource = data;
                Store1.DataBind();
            }
            else
            {
                var data = GetSafeInfo.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate, "");
                Store1.DataSource = data;
                Store1.DataBind();
            }
        }
        else
        {
            var data = GetSafeInfo.GetAllSafetyCountByPAreas(dfBegin.SelectedDate, dfEnd.SelectedDate, SessionBox.GetUserSession().DeptNumber);
            Store1.DataSource = data;
            Store1.DataBind();
        }
    }
Пример #3
0
    public void MonthDataLoad()
    {
        //获取当月全局安全状况
        DateTime start       = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, 1);
        DateTime end         = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, DateTime.DaysInMonth(System.DateTime.Today.Year, System.DateTime.Today.Month));
        string   textMonth   = @"<br /><b>本月安全动态:</b><br /><br />";
        var      YHdataMonth = GetSafeInfo.GetMainLeaderJTYH(start, end).Tables[0];
        var      SWdataMonth = GetSafeInfo.GetMainLeaderJTSW(start, end).Tables[0];

        if (YHdataMonth.Rows.Count <= 0 && SWdataMonth.Rows.Count <= 0)
        {
            textMonth += "&nbsp;&nbsp;本月无安全动态!";
        }
        else
        {
            if (YHdataMonth.Rows.Count > 0)
            {
                //textMonth += "全局隐患信息:<br />";
                for (int i = 0; i < YHdataMonth.Rows.Count; i++)
                {
                    textMonth += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条 </span><br />", YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), YHdataMonth.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
            if (SWdataMonth.Rows.Count > 0)
            {
                //textMonth += "全局三违信息:<br />";
                for (int i = 0; i < SWdataMonth.Rows.Count; i++)
                {
                    textMonth += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}>{0}</font>级别三违:" + SWstr + "条 </span><br />", SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), SWdataMonth.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
        }
        this.MonthPanel.Html = textMonth;
    }
Пример #4
0
    public void WeekDataLoad()
    {
        //获取本周全矿安全状况
        string textWeek = @"<br /><b>本周安全动态:</b><br /><br />";
        //var YHdataWeek = from c in dc.Yhview
        //                 where (c.Pctime.Value >= System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek) && c.Pctime.Value <= System.DateTime.Today) && c.Maindeptid == SessionBox.GetUserSession().DeptNumber
        //                 group c by c.Levelname into g
        //                 orderby g.Key
        //                 select new
        //                 {
        //                     YHLevel = g.Key,
        //                     YHnum = g.Count()
        //                 };
        //var SWdataWeek = from c in dc.Getsanwei
        //                 where (c.Pctime.Value >= System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek) && c.Pctime.Value <= System.DateTime.Today) && c.Dwid == SessionBox.GetUserSession().DeptNumber
        //                 group c by c.Levelname into g
        //                 select new
        //                 {
        //                     SWLevel = g.Key,
        //                     SWnum = g.Count()
        //                 };
        var YHdataWeek = GetSafeInfo.GetMainLeaderYH(System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek), System.DateTime.Today, SessionBox.GetUserSession().DeptNumber).Tables[0];
        //var SWdataWeek = GetSafeInfo.GetMainLeaderSW(System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek), System.DateTime.Today, SessionBox.GetUserSession().DeptNumber).Tables[0];
        var SWdataWeek = from s in dc.Getsanwei
                         where s.Pctime >= System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek) && s.Pctime <= System.DateTime.Today &&
                         s.Dwid == SessionBox.GetUserSession().DeptNumber
                         group s by s.Levelname into g
                         select new
        {
            g.Key,
            swnum = g.Count()
        };

        if (YHdataWeek.Rows.Count <= 0 && SWdataWeek.Count() <= 0)
        {
            textWeek += "&nbsp;&nbsp;本周无安全动态!";
        }
        else
        {
            if (YHdataWeek.Rows.Count > 0)
            {
                textWeek += "全矿隐患信息:<br />";
                for (int i = 0; i < YHdataWeek.Rows.Count; i++)
                {
                    textWeek += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条</span> <br />", YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek).ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), YHdataWeek.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataWeek.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
            if (SWdataWeek.Count() > 0)
            {
                textWeek += "全矿三违信息:<br />";
                foreach (var r in SWdataWeek)
                {
                    textWeek += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", r.Key, Server.UrlEncode(r.Key), System.DateTime.Today.AddDays(1 - (int)System.DateTime.Today.DayOfWeek).ToString("yyyy-MM-dd"), System.DateTime.Today.ToString("yyyy-MM-dd"), r.swnum, GetColor1(r.Key));
                }
            }
        }
        this.WeekPanel.Html = textWeek;
    }
Пример #5
0
    private string GetDataXML()
    {
        DBSCMDataContext dc = new DBSCMDataContext();
        var table = GetSafeInfo.GetAllSafetyCountByDept(cbbUnit.SelectedItem.Value, dfBegin.SelectedDate, dfEnd.SelectedDate).Tables[0];
        try
        {
            var group = from t in table.AsEnumerable().ToList()
                        orderby int.Parse(t["YZD"].ToString()) descending, Convert.ToInt32(t["YHALL"]) + Convert.ToInt32(t["SWALL"]) descending
                        select new
                        {
                            //Key = t.Field<string>("DEPTNAME"),
                            //Total = t.Field<int>("YZD"),
                            //Fine = t.Field<int>("YHALL") + t.Field<int>("SWALL")
                            Key = t["DEPTNAME"].ToString(),
                            Total = int.Parse(t["YZD"].ToString()),
                            Fine = Convert.ToInt32(t["YHALL"]) + Convert.ToInt32(t["SWALL"])
                        };

            Store1.DataSource = group;
            Store1.DataBind();

            if (group.Count() == 0)
            {
                return "<chart />";
            }

            StringBuilder chartBuilder = new StringBuilder();
            chartBuilder.Append("<chart caption='走动情况分析' xAxisName='单位名称' yAxisName='数量'  showValues='0' palette='2' shownames='1' legendBorderAlpha='0' useRoundEdges='1' animation='1' decimalPrecision='0' formatNumberScale='0' baseFont='Arial' baseFontSize='12'>");

            string categories = "<categories>";
            string dataset1 = "<dataset seriesName='走动次数' color='AFD8F8' showValues='1'>";
            string dataset2 = "<dataset seriesName='问题数量' color='8BBA00' showValues='1'>";
            foreach (var r in group)
            {
                categories += "<category label='" + r.Key + "' />";
                dataset1 += "<set value='" + r.Total + "' />";
                dataset2 += "<set value='" + r.Fine + "' />";
            }
            categories += "</categories>";
            dataset1 += "</dataset>";
            dataset2 += "</dataset>";
            chartBuilder.Append(categories);
            chartBuilder.Append(dataset1);
            chartBuilder.Append(dataset2);
            chartBuilder.Append("</chart>");
            return chartBuilder.ToString();
        }
        catch
        {
            //Store1.DataSource = null;
            //Store1.DataBind();
            return "<chart />";
        }
    }
Пример #6
0
 public void storebind()
 {
     if (dfBegin.SelectedDate > dfEnd.SelectedDate)
     {
         Ext.Msg.Alert("提示", "请选择正确日期").Show();
         return;
     }
     // DataSet ds = new DataSet();
     //var data = ds;
     //var datayh = (from sw in dc.Getyhinput
     //            where
     //            sw.Pctime >= dfBegin.SelectedDate && sw.Pctime <= dfEnd.SelectedDate
     //            select sw).ToList();
     //var groupyh = from sw in datayh
     //            group sw by new{
     //                sw.Deptid,
     //                sw.Deptname,
     //                sw.Unitid
     //            }
     //                into g
     //            select new
     //            {
     //                g.Key.Deptid,
     //                g.Key.Deptname,
     //                g.Key.Unitid,
     //                Total = g.Count(),
     //                Pass = g.Count(p => p.Status == "复查通过"),
     //                NPass = g.Count(p => p.Status != "复查通过")
     //            };
     //var groupsw= from sw in dc.Nswinput
     //             group sw by sw.
     if (SessionBox.GetUserSession().rolelevel.Contains("1") || SessionBox.GetUserSession().rolelevel.Contains("0"))
     {
         if (cbbUnit.SelectedIndex > -1 && cbbUnit.SelectedItem.Value != "-1")
         {
             var data = GetSafeInfo.GetAllSafetyCountByDept(cbbUnit.SelectedItem.Value, dfBegin.SelectedDate, dfEnd.SelectedDate);
             Store1.DataSource = data;
             Store1.DataBind();
         }
         else
         {
             var data = GetSafeInfo.GetAllSafetyCountByDept("", dfBegin.SelectedDate, dfEnd.SelectedDate);
             Store1.DataSource = data;
             Store1.DataBind();
         }
     }
     else
     {
         var data = GetSafeInfo.GetAllSafetyCountByDept(SessionBox.GetUserSession().DeptNumber, dfBegin.SelectedDate, dfEnd.SelectedDate);
         Store1.DataSource = data;
         Store1.DataBind();
     }
 }
Пример #7
0
    //绑定走动人员
    private void bindPlan(string maindept)
    {
        //var sqltext = from a in db.Moveplan
        //              from b in db.Person
        //              from c in db.Position
        //              from d in db.Department
        //              where a.Personid == b.Personnumber && b.Posid == c.Posid && b.Deptid == d.Deptnumber && a.Starttime.Value.Month == System.DateTime.Now.Month && System.DateTime.Now.Month == a.Endtime.Value.Month
        //              && b.Maindeptid == maindept
        //              select new
        //              {
        //                  PersonID = a.Personid,
        //                  b.Name,
        //                  PosName = c.Posname,
        //                  DeptName = d.Deptname
        //              };
        var sqltext = GetSafeInfo.GetDiaoDu(maindept).Tables[0];

        Store1.DataSource = sqltext;
        Store1.DataBind();
    }
Пример #8
0
    //绑定详细计划
    private void detailPlan(string PersonID)
    {
        //var sqltext = from a in db.Moveplan
        //              from b in db.Person
        //              from c in db.Place
        //              from d in db.Department
        //              where a.Personid == b.Personnumber && a.Placeid == c.Placeid && b.Deptid == d.Deptnumber && a.Personid == PersonID && a.Starttime.Value.Month == System.DateTime.Now.Month && System.DateTime.Now.Month == a.Endtime.Value.Month
        //              && b.Maindeptid == SessionBox.GetUserSession().DeptNumber
        //              select new
        //              {
        //                  ID = a.Id,
        //                  EndTime = a.Endtime,
        //                  StartTime = a.Starttime,
        //                  PersonID = a.Personid,
        //                  b.Name,
        //                  PlaceName = c.Placename,
        //                  DeptName = d.Deptname,
        //                  MoveState = a.Movestate
        //              };
        var sqltext = GetSafeInfo.GetDiaoDuInfo(PersonID).Tables[0];

        this.Store2.DataSource = sqltext;
        this.Store2.DataBind();
    }
Пример #9
0
    public void YearDataLoad()
    {
        //获取当年全局安全状况
        int      date     = System.DateTime.Today.Year;
        string   textYear = @"<br /><b>" + date + "年全局安全动态:</b><br /><br />";
        DateTime daybegin = new DateTime(System.DateTime.Today.Year, 1, 1);
        DateTime dayend   = new DateTime(System.DateTime.Today.Year, 12, 31);
        var      YHdata   = GetSafeInfo.GetMainLeaderJTYH(daybegin, dayend).Tables[0];
        var      SWdata   = GetSafeInfo.GetMainLeaderJTSW(daybegin, dayend).Tables[0];

        if (YHdata.Rows.Count <= 0 && SWdata.Rows.Count <= 0)
        {
            textYear += "&nbsp;&nbsp;本年度无安全动态!";
        }
        else
        {
            if (YHdata.Rows.Count > 0)
            {
                //textYear += "全局隐患信息:<br />";
                for (int i = 0; i < YHdata.Rows.Count; i++)
                {
                    textYear += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left> <font color={2}><b>{0}</b></font>级隐患:{1}条 <br /></span>", YHdata.Rows[i]["LEVELNAME"].ToString().Trim(), YHdata.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdata.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
            if (SWdata.Rows.Count > 0)
            {
                //textYear += "全局三违信息:<br />";

                for (int i = 0; i < SWdata.Rows.Count; i++)
                {
                    textYear += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={2}><b>{0}</b></font>级别三违:{1}条 <br /></span>", SWdata.Rows[i]["LEVELNAME"].ToString().Trim(), SWdata.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdata.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
        }
        this.YearPanel.Html = textYear;
    }
Пример #10
0
    public void YearDataLoad()
    {
        //获取当年全矿安全状况
        int    date     = System.DateTime.Today.Year;
        string textYear = @"<br /><b>" + date + "年全矿安全动态:</b><br /><br />";
        //var YHdata = from c in dc.Yhview
        //             where c.Pctime.Value.Year == System.DateTime.Today.Year && c.Maindeptid == SessionBox.GetUserSession().DeptNumber
        //             group c by c.Levelname into g
        //             orderby g.Key
        //             select new
        //             {
        //                 YHLevel = g.Key,
        //                 YHnum = g.Count()
        //             };
        //var SWdata = from c in dc.Getsanwei
        //             where c.Pctime.Value.Year == System.DateTime.Today.Year && c.Dwid == SessionBox.GetUserSession().DeptNumber
        //             group c by c.Levelname into g
        //             select new
        //             {
        //                 SWLevel = g.Key,
        //                 SWnum = g.Count()
        //             };
        DateTime daybegin = new DateTime(System.DateTime.Today.Year, 1, 1);
        DateTime dayend   = new DateTime(System.DateTime.Today.Year, 12, 31);
        var      YHdata   = GetSafeInfo.GetMainLeaderYH(daybegin, dayend, SessionBox.GetUserSession().DeptNumber).Tables[0];
        //var SWdata = GetSafeInfo.GetMainLeaderSW(daybegin, dayend, SessionBox.GetUserSession().DeptNumber).Tables[0];
        var SWdata = from s in dc.Getsanwei
                     where s.Pctime >= daybegin && s.Pctime <= dayend &&
                     s.Dwid == SessionBox.GetUserSession().DeptNumber
                     group s by s.Levelname into g
                     select new
        {
            g.Key,
            swnum = g.Count()
        };

        if (YHdata.Rows.Count <= 0 && SWdata.Count() <= 0)
        {
            textYear += "&nbsp;&nbsp;本年度无安全动态!";
        }
        else
        {
            if (YHdata.Rows.Count > 0)
            {
                textYear += "全矿隐患信息:<br />";
                for (int i = 0; i < YHdata.Rows.Count; i++)
                {
                    textYear += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left> <font color={2}><b>{0}</b></font>级隐患:{1}条 <br /></span>", YHdata.Rows[i]["LEVELNAME"].ToString().Trim(), YHdata.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdata.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
            if (SWdata.Count() > 0)
            {
                textYear += "全矿三违信息:<br />";
                foreach (var r in SWdata)
                {
                    textYear += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", r.Key, Server.UrlEncode(r.Key), daybegin, dayend, r.swnum, GetColor1(r.Key));
                }
            }
        }
        this.YearPanel.Html = textYear;
    }
Пример #11
0
    public void MonthDataLoad()
    {
        //获取当月全矿安全状况
        DateTime start     = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, 1);
        DateTime end       = new DateTime(System.DateTime.Today.Year, System.DateTime.Today.Month, DateTime.DaysInMonth(System.DateTime.Today.Year, System.DateTime.Today.Month));
        string   textMonth = @"<br /><b>本月安全动态:</b><br /><br />";
        //var YHdataMonth = from c in dc.Yhview
        //                  where (c.Pctime.Value >= start && c.Pctime.Value <= end) && c.Maindeptid == SessionBox.GetUserSession().DeptNumber
        //                  group c by c.Levelname into g
        //                  orderby g.Key
        //                  select new
        //                  {
        //                      YHLevel = g.Key,
        //                      YHnum = g.Count()
        //                  };
        //var SWdataMonth = from c in dc.Getsanwei
        //                  where (c.Pctime.Value >= start && c.Pctime.Value <= end) && c.Dwid == SessionBox.GetUserSession().DeptNumber
        //                  group c by c.Levelname into g
        //                  select new
        //                  {
        //                      SWLevel = g.Key,
        //                      SWnum = g.Count()
        //                  };
        var YHdataMonth = GetSafeInfo.GetMainLeaderYH(start, end, SessionBox.GetUserSession().DeptNumber).Tables[0];
        //var SWdataMonth = GetSafeInfo.GetMainLeaderSW(start, end, SessionBox.GetUserSession().DeptNumber).Tables[0];
        var SWdataMonth = from s in dc.Getsanwei
                          where s.Pctime >= start && s.Pctime <= end &&
                          s.Dwid == SessionBox.GetUserSession().DeptNumber
                          group s by s.Levelname into g
                          select new
        {
            g.Key,
            swnum = g.Count()
        };

        if (YHdataMonth.Rows.Count <= 0 && SWdataMonth.Count() <= 0)
        {
            textMonth += "&nbsp;&nbsp;本月无安全动态!";
        }
        else
        {
            if (YHdataMonth.Rows.Count > 0)
            {
                textMonth += "全矿隐患信息:<br />";
                for (int i = 0; i < YHdataMonth.Rows.Count; i++)
                {
                    textMonth += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级隐患:" + YHstr + "条 </span><br />", YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), YHdataMonth.Rows[i]["YHNUM"].ToString().Trim(), GetColor(YHdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()));
                }
            }
            if (SWdataMonth.Count() > 0)
            {
                textMonth += "全矿三违信息:<br />";
                foreach (var r in SWdataMonth)
                {
                    textMonth += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}><b>{0}</b></font>级别三违:" + SWstr + "条 </span><br />", r.Key, Server.UrlEncode(r.Key), start, end, r.swnum, GetColor1(r.Key));
                }
                //for (int i = 0; i < SWdataMonth.Rows.Count;i++)
                //{
                //    textMonth += string.Format("&nbsp;&nbsp;&nbsp;&nbsp;<span align=left><font color={5}>{0}</font>级别三违:" + SWstr + "条 </span><br />", SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim(), Server.UrlEncode(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).ToString("yyyy-MM-dd"), System.DateTime.Today.AddDays(1 - System.DateTime.Today.Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), SWdataMonth.Rows[i]["SWNUM"].ToString().Trim(), GetColor1(SWdataMonth.Rows[i]["LEVELNAME"].ToString().Trim()));
                //}
            }
        }
        this.MonthPanel.Html = textMonth;
    }
Пример #12
0
    private string GetDataXML()
    {
        DBSCMDataContext dc = new DBSCMDataContext();


        if (cbbKind.SelectedItem.Value == "1" || cbbKind.SelectedItem.Value == "")
        {
            var table = GetSafeInfo.GetAllSafetyCountByDept(cbbUnit.SelectedItem.Value, dfBegin.SelectedDate, dfEnd.SelectedDate).Tables[0];
            try
            {
                //var group = from t in table.AsEnumerable()
                //            where (t["YHALL"].ToString() != "0" || t["YHYZG"].ToString() != "0" || t["YHWZG"].ToString()!="0")
                //            orderby int.Parse(t["YHALL"].ToString()) descending
                //            select new
                //            {
                //                Key = t["DEPTNAME"].ToString(),
                //                Total = t["YHALL"].ToString(),
                //                Pass = t["YHYZG"].ToString(),
                //                NPass = t["YHWZG"].ToString()
                //            };
                var data = (from sw in dc.Getyhinput
                            where sw.Unitid == cbbUnit.SelectedItem.Value &&
                            sw.Pctime >= dfBegin.SelectedDate && sw.Pctime <= dfEnd.SelectedDate
                            select sw).ToList();
                var group = from sw in data
                            group sw by sw.Deptname into g
                            select new
                {
                    Key   = g.Key,
                    Total = g.Count(),
                    Pass  = g.Count(p => p.Status == "复查通过" || p.Status == "现场整改"),
                    NPass = g.Count(p => p.Status != "复查通过" && p.Status != "现场整改")
                };
                GridPanel1.ColumnModel.SetColumnHeader(0, cbbKind.SelectedItem.Text.Trim() == "" ? "隐患部门" : cbbKind.SelectedItem.Text);
                Store1.DataSource = group;
                Store1.DataBind();

                if (group.Count() == 0)
                {
                    return("<chart />");
                }

                StringBuilder chartBuilder = new StringBuilder();
                chartBuilder.Append("<chart caption='隐患分析' xAxisName='" + (cbbKind.SelectedItem.Text.Trim() == "" ? "隐患部门" : cbbKind.SelectedItem.Text) + "' yAxisName='数量'  showValues='0' palette='2' shownames='1' legendBorderAlpha='0' useRoundEdges='1' animation='1' decimalPrecision='0' formatNumberScale='0' baseFont='Arial' baseFontSize='12'>");

                string categories = "<categories>";
                string dataset1   = "<dataset seriesName='隐患数量' color='AFD8F8' showValues='1'>";
                string dataset2   = "<dataset seriesName='已解决' color='8BBA00' showValues='1'>";
                string dataset3   = "<dataset seriesName='未解决' color='8B0000' showValues='1'>";
                foreach (var r in group)
                {
                    categories += "<category label='" + r.Key + "' />";
                    dataset1   += "<set value='" + r.Total + "' />";
                    dataset2   += "<set value='" + r.Pass + "' />";
                    dataset3   += "<set value='" + r.NPass + "' />";
                }
                categories += "</categories>";
                dataset1   += "</dataset>";
                dataset2   += "</dataset>";
                dataset3   += "</dataset>";
                chartBuilder.Append(categories);
                chartBuilder.Append(dataset1);
                chartBuilder.Append(dataset2);
                chartBuilder.Append(dataset3);
                chartBuilder.Append("</chart>");
                return(chartBuilder.ToString());
            }
            catch
            {
                Store1.DataSource = null;
                Store1.DataBind();
                return("<chart />");
            }
        }
        else
        {
            var date = (from sw in dc.Getyhinput
                        where sw.Unitid == cbbUnit.SelectedItem.Value &&
                        sw.Pctime >= dfBegin.SelectedDate && sw.Pctime <= dfEnd.SelectedDate
                        select sw).ToList();
            var group = from sw in date
                        group sw by sw.Placename into g
                        orderby g.Count() descending
                        select new
            {
                Key   = g.Key,
                Total = g.Count(),
                Pass  = g.Count(p => p.Status == "复查通过" || p.Status == "现场整改"),
                NPass = g.Count(p => p.Status != "复查通过" && p.Status != "现场整改")
            };
            GridPanel1.ColumnModel.SetColumnHeader(0, cbbKind.SelectedItem.Text.Trim() == "" ? "隐患部门" : cbbKind.SelectedItem.Text);
            Store1.DataSource = group;
            Store1.DataBind();

            if (group.Count() == 0)
            {
                return("<chart />");
            }

            StringBuilder chartBuilder = new StringBuilder();
            chartBuilder.Append("<chart caption='隐患分析' xAxisName='" + (cbbKind.SelectedItem.Text.Trim() == "" ? "隐患部门" : cbbKind.SelectedItem.Text) + "' yAxisName='数量'  showValues='0' palette='2' shownames='1' legendBorderAlpha='0' useRoundEdges='1' animation='1' decimalPrecision='0' formatNumberScale='0' baseFont='Arial' baseFontSize='12'>");

            string categories = "<categories>";
            string dataset1   = "<dataset seriesName='隐患数量' color='AFD8F8' showValues='1'>";
            string dataset2   = "<dataset seriesName='已解决' color='8BBA00' showValues='1'>";
            string dataset3   = "<dataset seriesName='未解决' color='8B0000' showValues='1'>";
            foreach (var r in group)
            {
                categories += "<category label='" + r.Key + "' />";
                dataset1   += "<set value='" + r.Total + "' />";
                dataset2   += "<set value='" + r.Pass + "' />";
                dataset3   += "<set value='" + r.NPass + "' />";
            }
            categories += "</categories>";
            dataset1   += "</dataset>";
            dataset2   += "</dataset>";
            dataset3   += "</dataset>";
            chartBuilder.Append(categories);
            chartBuilder.Append(dataset1);
            chartBuilder.Append(dataset2);
            chartBuilder.Append(dataset3);
            chartBuilder.Append("</chart>");
            return(chartBuilder.ToString());
        }
        //GridPanel1.ColumnModel.SetColumnHeader(0, cbbKind.SelectedItem.Text.Trim() == "" ? "隐患部门" : cbbKind.SelectedItem.Text);
        //Store1.DataSource = group;
        //Store1.DataBind();

        //if (group.Count() == 0)
        //{
        //    return "<chart />";
        //}

        //StringBuilder chartBuilder = new StringBuilder();
        //chartBuilder.Append("<chart caption='隐患分析' xAxisName='" + (cbbKind.SelectedItem.Text.Trim() == "" ? "隐患部门" : cbbKind.SelectedItem.Text) + "' yAxisName='数量'  showValues='0' palette='2' shownames='1' legendBorderAlpha='0' useRoundEdges='1' animation='1' decimalPrecision='0' formatNumberScale='0' baseFont='Arial' baseFontSize='12'>");

        //string categories = "<categories>";
        //string dataset1 = "<dataset seriesName='隐患数量' color='AFD8F8' showValues='0'>";
        //string dataset2 = "<dataset seriesName='已解决' color='8BBA00' showValues='0'>";
        //string dataset3 = "<dataset seriesName='未解决' color='8B0000' showValues='0'>";
        //foreach (var r in group)
        //{
        //    categories += "<category label='" + r.Key + "' />";
        //    dataset1 += "<set value='" + r.Total + "' />";
        //    dataset2 += "<set value='" + r.Pass + "' />";
        //    dataset3 += "<set value='" + r.NPass + "' />";
        //}
        //categories += "</categories>";
        //dataset1 += "</dataset>";
        //dataset2 += "</dataset>";
        //dataset3 += "</dataset>";
        //chartBuilder.Append(categories);
        //chartBuilder.Append(dataset1);
        //chartBuilder.Append(dataset2);
        //chartBuilder.Append(dataset3);
        //chartBuilder.Append("</chart>");
        //return chartBuilder.ToString();
    }