protected void AutomaticLoadingData() { if (IsAutomatic) { foreach (UploadDataOption option in UploadDataOptions) { lock (LockObject) { option.Id = Id; option.OperatingRange = BeginDate.ToString("yyyy-MM-dd"); _dataService.GetData(option, (itemes, error) => { if (error != null) { return; } foreach (var item in itemes) { UploadEnities.Add(item); } }); Id = Id + 1; } } } }
public new void AsCsvRow(CsvWriter writer, bool bulk = true) { base.AsCsvRow(writer, bulk); writer.WriteField(IMSClassId); writer.WriteField(SchoolOrgId); writer.WriteField(UserId); writer.WriteField(Role); writer.WriteField(Primary == null ? Primary.ToString() : ""); writer.WriteField(BeginDate.ToString("yyyy-MM-dd")); writer.WriteField(EndDate.ToString("yyyy-MM-dd")); writer.NextRecord(); }
/// <summary> /// 输出日期间隔 /// </summary> /// <param name="inputString">输出格式化字符串</param> /// <param name="dateString">日期格式化字符串</param> /// <returns>日期间隔</returns> public string GetDateString(string inputString, string dateString) { if (string.IsNullOrEmpty(inputString) || string.IsNullOrEmpty(dateString)) { return(null); } try { return(string.Format(inputString, BeginDate.ToString(dateString), EndDate.ToString(dateString))); } catch (Exception ex) { return(ex.Message); } }
public void OpenExcel() { DownloadEnabled = false; DownloadContent = "Loading..."; var foodDictionary = new Dictionary <Food, List <float> >(); var builder = new FilterDefinitionBuilder <BsonDocument>(); var filter = builder.Gte("_submission_time", BeginDate.ToString("o")) & builder.Lte("_submission_time", EndDate.ToString("o")); var jsonQuery = filter.RenderToBsonDocument().ToJson(); FormData data = api.GetData(SelectedForm.Formid, jsonQuery); if (data.Lines.Count() == 0) { MessageBox.Show("No data available"); DownloadEnabled = true; DownloadContent = "Download Nutval"; return; } foreach (FormLine line in data.Lines) { if (!foodDictionary.ContainsKey(line.Food)) { foodDictionary.Add(line.Food, new List <float>()); foodDictionary[line.Food].Add(0); } foodDictionary[line.Food][0] += line.PeopleNbr; foodDictionary[line.Food].Add(line.Amount); } List <FoodAmount> foodList = new List <FoodAmount>(); foreach (KeyValuePair <Food, List <float> > line in foodDictionary) { foodList.Add(new FoodAmount(line.Key, (line.Value.Sum() - line.Value.First()) / line.Value.First())); } Excel excel = new Excel("NutVal.xlsm"); excel.WriteData(foodList, SelectedForm.Title); excel.ReleaseObjects(); DownloadEnabled = true; DownloadContent = "Download Nutval"; }
public void Filter() { try { _selectRoad = new DataRoad { SelectbeginDate = BeginDate.ToString(), SelectendDate = EndDate.ToString() }; var startstop = new ReadStartStop(_selectRoad.SelectbeginDate, _selectRoad.SelectendDate); _startStops = startstop.GetMassurm3(); Get(); } catch (Exception) { MessageBox.Show(@"Выберите дату", @"Ошибка выбора даты", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
/// <summary> /// Updates module settings. /// </summary> public void Update() { var controller = new ModuleController(); { controller.UpdateModuleSetting(_moduleId, "PortalId", PortalId.ToString()); string showPaging = ShowPaging.ToString(); { controller.UpdateModuleSetting(_moduleId, "ShowPaging", showPaging); } if (!String.IsNullOrEmpty(TemplateDirectory)) { controller.UpdateModuleSetting(_moduleId, "TemplateDirectory", TemplateDirectory.ToString()); } string pageSize = PageSize.ToString(); { controller.UpdateModuleSetting(_moduleId, "PageSize", pageSize); } string showDateFilter = ShowDateFilter.ToString(); { controller.UpdateModuleSetting(_moduleId, "ShowDateFilter", showDateFilter); } string learnerModuleId = LearnerModuleId.ToString(); { controller.UpdateModuleSetting(_moduleId, "LearnerModuleId", learnerModuleId); } string beginDate = BeginDate.ToString(); { controller.UpdateModuleSetting(_moduleId, "BeginDate", beginDate); } string endDate = EndDate.ToString(); { controller.UpdateModuleSetting(_moduleId, "EndDate", endDate); } string dateRange = DateRange; { controller.UpdateModuleSetting(_moduleId, "DateRange", dateRange); } } }
public new void AsJson(JsonWriter writer, string baseUrl) { writer.WriteStartObject(); base.AsJson(writer, baseUrl); if (User != null) { writer.WritePropertyName("user"); User.AsJsonReference(writer, baseUrl); } if (IMSClass != null) { writer.WritePropertyName("class"); IMSClass.AsJsonReference(writer, baseUrl); } if (School != null) { writer.WritePropertyName("school"); School.AsJsonReference(writer, baseUrl); } writer.WritePropertyName("role"); writer.WriteValue(Enum.GetName(typeof(RoleType), Role)); if (Primary != null) { writer.WritePropertyName("primary"); writer.WriteValue(Primary.ToString()); } if (BeginDate != null) { writer.WritePropertyName("beginDate"); writer.WriteValue(BeginDate.ToString("yyyy-MM-dd")); } if (EndDate != null) { writer.WritePropertyName("endDate"); writer.WriteValue(EndDate.ToString("yyyy-MM-dd")); } writer.WriteEndObject(); writer.Flush(); }
public override string ToString() { string str = ""; str += "&idserver=\"" + IDServer.ToString() + "\""; if (IDUser != -1) { str += "&iduser=\"" + IDUser.ToString() + "\""; } if (BeginDate != null) { str += "&begindate=\"" + BeginDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (EndDate != null) { str += "&enddate=\"" + EndDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (Price != 0) { str += "&price=\"" + Price.ToString() + "\""; } if (IsActive != 0) { str += "&isactive=\"" + IsActive.ToString() + "\""; } if (Trncode != null && !Trncode.Equals("")) { str += "&trncode=\"" + Trncode + "\""; } if (Deleted != 0) { str += "&deleted=\"" + Deleted.ToString() + "\""; } if (InsertDate != null) { str += "&insertdate=\"" + InsertDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } if (UpdateDate != null) { str += "&updatedate=\"" + UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "\""; } return(str.Substring(1)); }
private void buttonAddOrder_Click(object sender, EventArgs e) { //string drivID, string route, string from, string to, string dep, string arr, string cap, string vol if (ProperValues()) { string drID = Driver.DriverID.ToString(); string route = textBoxRouteLength.Text; string from = textBoxRouteFrom.Text; string to = textBoxRouteTo.Text; string format = "yyyy-MM-dd HH:mm:ss"; string dep = EndDate.ToString(format); string arr = BeginDate.ToString(format); string cap = labelFreeCValue.Text; string vol = labelFreeVValue.Text; if (CreateOrder(drID, route, from, to, dep, arr, cap, vol, addedProducts)) { dateTimePickerBegin.Value = DateTime.Now; dateTimePickerEnd.Value = DateTime.Now; labelDriverIDValue.Text = "0"; labelDriverNameValue.Text = ""; labelDriverSurnameValue.Text = ""; labelCapacityValue.Text = "-"; labelVolumeValue.Text = "-"; textBoxRouteFrom.Clear(); textBoxRouteTo.Clear(); textBoxRouteLength.Clear(); comboBoxDrivers.Items.Clear(); comboBoxProducts.Items.Clear(); labelFreeCValue.Text = "-"; labelFreeVValue.Text = "-"; listBoxProducts.Items.Clear(); MessageBox.Show("Dodano rekord!"); } } }
public override string ToString() { return(BeginDate.ToString() + " - " + EndDate.ToString()); }
/// <summary> /// 输出第几周和日期间隔 /// <para>默认格式:</para> /// <para>第几周,从2012年12月21日至2112年12月21日。</para> /// </summary> /// <returns>第几周和日期间隔</returns> public override string ToString() { return(string.Format("第{0}周,从{1}至{2}。", Number, BeginDate.ToString("yyyy年MM月dd日"), EndDate.ToString("yyyy年MM月dd日"))); }
string GetChartXMLFile(string unit) { string filename = "chart_" + unit + "_" + BeginDate.ToString("yyyyMMdd") + "_" + EndDate.ToString("yyyyMMdd") + ".xml"; string path = Server.MapPath("~/_temp/chart"); string fileUrl = ""; if (File.Exists(Path.Combine(path, filename))) { fileUrl = "/_temp/chart/" + filename; } else { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string strHead = @"<graph xaxisname=""{0}"" yaxisname=""访问量"" hovercapbg=""DEDEBE"" hovercapborder=""889E6D"" baseFontSize='12' rotateNames=""0"" numdivlines=""9"" divLineColor=""CCCCCC"" divLineAlpha=""80"" decimalPrecision=""0"" showAlternateHGridColor=""1"" AlternateHGridAlpha=""30"" AlternateHGridColor=""CCCCCC"" bgcolor='fbfbfb' caption=""{1}"" subcaption=""{2}"">"; switch (unit) { case "hour": using (FileStream fs = File.Open(Path.Combine(path, filename), FileMode.CreateNew, FileAccess.Write)) { using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8)) { sw.WriteLine(string.Format(strHead, "小时", BeginDate.ToString("yyyy-MM-dd") + " 24小时流量图", "")); sw.WriteLine("<categories font=\"Arial\" fontSize=\"12\" fontColor=\"000000\">"); for (int i = 0; i <= 24; i++) { sw.WriteLine(string.Format("<category name=\"{0}\" hoverText=\"{0}点\"/>", i)); } sw.WriteLine("</categories>"); sw.WriteLine("<dataset seriesname=\"访客数\" color=\"FDC12E\">"); for (int i = 0; i <= 24; i++) { DateTime startTime = BeginDate.AddDays(-1).AddHours(i); DateTime endTime = startTime.AddHours(1); sw.WriteLine(string.Format("<set value=\"{0}\"/>", PageVisitorHelper.GetPVCountByTime(startTime, endTime))); } sw.WriteLine("</dataset>"); sw.WriteLine("<dataset seriesname=\"访客数\" color=\"56B9F9\">"); for (int i = 0; i <= 24; i++) { DateTime startTime = BeginDate.AddDays(-1).AddHours(i); DateTime endTime = startTime.AddHours(1); sw.WriteLine(string.Format("<set value=\"{0}\"/>", PageVisitorHelper.GetVisitorCountByTime(startTime, endTime))); } sw.WriteLine("</dataset>"); sw.WriteLine("</graph>"); sw.Flush(); } } fileUrl = "/_temp/chart/" + filename; break; case "day": using (FileStream fs = File.Open(Path.Combine(path, filename), FileMode.CreateNew, FileAccess.Write)) { using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8)) { sw.WriteLine(string.Format(strHead, "天", "流量曲线图", BeginDate.ToString("yyyy-MM-dd") + " 到 " + EndDate.ToString("yyyy-MM-dd"))); sw.WriteLine("<categories font=\"Arial\" fontSize=\"11\" fontColor=\"000000\">"); TimeSpan ts = EndDate - BeginDate; int days = ts.Days; for (int i = 0; i <= days; i++) { sw.WriteLine(string.Format("<category name=\"{0}\" />", BeginDate.AddDays(i).Day)); } sw.WriteLine("</categories>"); sw.WriteLine("<dataset seriesname=\"访客数\" color=\"FDC12E\">"); for (int i = 0; i <= days; i++) { DateTime startTime = BeginDate.AddDays(i); DateTime endTime = startTime.AddDays(1); sw.WriteLine(string.Format("<set value=\"{0}\"/>", PageVisitorHelper.GetPVCountByTime(startTime, endTime))); } sw.WriteLine("</dataset>"); sw.WriteLine("<dataset seriesname=\"访客数\" color=\"56B9F9\">"); for (int i = 0; i <= days; i++) { DateTime startTime = BeginDate.AddDays(i); DateTime endTime = startTime.AddDays(1); sw.WriteLine(string.Format("<set value=\"{0}\"/>", PageVisitorHelper.GetVisitorCountByTime(startTime, endTime))); } sw.WriteLine("</dataset>"); sw.WriteLine("</graph>"); sw.Flush(); } } fileUrl = "/_temp/chart/" + filename; break; case "month": using (FileStream fs = File.Open(Path.Combine(path, filename), FileMode.CreateNew, FileAccess.Write)) { using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8)) { sw.WriteLine(string.Format(strHead, "月", "流量曲线图", BeginDate.ToString("yyyy-MM") + " 到 " + EndDate.ToString("yyyy-MM"))); sw.WriteLine("<categories font=\"Arial\" fontSize=\"11\" fontColor=\"000000\">"); TimeSpan ts = EndDate - BeginDate; int months = (int)(ts.TotalDays / 30); for (int i = 0; i <= months; i++) { sw.WriteLine(string.Format("<category name=\"{0}\" hoverText=\"{0}月\"/>", BeginDate.AddMonths(i).Month)); } sw.WriteLine("</categories>"); sw.WriteLine("<dataset seriesname=\"访客数\" color=\"FDC12E\">"); for (int i = 0; i <= months; i++) { DateTime startTime = BeginDate.AddMonths(i); DateTime endTime = startTime.AddMonths(1); sw.WriteLine(string.Format("<set value=\"{0}\"/>", PageVisitorHelper.GetPVCountByTime(startTime, endTime))); } sw.WriteLine("</dataset>"); sw.WriteLine("<dataset seriesname=\"访客数\" color=\"56B9F9\">"); for (int i = 0; i <= months; i++) { DateTime startTime = BeginDate.AddMonths(i); DateTime endTime = startTime.AddMonths(1); sw.WriteLine(string.Format("<set value=\"{0}\"/>", PageVisitorHelper.GetVisitorCountByTime(startTime, endTime))); } sw.WriteLine("</dataset>"); sw.WriteLine("</graph>"); sw.Flush(); } } fileUrl = "/_temp/chart/" + filename; break; } } return(fileUrl); }
public void AddNewTaskComman() { CurrentNum = CurrentNum + 1; DataCell dataCell = new DataCell() { Id = this.CurrentNum, Name = "用户基本资料", Total = new Random().Next(1000, 10000), UploadedTotal = 0, BusinessDate = BeginDate.ToString("yyyy-MM-dd"), Complated = false }; BeginDate = BeginDate.AddDays(1); lock (lockobject) { this.DataCells.Add(dataCell); } }
public void Print() { try { String pdfTemp = CoreUtils.GetSetting(CoreEnums.Settings.Standalone_Signin_FormsDir).ToString() + "Blank_Timesheet.pdf"; String newFile = CoreUtils.GetSetting(CoreEnums.Settings.Standalone_Signin_OutputDir).ToString() + "Timesheet-" + BeginDate.ToString("MM-dd-yyyy") + "-" + EndDate.ToString("MM-dd-yyyy") + ".pdf"; pdfReader = new PdfReader(pdfTemp); pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.Create)); pdfFormFields = pdfStamper.AcroFields; pdfFormFields.SetField("EID", Ecode); pdfFormFields.SetField("EmpName", Ename); pdfFormFields.SetField("PayPeriodEnd", EndDate.ToString("MM-dd-yyyy")); pdfFormFields.SetField("Begin1_1", dtBegin1_1.ToString("MM-dd-yyyy")); pdfFormFields.SetField("Begin1_2", dtBegin1_2.ToString("MM-dd-yyyy")); pdfFormFields.SetField("Begin2_1", dtBegin2_1.ToString("MM-dd-yyyy")); pdfFormFields.SetField("Begin2_2", dtBegin2_2.ToString("MM-dd-yyyy")); DateTime cBeginDate = BeginDate; while (cBeginDate <= EndDate) { string RowName = cBeginDate.ToString("dddd") + "_" + WhichWeek(cBeginDate); Double hours = CalculateHours(cBeginDate); if (cBeginDate <= dtBegin1_2) { TotalHoursWeek1 += hours; } else { TotalHoursWeek2 += hours; } pdfFormFields.SetField(RowName, hours.ToString()); cBeginDate = cBeginDate.AddDays(1); } pdfFormFields.SetField("RegTotal1", Convert.ToString(TotalHoursWeek1)); pdfFormFields.SetField("RegTotal2", Convert.ToString(TotalHoursWeek2)); FormattedDataTable.Rows.Add(dtRow); pdfStamper.Close(); CoreUtils.ShowMessage("Sign-In Logs", "PDF Printed", CoreEnums.ErrorType.Notice); } catch (Exception e) { CoreUtils.ShowMessage("Sign In Logs", e.Message); } }
public override string ToString() { return(Name + " " + BeginDate.ToString("yyyy-MM-dd") + " " + EndDate.ToString("yyyy-MM-dd")); }