public void ConvertToLocal(UserInfo userInfo) { if (userInfo == null) { return; } ToDate = Util.ToLocalDateTime(ToDate, userInfo); if (FromDate != null) { FromDate = Util.ToLocalDateTime(FromDate.Value, userInfo); } ExportFileInfo?.ConvertToLocal(userInfo); if (SummaryItems == null) { return; } var tempSummaryItems = new SummaryList(); foreach (var summaryItem in SummaryItems) { summaryItem.ConvertToLocal(userInfo); tempSummaryItems.Add(summaryItem); } SummaryItems = tempSummaryItems; }
protected internal static void BuildJobSummary(string packageId, IExportImportRepository repository, ImportExportSummary summary) { var summaryItems = new SummaryList(); var implementors = Util.GetPortableImplementors(); var exportDto = repository.GetSingleItem <ExportDto>(); foreach (var implementor in implementors) { implementor.Repository = repository; summaryItems.Add(new SummaryItem { TotalItems = implementor.GetImportTotal(), Category = implementor.Category, Order = implementor.Priority, }); } summary.ExportFileInfo = GetExportFileInfo(Path.Combine(ExportFolder, packageId, Constants.ExportManifestName)); summary.FromDate = exportDto.FromDateUtc; summary.ToDate = exportDto.ToDateUtc; summary.SummaryItems = summaryItems; summary.IncludeDeletions = exportDto.IncludeDeletions; summary.IncludeContent = exportDto.IncludeContent; summary.IncludeExtensions = exportDto.IncludeExtensions; summary.IncludePermissions = exportDto.IncludePermissions; summary.IncludeProfileProperties = exportDto.IncludeProperfileProperties; summary.ExportMode = exportDto.ExportMode; }
private void CountriesGameModeSummary(List <Tuple <bool, Country, Country> > answers) { // Creates summary string from every answer foreach (var answer in answers) { if (answer.Item1 == true) { // Formats the string string summaryText = string.Format("For {0} you answered {1}, which was the correct answer.", answer.Item2.Name, answer.Item2.Capital); var summaryString = new SummaryString(summaryText, "Green"); SummaryList.Add(summaryString); } else if (answer.Item1 == false) { // Formats the string string summaryText = string.Format("For {0} you answered {1}. Correct answer is {2}.", answer.Item2.Name, answer.Item3.Capital, answer.Item2.Capital); var summaryString = new SummaryString(summaryText, "Red"); SummaryList.Add(summaryString); } } }
private void BindData() { String username = Session["UserName"].ToString(); Label1.Text = username; string connectionString = "Data Source=omisbi3.niunt.niu.edu;Initial Catalog = z1776252; Persist Security Info = True; User ID = z1776252; Password = Bw1243$h11"; using (SqlConnection con = new SqlConnection(connectionString)) { try { using (SqlCommand cmd = new SqlCommand("SELECT s.service,o.ord_id,o.address,o.order_date,o.order_time from orders_table o,services_table s where o.s_id=s.serviceid and o.session_id=@session", con)) { Debug.WriteLine("shopping cart inside using try"); cmd.Parameters.AddWithValue("@session", Session["sessionid"].ToString()); Debug.WriteLine("cart id in sc is:" + Session["sessionid"].ToString()); Debug.WriteLine("shopping cart before using"); using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { Debug.WriteLine("shopping cart inside 2nd using"); DataTable dt = new DataTable(); Debug.WriteLine("data table is:" + dt.Rows.Count); sda.Fill(dt); SummaryList.DataSource = dt; SummaryList.DataBind(); Session.Clear(); } } } catch (Exception ex) { // Display error message String errorMessage = ex.Message; } finally { // Close the connection con.Close(); } } }
protected static ImportExportSummary BuildJobSummary(int jobId) { var summaryItems = new SummaryList(); var controller = EntitiesController.Instance; var job = controller.GetJobById(jobId); var exportDto = job.JobType == JobType.Export ? JsonConvert.DeserializeObject <ExportDto>(job.JobObject) : JsonConvert.DeserializeObject <ImportDto>(job.JobObject).ExportDto; var importExportSummary = new ImportExportSummary { IncludeDeletions = exportDto.IncludeDeletions, IncludeExtensions = exportDto.IncludeExtensions, IncludePermissions = exportDto.IncludePermissions, IncludeProfileProperties = exportDto.IncludeProperfileProperties, IncludeContent = exportDto.IncludeContent, FromDate = exportDto.FromDateUtc, ToDate = exportDto.ToDateUtc, ExportMode = exportDto.ExportMode, ExportFileInfo = job.JobType == JobType.Export ? GetExportFileInfo(Path.Combine(ExportFolder, job.Directory, Constants.ExportManifestName)) : JsonConvert.DeserializeObject <ImportDto>(job.JobObject).ExportFileInfo, }; var checkpoints = EntitiesController.Instance.GetJobChekpoints(jobId); if (!checkpoints.Any()) { return(importExportSummary); } var implementors = Util.GetPortableImplementors(); summaryItems.AddRange(checkpoints.Select(checkpoint => new SummaryItem { TotalItems = checkpoint.TotalItems, ProcessedItems = checkpoint.ProcessedItems <= checkpoint.TotalItems ? checkpoint.ProcessedItems : checkpoint.TotalItems, ProgressPercentage = Convert.ToInt32(checkpoint.Progress), Category = checkpoint.Category, Order = implementors.FirstOrDefault(x => x.Category == checkpoint.Category)?.Priority ?? 0, Completed = checkpoint.Completed, })); importExportSummary.SummaryItems = summaryItems; return(importExportSummary); }
async void Update() { busy = true; DateTime firstDay = selectedDate.AddDays(-(int)selectedDate.DayOfWeek); SeriesCollection tmpChart = await GenerateChart(firstDay); List <SummaryListItem> tmpList = await generateList(firstDay); OverviewChartLables = generateChartLables(firstDay); AverageDailyTime = generateAverageDailyTime((ChartValues <double>)tmpChart[0].Values); SummaryChart = tmpChart; UpdateTime = LanguageHelper.InquireLocalizedWord("General_LastUpdate") + DateTime.Now.ToString("H:mm"); SummaryList.Clear(); foreach (SummaryListItem listItem in tmpList) { SummaryList.Add(listItem); MyDeviceHelper.DoEvents(); } busy = false; }
/// <summary> /// 添加表格数据 /// </summary> /// <param name="Type">天统计/月统计</param> public void AddDataTableData(string Type) { var Daytime = DateTime.Today.ToShortDateString(); // 获取当前天数 var nowday = DateTime.Now.Day.ToString(); // 获取当前年份 var nowyear = DateTime.Now.Year.ToString(); // 获取当前月份 var nowmonth = DateTime.Now.Month.ToString(); switch (Type) { case "Day": string sql = $"SELECT Time,Produce,Reach,TimeEfficiency,GoodProduct FROM DayDeviceData WHERE Day = '{DayDate}' AND DevID = {0}"; DataTable data = SQLiteHelp.ExecuteQuery(sql); if (data.Rows.Count > 0) { TableLength = data.Rows.Count; for (var i = 0; i < data.Rows.Count; i++) { double Produce = double.Parse(data.Rows[i][1].ToString()); double GoodProduct = double.Parse(data.Rows[i][4].ToString()); double GoodValue = 0; if (Produce == 0 && GoodProduct == 0) { GoodValue = 0; } else { GoodValue = GoodProduct / Produce; } if (Produce != 0) { DevNameList.Add(new TableData() { Time = $"{data.Rows[i][0]}:00", Efficiency = (double.Parse(data.Rows[i][2].ToString()) / 100).ToString("p0"), Good = (GoodValue).ToString("p0"), //Good = 1.ToString("p0"), TimeEfficiency = $"{data.Rows[i][3].ToString()}%" }); } } } break; case "Month": for (int i = 1; i < int.Parse(nowday) + 1; i++) { // 生成当前天数之前的日期 如果有日期没有数据,则添加图表数据为0 string nowtime = nowyear + "/" + nowmonth + "/" + i; // 查询数据库 string monthsql = $"SELECT Produce,TimeEfficiency,GoodProduct FROM MonthDeviceData WHERE Day = '{nowtime}' AND DevID = {0}"; DataTable Monthdata = SQLiteHelp.ExecuteQuery(monthsql); if (Monthdata.Rows.Count > 0) { double Produce = double.Parse(Monthdata.Rows[0][0].ToString()); double GoodProduct = double.Parse(Monthdata.Rows[0][2].ToString()); double GoodValue = 0; if (Produce == 0 && GoodProduct == 0) { GoodValue = 0; } else { GoodValue = GoodProduct / Produce; } if (Monthdata.Rows[0][1].ToString() != "") { DevNameList.Add(new TableData() { Time = $"{nowmonth}月{i}日", Efficiency = (double.Parse(Monthdata.Rows[0][0].ToString()) / MainWindow.DayPlan).ToString("p0"), Good = GoodValue.ToString("p0"), TimeEfficiency = $"{Monthdata.Rows[0][1].ToString()}%" }); } } //else //{ // DevNameList.Add(new TableData() // { // Time = $"{nowmonth}月{i}日", // Efficiency = 0.ToString("p0"), // //Good = data.Rows[i][3].ToString(), // Good = 0.ToString("p0"), // TimeEfficiency = $"{0}%" // }); //} } break; default: break; } string allsql = $"SELECT Produce,TimeEfficiency,GoodProduct FROM MonthDeviceData WHERE Day = '{Daytime}' AND DevID = {0}"; DataTable Alldata = SQLiteHelp.ExecuteQuery(allsql); if (Alldata.Rows.Count > 0) { double Produce = double.Parse(Alldata.Rows[0][0].ToString()); double GoodProduct = double.Parse(Alldata.Rows[0][2].ToString()); double TimeEfficiency = double.Parse(Alldata.Rows[0][1].ToString()); double GoodValue = 0; if (Produce == 0 && GoodProduct == 0) { GoodValue = 0; } else { GoodValue = GoodProduct / Produce; } SummaryList.Add(new Summary() { Title = "汇总", Efficiency = (Produce / MainWindow.DayPlan).ToString("p0"), Good = GoodValue.ToString("p0"), TimeEfficiency = $"{TimeEfficiency}%" }); } else { SummaryList.Add(new Summary() { Title = "汇总", Efficiency = (0).ToString("p0"), Good = 0.ToString("p0"), TimeEfficiency = "0%" }); } // 定时刷新表格页面 ChangeTableData(Type); }
public MainPage() { InitializeComponent(); SummaryList.SetModel(manager); NewTransaction.SetModel(manager); }
public ImportExportSummary() { SummaryItems = new SummaryList(); }
public void DisplaySummary() { SummaryList.DataSource = GetTablesFromSession()[TableList.SelectedIndex].Orders; SummaryList.DataBind(); }