protected void ASPxDashboardViewer1_DataLoading(object sender, DevExpress.DashboardWeb.DataLoadingWebEventArgs e) { using (var connection = new SqlConnection(StrConn)) { var registersTendency = new dsRegister.RegistersTendencyDataTable(); connection.Open(); string sqlRegistersTendency = String.Format("select mmr.CreateDate ,mmr.[Hour] ,SUM(mmr.DataValue) DataValue " + "from M_MemberRegister mmr WITH(NOLOCK) " + "where mmr.ModifyTime >DATEADD(hour, {0}, GETDATE()) " + "group by mmr.CreateDate,mmr.[Hour] order by mmr.CreateDate,mmr.[Hour]", tendencyHour); var result = connection.Query <RegistersTendencyEntity>(sqlRegistersTendency); foreach (var item in result) { registersTendency.AddRegistersTendencyRow(item.CreateDate, item.Hour, item.DataValue); } e.Data = registersTendency; } }
protected void OnDashBoard2Fresh(object sender, UserEventArgs e) { using (var connection = new SqlConnection(StrConn)) { var registersTendency = new dsRegister.RegistersTendencyDataTable(); connection.Open(); string sqlRegistersTendency = String.Format("select mmr.CreateDate ,mmr.[Hour] ,mmr.MemberLevel,mmr.DataValue DataValue " + "from M_MemberRegister mmr WITH(NOLOCK) " + "where mmr.ModifyTime >DATEADD(hour, {0}, GETDATE()) " + "order by mmr.CreateDate,mmr.[Hour]", e.Value); var result = connection.Query <RegistersTendencyEntity>(sqlRegistersTendency); foreach (var item in result) { registersTendency.AddRegistersTendencyRow(item.CreateDate, item.Hour, item.DataValue); } dataSourse = registersTendency; } CallBackDashBoard2.DataSourse = dataSourse; }