Exemplo n.º 1
0
        private List<DailyItem> GetDayAndEventTotalNumbers()
        {
            List<DailyItem> day_and_event_number = new List<DailyItem>();
            //按行遍历
            DataTable dt = DAL.SQLHelper.ExecuteDt("select  SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) day,count(*) amount from TripletsSet t group by SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) order by SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) asc");
            foreach (DataRow row in dt.Rows)
            {
                //day_and_event_number.Add(Convert.ToString(row["day"]),Convert.ToInt32(row["amount"]));
                DateTime date = Convert.ToDateTime(row["day"]);
                String JSFormatDate= date.Year.ToString() + "," + (date.Month - 1).ToString() + "," + date.Day.ToString();

                DailyItem item = new DailyItem() { date = JSFormatDate, number = Convert.ToInt32(row["amount"]) };
                day_and_event_number.Add(item);

            }
            return day_and_event_number;
        }
Exemplo n.º 2
0
        private List<DailyItem> GetSingleEventList(String verbStr,String objectStr)
        {
            List<DailyItem> day_and_single_event_number = new List<DailyItem>();
            //按行遍历
            //////////////////////////////////////////////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@verbStr", SqlDbType.VarChar) { Value = verbStr };
            parameters[1] = new SqlParameter("@objectStr", SqlDbType.VarChar) { Value = objectStr };
            String t_sql = "select  SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) day,count(*) amount from TripletsSet t where Verb=@verbStr and Object=@objectStr group by SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) order by SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) asc";
            DataTable dt = DAL.SQLHelper.GetDataTable(t_sql,parameters);
            //DataTable dt = DAL.SQLHelper.ExecuteDt("select  SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) day,count(*) amount from TripletsSet t where Verb='activity_expand ' and Object='marie-architecture ' group by SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) order by SUBSTRING(CONVERT(CHAR(23),t.TimeStamp , 121),1,10) asc");
            foreach (DataRow row in dt.Rows)
            {
                //day_and_event_number.Add(Convert.ToString(row["day"]),Convert.ToInt32(row["amount"]));
               DateTime date = Convert.ToDateTime(row["day"]);
                String JSFormatDate = date.Year.ToString() + "," + (date.Month - 1).ToString() + "," + date.Day.ToString();

               DailyItem item = new DailyItem() { date = JSFormatDate, number = Convert.ToInt32(row["amount"]) };
               day_and_single_event_number.Add(item);

            }
            return day_and_single_event_number;
        }