/// <summary> /// 根据时间获取四类信息。 /// </summary> /// <param name="times"></param> /// <param name="errMsg"></param> /// <returns></returns> public List <StatisticInfo> GetHomeByTime(string times, out string errMsg) { DataTable dts = dt.GetHomeByTime(times, out errMsg); List <StatisticInfo> infoList = new List <StatisticInfo>(); //转化为list,筛选。 if (dts.Rows.Count > 0) { for (int i = 0; i < dts.Rows.Count; i++) { StatisticInfo info = new StatisticInfo(); info.T_INDICATORNAME = String.IsNullOrEmpty(dts.Rows[i]["T_INDICATORNAME"].ToString()) ? String.Empty : dts.Rows[i]["T_INDICATORNAME"].ToString(); info.T_UNITNAME = String.IsNullOrEmpty(dts.Rows[i]["T_UNITNAME"].ToString()) ? String.Empty : dts.Rows[i]["T_UNITNAME"].ToString(); info.T_TIME = String.IsNullOrEmpty(dts.Rows[i]["T_TIME"].ToString()) ? String.Empty : dts.Rows[i]["T_TIME"].ToString(); info.D_HNALL = String.IsNullOrEmpty(dts.Rows[i]["D_HNALL"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_HNALL"].ToString()); info.D_HNADD = String.IsNullOrEmpty(dts.Rows[i]["D_HNADD"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_HNADD"].ToString()); info.D_DTALL = String.IsNullOrEmpty(dts.Rows[i]["D_DTALL"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_DTALL"].ToString()); info.D_DTADD = String.IsNullOrEmpty(dts.Rows[i]["D_DTADD"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_DTADD"].ToString()); info.D_HDALL = String.IsNullOrEmpty(dts.Rows[i]["D_HDALL"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_HDALL"].ToString()); info.D_HDADD = String.IsNullOrEmpty(dts.Rows[i]["D_HDADD"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_HDADD"].ToString()); info.D_GDALL = String.IsNullOrEmpty(dts.Rows[i]["D_GDALL"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_GDALL"].ToString()); info.D_GDADD = String.IsNullOrEmpty(dts.Rows[i]["D_GDADD"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_GDADD"].ToString()); info.D_ZDTALL = String.IsNullOrEmpty(dts.Rows[i]["D_ZDTALL"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_ZDTALL"].ToString()); info.D_ZDTADD = String.IsNullOrEmpty(dts.Rows[i]["D_ZDTADD"].ToString()) ? 0 : Convert.ToDouble(dts.Rows[i]["D_ZDTADD"].ToString()); infoList.Add(info); } } return(infoList); }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { if (txtUserName.Text.Trim() == "admin" && txtPwd.Text.Trim() == "admin") { Response.Redirect("~/default.aspx"); } User user = new User(); user.UserID = txtUserName.Text.Trim(); user.UserPWD = txtPwd.Text; BaseInfo baseInfo = new BaseInfo(); StatisticInfo sa = new StatisticInfo(); if (baseInfo.Login(user)) { Session["user"] = user; FormsAuthentication.SetAuthCookie(user.UserID, false); Response.Redirect("~/default.aspx"); } else { lblmessage.Text = "用户名或密码错误!"; txtPwd.Text = ""; txtPwd.Focus(); } }
public CountryStatistic(int id, CountryInfo countryInfo, StatisticInfo latest, StatisticInfo last) { Id = id; CountryInfo = countryInfo; Latest = latest; Last = last; }
public ActionResult Edit(int id) { StatisticInfo info = null; if (id > 0) info = this.Factory.AllStatistics.FirstOrDefault(item => item.Id.Equals(id)); if (info == null) info = new StatisticInfo(); StatInfoModel model = new StatInfoModel(info); this.FillModel(model); return View(model); }
public StatInfoModel(StatisticInfo info) { if (info == null) info = new StatisticInfo(); this.FiltersForData = new List<IdValue>(); this.FiltersForOrdered = new List<IdValue>(); this.FiltersForOnStock = new List<IdValue>(); this.AllUsages = new List<string>(); this.AllTemplates = new List<string>(); this.StatInfo = info; }
public void ProcessRequest(HttpContext context) { string time = context.Request["time"].ToString() != "undefined" ? context.Request["time"].ToString() : string.Empty; string times = string.Empty; //时间 times += String.IsNullOrEmpty(time) ? string.Empty : time + "-01 00:00:00.0"; //times = "2013-05-01 00:00:00.0"; List <StatisticInfo> info = new List <StatisticInfo>(); info = bt.GetHomeByTime(times, out errMsg); List <StatisticInfo> saveInfo = new List <StatisticInfo>(); StatisticInfo tmp = new StatisticInfo(); if (info.Count > 0) { //发电设备容量 tmp = info.Where(infos => infos.T_INDICATORNAME == "设备容量").FirstOrDefault(); saveInfo.Add(tmp); //发电设备利用小时 tmp = info.Where(infos => infos.T_INDICATORNAME == "利用小时").FirstOrDefault(); saveInfo.Add(tmp); //供电煤耗 tmp = info.Where(infos => infos.T_INDICATORNAME == "供电煤耗").FirstOrDefault(); saveInfo.Add(tmp); //厂用电率 tmp = info.Where(infos => infos.T_INDICATORNAME == "厂用电率").FirstOrDefault(); saveInfo.Add(tmp); } else { for (int i = 0; i < 4; i++) { saveInfo.Add(tmp); } } string content = saveInfo.ToJsonItem(); context.Response.ContentType = "text/json;charset=gb2312;"; context.Response.Write(content); }
public GameScoreData Initial() { Statistic = new StatisticInfo(); Reward = new GameReward(); Pang = 0; BonusPang = 0; Score = 0; ParCount = 0; ShotCount = 0; TotalShot = 1; // { Total shot default is 1 } EXP = 0; HoleComplete = false; HoleCompletedCount = 0; Reward.Initial(); Quited = false; Rate = 0; return(this); }
public NewSaleAcceptedEvent( Guid storeOwnerId, Guid storeOwnerWalletId, Guid userId, Guid userWalletId, decimal amount, decimal storeAmount, decimal benevolenceAmount, StatisticInfo statisticInfo) { StoreOwnerId = storeOwnerId; StoreOwnerWalletId = storeOwnerWalletId; UserId = userId; UserWalletId = userWalletId; Amount = amount; StoreAmount = storeAmount; BenevolenceAmount = benevolenceAmount; Info = statisticInfo; }
public StatisticInfo GetStatisticsFromTestRun(TfsTeamProjectCollection tpc, string selectedProject, int testRunId) { var tms = tpc.GetService <ITestManagementService>(); var testRun = tms.GetTeamProject(selectedProject).TestRuns.Find(testRunId); testRun.Refresh(); testRun.RefreshLogEntries(); var statistics = testRun.Statistics; var instance = new StatisticInfo { TotalTests = statistics.TotalTests, CompletedTests = statistics.CompletedTests, PassedTests = statistics.PassedTests, FailedTests = statistics.FailedTests, InProgressTests = statistics.InProgressTests, PendingTests = statistics.PendingTests, }; return(instance); }
private void RecordStatisticsInfo(Models.ProductInfo lastInfo, int currInfoId, ProductInfo outInfo, Machines machine, int finishCount, DbTableDbContext db) { Schedules tempSchedule = db.Schedules.First(item => item.Number == outInfo.ScheduleNumber); StatisticInfo statistics = new StatisticInfo() { ProductIdStart = lastInfo.ID, DateStart = lastInfo.DateCreate, ProductIdOut = currInfoId, DateOut = DateTime.Now, ExceptionCount = outInfo.UnusualCount, FinishCount = finishCount, MachineId = machine.ID, MachineName = machine.Name, OrderNumber = tempSchedule.OrderNumber, ScheduleID = tempSchedule.ID, ScheduleNumber = tempSchedule.Number, StaffName = outInfo.StaffName, StaffNumber = outInfo.StaffNumber, RoomID = machine.RoomID, RoomName = machine.RoomName, Factory = "振德敷料" }; db.Statistics.Add(statistics); //施工单生产记录 db.Schedules.Attach(tempSchedule); tempSchedule.FinishCount += finishCount; tempSchedule.Status = tempSchedule.FinishCount >= tempSchedule.ProductCount ? enumStatus.Finished : enumStatus.Working; //订单生产记录 Orders tempOrder = db.Orders.Find(tempSchedule.OrderId); db.Orders.Attach(tempOrder); tempOrder.ProductFinishedCount += finishCount; tempOrder.Status = tempOrder.ProductFinishedCount >= tempOrder.ProductCount ? enumStatus.Finished : enumStatus.Working; db.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { User user = new User(); user = (User)Session["user"]; string channelname = ""; int ChannelType = Convert.ToInt32(Request.QueryString["ddlChannel"]); switch (ChannelType) { case 1: channelname = user.TelecomNumber; break; case 2: channelname = user.CMNumber; break; case 3: channelname = user.UnicomNumber; break; } string submitid = Request.QueryString["submitid"]; string dstnumber = Request.QueryString["DstNumber"]; string srcnumber = Request.QueryString["SrcNumber"]; StatisticInfo s = new StatisticInfo(); var report = s.GetSMSReport(submitid, dstnumber, ChannelType, channelname); lblContent.Text = Request.QueryString["content"]; lblDstNumber.Text = dstnumber; lblSrcNumber.Text = srcnumber; if (report != null&&report.MsgID!=null) { lblstatus.Text = report.Status; lbltime.Text = report.RecvTime.ToString(); lblMsgID.Text = report.MsgID; } } }
/// <summary> /// Downloads a message. /// </summary> /// <param name="mailbox">The mailbox.</param> /// <param name="statisticInfo">The statistic info.</param> /// <param name="response">The response.</param> /// <param name="message">The message.</param> /// <returns>The response type.</returns> protected override CommandResponseType DownloadMessageCommand(Mailbox mailbox, StatisticInfo statisticInfo, out string response, out StructuredMessage message) { try { message = _client.GetFullMessage(uint.Parse(statisticInfo.UniqueNumber), mailbox); response = string.Empty; return(CommandResponseType.Ok); } catch (Exception ex) { LoginCommand(out response); message = null; response = ex.ToString(); return(CommandResponseType.Bad); } }
//private bool CreateStatisticTable(StatisticInfo[] infos, int statisticTypeIndex, object[] statistic) //{ // string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map }; // TableHeaderRow headerRow = new TableHeaderRow(); // TableHeaderCell headerCell = new TableHeaderCell(); // headerCell.Text = StatisticTypeNames[statisticTypeIndex]; // headerRow.Cells.Add(headerCell); // headerCell = new TableHeaderCell(); // headerCell.Text = StringDef.Count; // headerRow.Cells.Add(headerCell); // TableStatistic.Rows.Add(headerRow); // for (int i = 0; i < infos.Length; i++) // { // StatisticInfo info = infos[i]; // TableRow row = new TableRow(); // TableCell cell = new TableCell(); // for (int j = 0; j < statistic.Length; j++) // { // if (statistic[j].Id == info.Type) // { // cell.Text = statistic[j].Name; // row.Cells.Add(cell); // break; // } // } // cell = new TableCell(); // cell.Text = info.Count.ToString(); // row.Cells.Add(cell); // TableStatistic.Rows.Add(row); // } // return true; //} protected void ZedGraphWebStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane) { if (_server != null) { GraphPane graphPane = masterPane[0]; string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map }; string staticType = StatisticTypes[_statisticType]; string staticTypeName = StatisticTypeNames[_statisticType]; SqlCommand cmd = new SqlCommand("SELECT " + staticType + ",COUNT(*) FROM rolesfirst " + _whereStatement + " GROUP BY " + staticType); if (!_server.IsConnected) { //LabelMessage.Visible = true; //LabelMessage.Text = StringDef.NoConnectionAlert; return; } SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, _server, cmd); if (result != null && result.Success) { //整理数据 SqlDataType[] dataTypes = new SqlDataType[] { SqlDataType.Int32, SqlDataType.Int32 }; result.SetFieldType(dataTypes); object[] statistic = null; switch (_statisticType) { case 0: { statistic = new object[FS2GameDataManager.MaxLevel]; for (int level = 1; level <= FS2GameDataManager.MaxLevel; level++) { statistic[level - 1] = level; } } break; case 1: { statistic = new object[FS2GameDataManager.RoleClasses.Length]; for (int i = 0; i < FS2GameDataManager.RoleClasses.Length; i++) { statistic[i] = FS2GameDataManager.RoleClasses[i]; } } break; case 2: { statistic = new object[FS2GameDataManager.RoleSexes.Length]; for (int i = 0; i < FS2GameDataManager.RoleSexes.Length; i++) { statistic[i] = FS2GameDataManager.RoleSexes[i]; } } break; case 3: statistic = new object[] { 0, 1, 2, 3, 4 }; break; } StatisticInfo[] infos = new StatisticInfo[statistic.Length]; for (int i = 0; i < infos.Length; i++) { infos[i] = new StatisticInfo(int.Parse(statistic[i].ToString()), 0); } object[] record = null; while ((record = result.ReadRecord()) != null) { int type = (int)record[0]; int count = (int)record[1]; for (int i = 0; i < infos.Length; i++) { if (infos[i].Type == type) { infos[i].Count = count; } } } ////构造数据表格 //bool success = CreateStatisticTable(infos, _statisticType, statistic); //if (success) //{ // TableStatistic.Visible = true; //} graphPane.Title.Text = staticTypeName; graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor); graphPane.Legend.IsVisible = false; string[] textLabels = new string[statistic.Length]; for (int i = 0; i < statistic.Length; i++) { textLabels[i] = statistic[i].ToString(); } graphPane.XAxis.Title.Text = staticTypeName; graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor; if (_statisticType > 0) { graphPane.XAxis.MajorTic.IsBetweenLabels = true; graphPane.XAxis.Type = AxisType.Text; graphPane.XAxis.Scale.TextLabels = textLabels; } graphPane.YAxis.Title.Text = StringDef.Count; graphPane.YAxis.Scale.Min = 0; graphPane.YAxis.MajorGrid.IsVisible = true; graphPane.YAxis.MajorGrid.DashOff = 0; graphPane.YAxis.MajorGrid.Color = Color.Gray; graphPane.YAxis.MinorGrid.IsVisible = true; graphPane.YAxis.MinorGrid.Color = Color.LightGray; graphPane.YAxis.MinorGrid.DashOff = 0; if (_chartType == ChartType.Bar) { graphPane.BarSettings.Type = BarType.Stack; double[] counts = new double[infos.Length]; double[] types = new double[infos.Length]; for (int i = 0; i < infos.Length; i++) { StatisticInfo info = infos[i] as StatisticInfo; counts[i] = info.Count; types[i] = info.Type; //添加数值标签 string lab = info.Count.ToString(); TextObj text = new TextObj(lab, i + 1, (float)(info.Count));; text.Location.CoordinateFrame = CoordType.AxisXYScale; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; if (_statisticType == 0) { text.Location.AlignH = AlignH.Left; text.Location.AlignV = AlignV.Center; text.FontSpec.Angle = 90f; } else { text.Location.AlignH = AlignH.Center; text.Location.AlignV = AlignV.Bottom; } graphPane.GraphObjList.Add(text); } //绘制柱子 BarItem barItem = graphPane.AddBar(StringDef.Count, types, counts, WebConfig.GraphColors[0]); barItem.Bar.Fill = new Fill(WebConfig.GraphColors[0]); } else if (_chartType == ChartType.Line) { double[] counts = new double[infos.Length]; double[] types = new double[infos.Length]; for (int i = 0; i < infos.Length; i++) { StatisticInfo info = infos[i] as StatisticInfo; counts[i] = info.Count; types[i] = info.Type; //添加数值标签 string lab = info.Count.ToString(); TextObj text = new TextObj(lab, i + 1, (float)(info.Count));; text.Location.CoordinateFrame = CoordType.AxisXYScale; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; if (_statisticType == 0) { text.Location.AlignH = AlignH.Left; text.Location.AlignV = AlignV.Center; text.FontSpec.Angle = 90f; } else { text.Location.AlignH = AlignH.Center; text.Location.AlignV = AlignV.Bottom; } graphPane.GraphObjList.Add(text); } //绘制线条 LineItem lineItem = graphPane.AddCurve("xxx", types, counts, WebConfig.GraphColors[1], SymbolType.None); } graphPane.AxisChange(g); } } }
public async Task <IEnumerable <CountryStatistic> > GetStatisticsAsync(bool forceRefresh = false) { //var statistics = await dataProvider.GetStatisticAsync(CancellationToken.None); try { var list = new List <CountryStatistic>(); var statistic = await context.Statistics .AsNoTracking() .Include(statistics => statistics.Country) .ThenInclude(country => country.CountryName) .Where(statistics => false == statistics.Country.DoNotShow) .OrderBy(statistics => statistics.Id) .ToArrayAsync(); foreach (var item in statistic) { /*var lastConfirmed = 0UL; * var data = await context.Statistics * .Where(row => row.CountryCode == item.CountryInfo.Code && row.Province == item.CountryInfo.Province) * .FirstOrDefaultAsync(CancellationToken.None); * * if (data != null) * { * lastConfirmed = data.Confirmed; * * if (data.Confirmed != item.Confirmed) * { * data.Confirmed = item.Confirmed; * context.Statistics.Update(data); * } * } * else * { * lastConfirmed = item.Confirmed; * data = new StatisticItem * { * CountryCode = item.CountryInfo.Code, * Province = item.CountryInfo.Province, * Confirmed = item.Confirmed * }; * await context.Statistics.AddAsync(data, CancellationToken.None); * } * * await context.SaveChangesAsync(CancellationToken.None);*/ var country = new CountryInfo(item.Country.Code, item.Country.Province, item.Country.CountryName.EnglishName); var last = new StatisticInfo(item.Confirmed, item.Deaths, item.Recovered, item.LastUpdated); var latest = new StatisticInfo(0UL, 0UL, 0UL, DateTimeOffset.UtcNow); list.Add(new CountryStatistic(item.Id, country, latest, last)); } return(list.AsEnumerable()); } catch (Exception exception) { Debug.WriteLine(exception); } return(Array.Empty <CountryStatistic>()); }
public UserInfo() { UserStatistic = new StatisticInfo(); }
private void Bind(int pageno) { DateTime StratDate = DateTime.Now; DateTime EndDate = DateTime.Now; try { StratDate = Convert.ToDateTime(txtStartDate.Text); EndDate = Convert.ToDateTime(txtEndDate.Text); } catch { lblMessage.Text = "日期时间格式有误"; SMSGridView.DataSource = null; SMSGridView.DataBind(); return; } User user = new User(); user = (User)Session["user"]; StatisticInfo sa = new StatisticInfo(); string channelname = ""; switch (Convert.ToInt32(ddlChannel.SelectedValue)) { case 1: channelname = user.TelecomNumber; break; case 2: channelname = user.CMNumber; break; case 3: channelname = user.UnicomNumber; break; } if (channelname == null || channelname == "") { lblMessage.Text = "通道号码为空"; return; } var totalCount = sa.GetMoTotalCount(StratDate, EndDate, Convert.ToInt32(ddlChannel.SelectedValue), channelname, user, txtTelPhone.Text); this.lblTotalCount.Text = totalCount.ToString(); lblTotalNumber.Text = Convert.ToInt32(totalCount) % pagesize == 0 ? (Convert.ToInt32(totalCount) / pagesize).ToString() : (Convert.ToInt32(totalCount) / pagesize + 1).ToString(); if (totalCount == 0) { lblMessage.Text = "无记录"; SMSGridView.DataSource = null; SMSGridView.DataBind(); return; } else { lblMessage.Text = ""; } if (!(pageno > 0 && pageno <= Convert.ToInt32(lblTotalNumber.Text))) { return; } if (Convert.ToInt32(lblTotalNumber.Text) <= pageno) { ImgPageNext.Enabled = false; ImgPageLast.Enabled = false; } else { ImgPageNext.Enabled = true; ImgPageLast.Enabled = true; } if (pageno <= 1) { ImgPageUp.Enabled = false; ImgPageHome.Enabled = false; } else { ImgPageUp.Enabled = true; ImgPageHome.Enabled = true; } this.lblNumber.Text = pageno.ToString(); var data = sa.GetSMSMoDetail(StratDate, EndDate, Convert.ToInt32(ddlChannel.SelectedValue), channelname, pageno, pagesize, user, this.txtTelPhone.Text); this.SMSGridView.DataSource = data; this.SMSGridView.DataBind(); }
protected void btnImport_Click(object sender, EventArgs e) { if (fileUp.HasFile == false)//HasFile用来检查FileUpload是否有指定文件 { JScript.Alert("请您选择Excel文件"); return; } string IsXls = System.IO.Path.GetExtension(fileUp.FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls") { JScript.Alert("只可以选择Excel文件"); return; } //获取Execle文件名 DateTime日期函数 string filename = fileUp.FileName; //Server.MapPath 获得虚拟服务器相对路径 string savePath = Server.MapPath(("upfiles\\") + filename); //SaveAs 将上传的文件内容保存在服务器上 fileUp.SaveAs(savePath); //连接Excel 读取Excel数据 并返回DataSet数据集合 DataSet ds = GridViewExportUtil.ExcelSqlConnection(savePath, filename, "电力生产"); //定义一个DataRow数组 DataRow[] dr = ds.Tables[0].Select(); int rowsnum = ds.Tables[0].Rows.Count; if (rowsnum == 0) { JScript.Alert("Excel表为空表,无数据!"); } else { List <StatisticInfo> infoList = new List <StatisticInfo>(); try { //前面除了你需要在建立一个“upfiles”的文件夹外,其他的都不用管了,你只需要通过下面的方式获取Excel的值,然后再将这些值用你的方式去插入到数据库里面 StatisticInfo info = new StatisticInfo(); //设备容量 info.T_INDICATORNAME = "设备容量"; info.T_UNITNAME = dr[6][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[6][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[6][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[6][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[6][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[6][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[6][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[6][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[6][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[6][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[6][11].ToString()); infoList.Add(info); //利用小时 info = new StatisticInfo(); info.T_INDICATORNAME = "利用小时"; info.T_UNITNAME = dr[23][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[23][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[23][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[23][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[23][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[23][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[23][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[23][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[23][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[23][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[23][11].ToString()); infoList.Add(info); //供电煤耗 info = new StatisticInfo(); info.T_INDICATORNAME = "供电煤耗"; info.T_UNITNAME = dr[32][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[32][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[32][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[32][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[32][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[32][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[32][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[32][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[32][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[32][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[32][11].ToString()); infoList.Add(info); //厂用电率 info = new StatisticInfo(); info.T_INDICATORNAME = "厂用电率"; info.T_UNITNAME = dr[40][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[40][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[40][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[40][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[40][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[40][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[40][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[40][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[40][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[40][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[40][11].ToString()); infoList.Add(info); //供电煤耗1000MW info = new StatisticInfo(); info.T_INDICATORNAME = "1000MW"; info.T_UNITNAME = dr[34][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[34][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[34][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[34][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[34][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[34][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[34][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[34][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[34][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[34][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[34][11].ToString()); infoList.Add(info); //供电煤耗600MW info = new StatisticInfo(); info.T_INDICATORNAME = "600MW"; info.T_UNITNAME = dr[35][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[35][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[35][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[35][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[35][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[35][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[35][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[35][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[35][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[35][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[35][11].ToString()); infoList.Add(info); //供电煤耗300MW info = new StatisticInfo(); info.T_INDICATORNAME = "300MW"; info.T_UNITNAME = dr[36][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[36][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[36][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[36][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[36][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[36][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[36][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[36][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[36][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[36][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[36][11].ToString()); infoList.Add(info); //供电煤耗200MW info = new StatisticInfo(); info.T_INDICATORNAME = "200MW"; info.T_UNITNAME = dr[37][1].ToString(); info.T_TIME = DateTime.Parse((dr[1][4].ToString() + "1日")).ToString().Replace('/', '-'); info.D_HNALL = Convert.ToDouble(dr[37][2].ToString()); info.D_HNADD = Convert.ToDouble(dr[37][3].ToString()); info.D_DTALL = Convert.ToDouble(dr[37][4].ToString()); info.D_DTADD = Convert.ToDouble(dr[37][5].ToString()); info.D_HDALL = Convert.ToDouble(dr[37][6].ToString()); info.D_HDADD = Convert.ToDouble(dr[37][7].ToString()); info.D_GDALL = Convert.ToDouble(dr[37][8].ToString()); info.D_GDADD = Convert.ToDouble(dr[37][9].ToString()); info.D_ZDTALL = Convert.ToDouble(dr[37][10].ToString()); info.D_ZDTADD = Convert.ToDouble(dr[37][11].ToString()); infoList.Add(info); } catch { JScript.Alert("Excle表格数据有误"); } try { if (bt.InsertHomeData(infoList, out errMsg)) { JScript.Alert("Excle表导入成功"); } else { JScript.Alert("Excle表导入失败"); } } catch { JScript.Alert("Excle表导入失败"); } } }
public OfflineStoreStatisticInfoChangedEvent(StatisticInfo info) { Info = info; }
//private bool CreateStatisticTable(StatisticInfo[] infos, int statisticTypeIndex, object[] statistic) //{ // string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map }; // TableHeaderRow headerRow = new TableHeaderRow(); // TableHeaderCell headerCell = new TableHeaderCell(); // headerCell.Text = StatisticTypeNames[statisticTypeIndex]; // headerRow.Cells.Add(headerCell); // headerCell = new TableHeaderCell(); // headerCell.Text = StringDef.Count; // headerRow.Cells.Add(headerCell); // TableStatistic.Rows.Add(headerRow); // for (int i = 0; i < infos.Length; i++) // { // StatisticInfo info = infos[i]; // TableRow row = new TableRow(); // TableCell cell = new TableCell(); // for (int j = 0; j < statistic.Length; j++) // { // if (statistic[j].Id == info.Type) // { // cell.Text = statistic[j].Name; // row.Cells.Add(cell); // break; // } // } // cell = new TableCell(); // cell.Text = info.Count.ToString(); // row.Cells.Add(cell); // TableStatistic.Rows.Add(row); // } // return true; //} protected void ZedGraphWebStatistic_RenderGraph(ZedGraph.Web.ZedGraphWeb webObject, Graphics g, MasterPane masterPane) { if (_server != null) { GraphPane graphPane = masterPane[0]; string[] StatisticTypeNames = new string[] { StringDef.Level, StringDef.RoleClass, StringDef.Sex, StringDef.Map }; string staticType = StatisticTypes[_statisticType]; string staticTypeName = StatisticTypeNames[_statisticType]; SqlCommand cmd = new SqlCommand("SELECT " + staticType + ",COUNT(*) FROM rolesfirst " + _whereStatement + " GROUP BY " + staticType); if (!_server.IsConnected) { //LabelMessage.Visible = true; //LabelMessage.Text = StringDef.NoConnectionAlert; return; } SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id,_server, cmd); if (result != null && result.Success) { //整理数据 SqlDataType[] dataTypes = new SqlDataType[] { SqlDataType.Int32, SqlDataType.Int32 }; result.SetFieldType(dataTypes); object[] statistic = null; switch (_statisticType) { case 0: { statistic = new object[FS2GameDataManager.MaxLevel]; for (int level = 1; level <= FS2GameDataManager.MaxLevel; level++) { statistic[level - 1] = level; } } break; case 1: { statistic = new object[FS2GameDataManager.RoleClasses.Length]; for (int i = 0; i < FS2GameDataManager.RoleClasses.Length; i++) { statistic[i] = FS2GameDataManager.RoleClasses[i]; } } break; case 2: { statistic = new object[FS2GameDataManager.RoleSexes.Length]; for (int i = 0; i < FS2GameDataManager.RoleSexes.Length; i++) { statistic[i] = FS2GameDataManager.RoleSexes[i]; } } break; case 3: statistic = new object[] { 0, 1, 2, 3, 4 }; break; } StatisticInfo[] infos = new StatisticInfo[statistic.Length]; for (int i = 0; i < infos.Length; i++) { infos[i] = new StatisticInfo(int.Parse(statistic[i].ToString()), 0); } object[] record = null; while ((record = result.ReadRecord()) != null) { int type = (int)record[0]; int count = (int)record[1]; for (int i = 0; i < infos.Length; i++) { if (infos[i].Type == type) { infos[i].Count = count; } } } ////构造数据表格 //bool success = CreateStatisticTable(infos, _statisticType, statistic); //if (success) //{ // TableStatistic.Visible = true; //} graphPane.Title.Text = staticTypeName; graphPane.Fill = new Fill(WebConfig.GraphPaneBgColor); graphPane.Legend.IsVisible = false; string[] textLabels = new string[statistic.Length]; for (int i = 0; i < statistic.Length; i++) { textLabels[i] = statistic[i].ToString(); } graphPane.XAxis.Title.Text = staticTypeName; graphPane.XAxis.MajorGrid.Color = WebConfig.GraphXAxisGridColor; if (_statisticType > 0) { graphPane.XAxis.MajorTic.IsBetweenLabels = true; graphPane.XAxis.Type = AxisType.Text; graphPane.XAxis.Scale.TextLabels = textLabels; } graphPane.YAxis.Title.Text = StringDef.Count; graphPane.YAxis.Scale.Min = 0; graphPane.YAxis.MajorGrid.IsVisible = true; graphPane.YAxis.MajorGrid.DashOff = 0; graphPane.YAxis.MajorGrid.Color = Color.Gray; graphPane.YAxis.MinorGrid.IsVisible = true; graphPane.YAxis.MinorGrid.Color = Color.LightGray; graphPane.YAxis.MinorGrid.DashOff = 0; if (_chartType == ChartType.Bar) { graphPane.BarSettings.Type = BarType.Stack; double[] counts = new double[infos.Length]; double[] types = new double[infos.Length]; for (int i = 0; i < infos.Length; i++) { StatisticInfo info = infos[i] as StatisticInfo; counts[i] = info.Count; types[i] = info.Type; //添加数值标签 string lab = info.Count.ToString(); TextObj text = new TextObj(lab, i + 1, (float)(info.Count)); ; text.Location.CoordinateFrame = CoordType.AxisXYScale; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; if (_statisticType == 0) { text.Location.AlignH = AlignH.Left; text.Location.AlignV = AlignV.Center; text.FontSpec.Angle = 90f; } else { text.Location.AlignH = AlignH.Center; text.Location.AlignV = AlignV.Bottom; } graphPane.GraphObjList.Add(text); } //绘制柱子 BarItem barItem = graphPane.AddBar(StringDef.Count, types, counts, WebConfig.GraphColors[0]); barItem.Bar.Fill = new Fill(WebConfig.GraphColors[0]); } else if (_chartType == ChartType.Line) { double[] counts = new double[infos.Length]; double[] types = new double[infos.Length]; for (int i = 0; i < infos.Length; i++) { StatisticInfo info = infos[i] as StatisticInfo; counts[i] = info.Count; types[i] = info.Type; //添加数值标签 string lab = info.Count.ToString(); TextObj text = new TextObj(lab, i + 1, (float)(info.Count)); ; text.Location.CoordinateFrame = CoordType.AxisXYScale; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; if (_statisticType == 0) { text.Location.AlignH = AlignH.Left; text.Location.AlignV = AlignV.Center; text.FontSpec.Angle = 90f; } else { text.Location.AlignH = AlignH.Center; text.Location.AlignV = AlignV.Bottom; } graphPane.GraphObjList.Add(text); } //绘制线条 LineItem lineItem = graphPane.AddCurve("xxx", types, counts, WebConfig.GraphColors[1], SymbolType.None); } graphPane.AxisChange(g); } } }
/// <summary> /// Downloads a message. /// </summary> /// <param name="mailbox">The mailbox.</param> /// <param name="statisticInfo">The statistic info.</param> /// <param name="response">The response.</param> /// <param name="message">The message.</param> /// <returns>The response type.</returns> protected override CommandResponseType DownloadMessageCommand(Mailbox mailbox, StatisticInfo statisticInfo, out string response, out StructuredMessage message) { try { message = _client.GetMessage(statisticInfo.SerialNumber, statisticInfo.UniqueNumber); if (!AccountSettingsData.KeepEmailCopiesOnServer) { _client.DeleteMessage(statisticInfo.SerialNumber); } response = string.Empty; return(CommandResponseType.Ok); } catch (Exception ex) { Login(); message = null; response = ex.ToString(); return(CommandResponseType.Bad); } }
static void Main(string[] args) { string appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DevExpress.Xpo.ConsoleCoreDemo"); if (!Directory.Exists(appDataPath)) { Directory.CreateDirectory(appDataPath); } // XPO data layer setup against a local SQLite database. Learn more at https://documentation.devexpress.com/CoreLibraries/2020/DevExpress-ORM-Tool/Feature-Center/Connecting-to-a-Data-Store. string connectionString = SQLiteConnectionProvider.GetConnectionString(Path.Combine(appDataPath, "myXpoApp.db")); XpoDefault.DataLayer = XpoDefault.GetDataLayer(connectionString, AutoCreateOption.DatabaseAndSchema); XpoDefault.Session = null; try { Console.WriteLine(); Console.WriteLine(" ***************************************************************************************************************|"); Console.WriteLine(" XPO console demo application 1.0"); Console.WriteLine(" Uses eXpressPersistent Objects (XPO) for .NET Standard 2.0 - Object-Relational Mapping for .NET Developers"); Console.WriteLine(" and Microsoft.Data.Sqlite 2.0 - ADO.NET provider for SQLite database"); Console.WriteLine(" ***************************************************************************************************************|"); while (true) { Console.WriteLine(); Console.WriteLine("- Enter some text to create a new record."); Console.WriteLine("- Say \"show\" to display stored records."); Console.WriteLine("- Say \"clear\" to delete all records."); Console.WriteLine("- Say \"xpo\" to learn more."); Console.WriteLine("- Say \"quit\" for exit."); Console.WriteLine(); Console.Write("XPO > "); string result = Console.ReadLine(); switch (result.ToLowerInvariant()) { case "show": Console.WriteLine(); Console.WriteLine("|-------------------- start --------------------|"); using (UnitOfWork uow = new UnitOfWork()) { var query = uow.Query <StatisticInfo>() .OrderBy(info => info.Date) .Select(info => $"[{info.Date}] {info.Info}"); foreach (var line in query) { Console.WriteLine(line); } } Console.WriteLine("|-------------------- end --------------------|"); Console.WriteLine(); break; case "clear": // Querying and deleting XPO objects. Learn more at https://documentation.devexpress.com/CoreLibraries/2026/DevExpress-ORM-Tool/Feature-Center/Data-Exchange-and-Manipulation/Deleting-Persistent-Objects. using (UnitOfWork uow = new UnitOfWork()) { var itemsToDelete = uow.Query <StatisticInfo>().ToList(); if (itemsToDelete.Count > 0) { var pluralEnding = itemsToDelete.Count > 1 ? "s" : ""; Console.Write($"Are you sure you want to delete {itemsToDelete.Count} record{pluralEnding} (y/N)?: "); if (Console.ReadLine().ToLowerInvariant() == "y") { uow.Delete(itemsToDelete); uow.CommitChanges(); Console.WriteLine($"Done."); } } else { Console.WriteLine("There are no records to delete."); } } break; case "exit": case "quit": return; case "xpo": { Console.WriteLine("Starting browser..."); } break; default: // Creating and saving a new XPO object. Learn more at https://documentation.devexpress.com/CoreLibraries/2023/DevExpress-ORM-Tool/Feature-Center/Data-Exchange-and-Manipulation. using (UnitOfWork uow = new UnitOfWork()) { StatisticInfo newInfo = new StatisticInfo(uow); newInfo.Info = result; newInfo.Date = DateTime.Now; uow.CommitChanges(); Console.WriteLine("Saved."); } break; } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.ReadKey(); } }
private void AddStats(IList <AnalysableInfo> stats, IMiddleware middleware, IList <IMiddleware> analysedMiddleware) { var analysable = middleware as IAnalysable; if (analysable != null) { var analysableInfo = new AnalysableInfo { Name = middleware.Name, Type = middleware.GetType().FullName, Statistics = new List <StatisticInfo>() }; if (string.IsNullOrEmpty(analysableInfo.Name)) { analysableInfo.Name = middleware.GetType().Name; } var selfDocumenting = middleware as ISelfDocumenting; if (selfDocumenting != null) { analysableInfo.Description = selfDocumenting.ShortDescription; analysableInfo.Links = new List <DocumentationLink>(); foreach (var documentTypeValue in Enum.GetValues(typeof(DocumentationTypes))) { var documentType = (DocumentationTypes)documentTypeValue; var url = selfDocumenting.GetDocumentation(documentType); if (url != null) { analysableInfo.Links.Add(new DocumentationLink { Name = documentType.ToString(), Url = url.ToString() }); } } } foreach (var availableStatistic in analysable.AvailableStatistics) { var statisticInfo = new StatisticInfo { Name = availableStatistic.Name, Description = availableStatistic.Description, Units = availableStatistic.Units, Statistic = analysable.GetStatistic(availableStatistic.Id) }; analysableInfo.Statistics.Add(statisticInfo); } if (analysableInfo.Statistics.Count > 0) { stats.Add(analysableInfo); } } var router = middleware as IRouter; if (router != null) { AddStats(stats, router, analysedMiddleware); } }