/// <summary> /// �����ڶ���ת��Ϊ��ʽ�ַ��� /// </summary> /// <param name="oDateTime">���ڶ���</param> /// <param name="strFormat"> /// ��ʽ�� /// "SHORTDATE"===������ /// "LONGDATE"==������ /// ����====�Զ����ʽ /// </param> /// <returns>�����ַ���</returns> public static string ConvertDateToString(DateTime oDateTime, string strFormat) { string strDate = ""; try { switch (strFormat.ToUpper()) { case "SHORTDATE": strDate = oDateTime.ToShortDateString(); break; case "LONGDATE": strDate = oDateTime.ToLongDateString(); break; default: strDate = oDateTime.ToString(strFormat); break; } } catch (Exception) { strDate = oDateTime.ToShortDateString(); } return strDate; }
public void display_for_detail(BCTKUS.US_RPT_TONG_TIEN_DINH_MUC ip_us, DateTime ip_from_date, DateTime ip_to_date) { decimal don_gia_dinh_muc = 0; decimal so_luong_thong_ke = 0; decimal id_co_so_dinh_muc = -1; DateTime ap_dung_tu_ngay = new DateTime(); string ten_co_so_dinh_muc = ""; m_lbl_ten_trung_tam.Text = ip_us.strTEN_PHONG_BAN + " (" + ip_us.strMA_PHONG_BAN + ")"; //m_lbl.Text = "Tổng tiền định mức " + ip_us.strTEN_NGAN +" tháng " + ip_from_date.Month + "/" + ip_from_date.Year; ip_us.get_don_gia_dinh_muc_and_so_luong_thong_ke(ip_us.dcID_PHONG_BAN, ip_us.dcID_LOAI_DINH_MUC , ip_from_date, ip_to_date , ref don_gia_dinh_muc, ref so_luong_thong_ke); m_lbl_don_gia.Text = CIPConvert.ToStr(don_gia_dinh_muc, "#,###") + " (VNĐ)"; //m_lbl_ngay_ap_dung.Text = so_luong_thong_ke + " (người)"; m_lbl_sltk.Text = so_luong_thong_ke + " (người)"; m_lbl_tong_tien.Text = CIPConvert.ToStr(don_gia_dinh_muc * so_luong_thong_ke, "#,###") + " (VNĐ)"; if(don_gia_dinh_muc*so_luong_thong_ke == 0) { m_lbl_tong_tien.Text = "0" + " (VNĐ)"; } ip_us.get_co_so_dinh_muc_ap_dung_tu_ngay(ip_us.dcID_PHONG_BAN, ip_us.dcID_LOAI_DINH_MUC , ip_from_date, ip_to_date , ref id_co_so_dinh_muc, ref ap_dung_tu_ngay , ref ten_co_so_dinh_muc); m_lbl_co_so_dinh_muc.Text = ten_co_so_dinh_muc; if(ap_dung_tu_ngay.ToShortDateString() != "01/01/0001") { m_lbl_ngay_ap_dung.Text = ap_dung_tu_ngay.ToShortDateString(); } this.ShowDialog(); }
/// <summary> /// Hämtar alla bokningar under en viss dag /// </summary> private void bokningar(DateTime dag) { boknings_objekt bokningar = new boknings_objekt(new SqlCeDatabase(), this.admin); SortedList<string,string>[] allaBokningar; Label[] tider = { labelTid08, labelTid10, labelTid14, labelTid16 }; allaBokningar = bokningar.hamtaAllaBokningar(dag.ToShortDateString()); for (int i = 0; i < 4; i++) { tider[i].Click -= fordonsInfo; tider[i].Click -= label_Click; if (allaBokningar[i] == null) { tider[i].Text = "Ledig"; tider[i].Click -= fordonsInfo; tider[i].Click += new EventHandler(label_Click); tider[i].Cursor = Cursors.Hand; } else { tider[i].Text = allaBokningar[i]["bil"]; tider[i].Click += new EventHandler(fordonsInfo); tider[i].Cursor = Cursors.Hand; } if (DEBUG) richTextBoxFormAdminMsgs.Lines = bokningar.GetTmpMsgs(); labelNyBokDag.Text = dag.ToShortDateString(); labelDag.Text = string.Format("Det valda datumet är {0}", dag.ToShortDateString()); panelBokDag.Show(); } }
public List<string> GetAutoCompleteInvoiceNumbers(DateTime date, int SupplierId) { List<string> obj = new List<string>(); DataBaseConnection dbConn = new DataBaseConnection(); SqlConnection con = dbConn.SqlConn(); SqlCommand cmdI = new SqlCommand("Select g.InvoiceNumber, g.GRVTypeID from t_GRVList g left join t_SparRecon sr on g.InvoiceNumber=sr.InvoiceNumber and g.GRVTypeID = sr.GRVTypeId " + " where g.InvoiceDate BETWEEN DATEADD(DAY, -7,'" + date.ToShortDateString() + "') AND '" + date.ToShortDateString() + "' and g.SupplierID = " + SupplierId + " and COALESCE(sr.SparReconId,0) = 0 and g.Removed =0 ", con); cmdI.Connection.Open(); SqlDataReader drI = cmdI.ExecuteReader(); if (drI.HasRows) { while (drI.Read()) { if (Convert.ToInt16(drI["GRVTypeID"]) == 1) { obj.Add(drI["InvoiceNumber"].ToString() + " - GRV"); } else { obj.Add(drI["InvoiceNumber"].ToString() + " - CLM"); } } } drI.Close(); con.Close(); con.Dispose(); return obj; }
public ActionResult AddCourse(int id) { List<GradeLevel> gradeList = _opp2.GetAllGrades(); List<Subject> subjects = _opp1.GetAllSubjects(); DateTime Date = new DateTime(); var startDate = Date.ToShortDateString(); var endDate = Date.ToShortDateString(); var course = new TeacherViewModel() { GradeLevelList = gradeList.Select(x => new System.Web.Mvc.SelectListItem() { Value = x.GradeLevelId.ToString(), Text = x.GradeLevelName.ToString() }), SubjectList = subjects.Select(x => new System.Web.Mvc.SelectListItem() { Value = x.SubjectId.ToString(), Text = x.SubjectName.ToString() }) }; course.StartDate = startDate; course.EndDate = endDate; course.UserId = id; ViewBag.TeacherId = course.UserId; return View("AddCourse", course); }
static void Main() { DateTime today = DateTime.Now; DateTime otherDate = new DateTime(); string[] dateFormat = new string[] { "dd.MM.yyyy" }; int workDays; Console.WriteLine("Please enter the date /dd.MM.yyyy/:"); try { otherDate = DateTime.ParseExact(Console.ReadLine(), dateFormat, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None); //check which date is bigger and invert the calculation in order to receive the right result if (today.Date<otherDate.Date) { workDays = WorkDaysCalculation(today, otherDate); Console.WriteLine("The working days between {0} and {1} are {2}.", today.ToShortDateString(), otherDate.ToShortDateString(), workDays); } else { workDays = WorkDaysCalculation(otherDate, today); Console.WriteLine("The working days between {0} and {1} are {2}.", otherDate.ToShortDateString(), today.ToShortDateString(), workDays); } } catch(FormatException) { Console.WriteLine("Invalid date format!"); } }
public static string GetDateSpanString(DateTime StartDate, DateTime EndDate) { if (StartDate.ToShortDateString() == EndDate.ToShortDateString()) { return "(" + StartDate.ToShortDateString() + ")"; } return "(" + StartDate.ToShortDateString() + " - " + EndDate.ToShortDateString() + ")"; }
static void RunBondDataToDB(DateTime targetDate) { logger.Info("Start RunBondDataToDB {0}", targetDate.ToShortDateString()); //KtbRegressionToDB ktbRegressionToDB = new KtbRegressionToDB(); //ktbRegressionToDB.Run(targetDate); KtbAvgRateToDB ktbAvgRateToDB = new KtbAvgRateToDB(); ktbAvgRateToDB.Run(targetDate); logger.Info("End RunBondDataToDB {0}", targetDate.ToShortDateString()); }
protected void ddlMonth_SelectedIndexChanged(object sender, EventArgs e) { DateTime beginDate = new DateTime(DateTime.Now.Year, int.Parse(ddlMonth.SelectedValue), 1); DateTime endDate = new DateTime(beginDate.AddMonths(1).Year, beginDate.AddMonths(1).Month, 1); DateTime pastDate = new DateTime(beginDate.AddDays(-1).Year, beginDate.AddDays(-1).Month, 1); txtBeginDate.Text = beginDate.ToShortDateString(); txtEndDate.Text = endDate.AddDays(-1).ToShortDateString(); txtPastBeginDate.Text = pastDate.ToShortDateString(); txtPastEndDate.Text = pastDate.AddMonths(1).AddDays(-1).ToShortDateString(); this.lblTime.Text = "月" + "[" + beginDate.ToShortDateString() + " - " + endDate.AddDays(-1).ToShortDateString() + "]"; this.lblPastPlanYear.Text = pastDate.Year.ToString(); lblPastPlanPeriod.Text = pastDate.Month.ToString(); this.lblPastPlanPeroidType.Text = "月"; this.lblCurrentPlanYear.Text = beginDate.Year.ToString(); this.lblCurrentPlanPeroid.Text = beginDate.Month.ToString(); this.lblCurrentPlanPeroidType.Text = "月"; //this.lblPastPlan.Text = pastDate.Year.ToString() + "年" + pastDate.Month.ToString() + "月计划"; this.lblConclusion.Text = pastDate.Year.ToString() + "年" + pastDate.Month.ToString() + "月总结"; //this.lblCurrentPlan.Text = beginDate.Year.ToString() + "年" + beginDate.Month.ToString() + "月计划"; ActiveRecord.Model.Plan plan = new ActiveRecord.Model.Plan().Find(ddlPlanObjectType.SelectedValue, ddlPlanPeriodType.SelectedValue, lblCurrentPlanYear.Text, lblCurrentPlanPeroid.Text, Server.UrlDecode(Request.Cookies["UserName"].Value)); if (plan != null)//本月计划 { this.FCKeditor3.Value = plan.PlanContent; } else { this.FCKeditor3.Value = ""; } //if (plan.PlanBeginDate > DateTime.Now || plan.PlanEndDate < DateTime.Now) //{ // Response.Write("<script laguage='javascript'>setFckEditor3ReadOnly();</script>"); //} //上月总结 plan = new ActiveRecord.Model.Plan().Find(ddlPlanObjectType.SelectedValue, ddlPlanPeriodType.SelectedValue, lblPastPlanYear.Text, int.Parse(lblPastPlanPeriod.Text).ToString(), Server.UrlDecode(Request.Cookies["UserName"].Value)); if (plan != null)//上月总结 { this.FCKeditor2.Value = plan.PlanConclusion; this.past_plan_content.InnerHtml = plan.PlanContent;//上月计划 } else { this.FCKeditor2.Value = ""; this.past_plan_content.InnerHtml = ""; } //if (plan.PlanBeginDate > DateTime.Now || plan.PlanEndDate < DateTime.Now) //{ // Response.Write("<script laguage='javascript'>setFckEditor2ReadOnly();</script>"); //} }
public MainWindow() { // start anotak AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ApplicationThreadException); // end anotak InitializeComponent(); //CommandBindings //Find Shell Library at http://archive.msdn.microsoft.com/WPFShell/Release/ProjectReleases.aspx?ReleaseId=4332 Microsoft.Windows.Shell.SystemParameters2.Current.PropertyChanged += CurrentPropertyChanged; if(UserSettings.CurrentSettings.UseAeroScheme) if (Microsoft.Windows.Shell.SystemParameters2.Current.IsGlassEnabled) Style = (Style)FindResource("AeroStyle"); Class.CharNames.LoadDictionary(); if (!UserSettings.CurrentSettings.WindowCollection.ContainsKey(Name)) UserSettings.CurrentSettings.WindowCollection.Add(Name, new TypeSettings()); else { Left = UserSettings.CurrentSettings.WindowCollection[Name].ThisLocation.X; Top = UserSettings.CurrentSettings.WindowCollection[Name].ThisLocation.Y; Width = UserSettings.CurrentSettings.WindowCollection[Name].ThisSize.Width; Height = UserSettings.CurrentSettings.WindowCollection[Name].ThisSize.Height; } recentFileList.MenuClick += (s, e) => RecentOpen(e.Filepath); exButtonCharge.OnClick += exButtonCharge_OnClick; exButtonInput.OnClick += exButtonInput_OnClick; exButtonMoves.OnClick += exButtonMoves_OnClick; exButtonCancels.OnClick += exButtonCancels_OnClick; exButtonScripts.OnClick += exButtonScripts_OnClick; exButtonVFX.OnClick += exButtonVFX_OnClick; exButtonHitBox.OnClick += exButtonHitBox_OnClick; this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, ClickOpen)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, ClickSave, FilesOpened)); CommandBindings.Add(new CommandBinding(ApplicationCommands.SaveAs, ClickSaveAs, FilesOpened)); this.Title = "Ono! " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; //Build Timestamp var version = Assembly.GetEntryAssembly().GetName().Version; var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan( TimeSpan.TicksPerDay * version.Build + // days since 1 January 2000 TimeSpan.TicksPerSecond * 2 * version.Revision)); // seconds since midnight, (multiply by 2 to get original) //CommandManager.AddExecutedHandler(ApplicationCommands.Open, ClickOpen); BuildTime.Content = "Build Date: "+buildDateTime.ToShortDateString(); AELogger.Log("Build Date: " + buildDateTime.ToShortDateString(), false); App.OpenedFiles.Log = AELogger.Logger; this.PreviewKeyDown += this.Base_PreviewKeyDown; }
public void GenerateReportGrid(DateTime dateFrom, DateTime dateTo) { Cursor current = this.Cursor; this.Cursor = Cursors.WaitCursor; labelControlfromto.Text = dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString(); gridViewAnalizeReport.ViewCaption = "Отчет по анализам за период " + " " + dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString(); List<UslugiCount> listUslugiCount = DataProvider.DataProvider.GetUslugiCount(dateFrom, dateTo,false); uslugiCountBindingSource.DataSource = listUslugiCount; this.Cursor = Cursors.Arrow; }
public static List<string> clear(DateTime begin, DateTime end, string extension, string user) { OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; string sql = "SELECT PAD FROM BESTAND WHERE Datum BETWEEN '" + begin.ToShortDateString() + "' AND '" + end.ToShortDateString() + "'"; List<string> paden = new List<string>(); if (extension != "") { cmd.Parameters.Add(new OracleParameter("extension", extension)); sql += " AND Extensie = :extension"; } if (user != "") { cmd.Parameters.Add(new OracleParameter("user0", user)); sql += " AND RFID = :user0"; } cmd.CommandText = sql; try { conn.Open(); OracleDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { paden.Add(reader["PAD"].ToString()); } sql = "DELETE FROM BESTAND WHERE Datum BETWEEN '" + begin.ToShortDateString() + "' AND '" + end.ToShortDateString() + "'"; if (extension != "") { sql += " AND Extensie = :extension"; } if (user != "") { sql += " AND RFID = :user0"; } cmd.CommandText = sql; cmd.ExecuteNonQuery(); } catch (OracleException ex) { throw ex; } finally { conn.Close(); } return paden; }
public IList<AutorizacionDetalle> buscar(DateTime desde,DateTime hasta ) { IList<AutorizacionDetalle> autorizaciones = null; if (ConexionBD.getSession().CreateCriteria(typeof(AutorizacionDetalle)).Add(Expression.Between("Visita.Fecha", DateTime.Parse(desde.ToShortDateString()), DateTime.Parse(hasta.ToShortDateString()))).List<AutorizacionDetalle>().Count > 0) { autorizaciones = ConexionBD.getSession().CreateCriteria(typeof(AutorizacionDetalle)).Add(Expression.Between("Visita.Fecha", DateTime.Parse(desde.ToShortDateString()), DateTime.Parse(hasta.ToShortDateString()))).List<AutorizacionDetalle>(); } return autorizaciones; }
public void CultureTest() { Assert.AreEqual (CultureInfo.CurrentCulture.Name, "ja-JP"); Assert.AreEqual (Thread.CurrentThread.CurrentCulture.Name,"ja-JP"); DateTime dateTime = new DateTime(2013, 7, 2); Assert.AreEqual (dateTime.ToShortDateString(), "2013/07/02"); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Assert.AreEqual (dateTime.ToShortDateString(), "7/2/2013"); Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); Assert.AreEqual (dateTime.ToShortDateString(), "02.07.2013"); }
public List<ReportTotalMedicineDeliveryByMonth> GetReportTotalMedicineDeliveryByMonth(int clinicId, DateTime month) { var parameters = new SqlParameter[] { new SqlParameter("@ClinicId", clinicId), new SqlParameter("@Month", month.ToShortDateString()) }; var ds = this.Context.Database.SqlQuery<ReportTotalMedicineDeliveryByMonth>("sp_ReportTotalMedicineDeliveryByMonth @ClinicId, @Month", new SqlParameter("@ClinicId", AppContext.CurrentClinic.Id), new SqlParameter("@Month", month.ToShortDateString())); return ds.ToList(); }
private void _FormMessage(IEnumerable<EmployeeItem> list, DateTime date) { if (list == null) return; var s = Properties.Settings.Default; _message.Subject = string.Format(s.EmailSubject, date.ToShortDateString()); _message.Body = string.Format(s.EmailBodyBegin, date.ToShortDateString()); foreach (var item in list) { _message.Body += item.ToEmailString(); } _message.Body += s.EmailBodyEnd; }
//static ServerInstance() //{ // ////Define image resource // //ResourceManager.AddResource(CometWorker.GetApplicationPath() + "pokein_logo.gif" //resource location // // , "Logo" //public name of the resource // // , ResourceType.Image //Image type // // , string.Empty //This resource is application wide // // ); // //string message = "PokeIn Library"; // //byte[] bt = CometSettings.SerializationEncoding.GetBytes(message); // ////Define text resource // //ResourceManager.AddResource(ref bt // // , "Message" //public name of the resource // // , ResourceType.Text //Text type // // , "txt" //file type // // , string.Empty //This resource is application wide // // ); // new Thread(delegate() // { // while (!CometWorker.IsApplicationRecycling) // { // if (CometWorker.Groups.GroupHasMembers("ServerTime-Desktop")) // { // string ext = EXTML.Method("ServerTimeUpdated", DateTime.Now); // CometWorker.Groups.Send("ServerTime-Desktop", ext); // } // if (CometWorker.Groups.GroupHasMembers("ServerTime-Web")) // { // string json = JSON.Method("ServerTimeUpdated", DateTime.Now); // CometWorker.Groups.Send("ServerTime-Web", json); // } // Thread.Sleep(800); // } // }).Start(); //} public void ClassTest(TestClass tc, DateTime dt) { string message = ""; if (IsDesktop) { message = EXTML.Method("TestClassReceived", tc.number, tc.items.Count, tc.text, dt.ToShortDateString()); } else { message = JSON.Method("TestClassReceived", tc.number, tc.items.Count, tc.text, dt.ToShortDateString()); } CometWorker.SendToClient(ClientId, message); }
public void LoadReportsTable() { string connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); int orgId = Convert.ToInt32(Session["CURRENT_ORG_ID"]); List<int> reportsIds = new List<int>(); dataBlock.OpenConnection(); reportsIds = dataBlock.reportsTable.GetAllReportsIds(); Session["ReportsTab_UserControl_ReportsIds"] = reportsIds; DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("CODE", typeof(string))); dt.Columns.Add(new DataColumn("TYPE", typeof(string))); dt.Columns.Add(new DataColumn("NAME", typeof(string))); dt.Columns.Add(new DataColumn("PRICE", typeof(string))); dt.Columns.Add(new DataColumn("UPDATE_DATE", typeof(string))); dt.Columns.Add(new DataColumn("BEGIN_DATE", typeof(string))); dt.Columns.Add(new DataColumn("END_DATE", typeof(string))); DateTime date = new DateTime(); string dateStringToShow = ""; foreach (int reportId in reportsIds) { dr = dt.NewRow(); dr["CODE"] = reportId.ToString(); dr["TYPE"] = dataBlock.reportsTable.GetReportTypeName(reportId, 0); dr["NAME"] = dataBlock.reportsTable.GetReportName(reportId); dr["PRICE"] = dataBlock.reportsTable.GetReportPrice(reportId); dr["UPDATE_DATE"] = dataBlock.reportsTable.GetReportDateUpdate(reportId).ToShortDateString(); //Дата добавления в организацию. if (DateTime.TryParse(dataBlock.reportsTable.GetReportUserOrg_BDATE(reportId, orgId), out date)) dateStringToShow = date.ToShortDateString(); else dateStringToShow = "Не добавлен"; dr["BEGIN_DATE"] = dateStringToShow; //Дата окончания в организации. if (DateTime.TryParse(dataBlock.reportsTable.GetReportUserOrg_EDATE(reportId, orgId), out date)) dateStringToShow ="До " + date.ToShortDateString(); else dateStringToShow = "-"; dr["END_DATE"] = dateStringToShow; dt.Rows.Add(dr); } ReportsDataGrid.DataSource = dt; ReportsDataGrid.DataBind(); dataBlock.CloseConnection(); }
public static List<Odeme> getPayments(DateTime First, DateTime Last, Bilesen Type) { List<Odeme> Value = new List<Odeme>(); SqlConnection con = new SqlConnection("Server=.;Database=KutuphaneOtomasyon;Trusted_Connection=true"); String CommandString = "select Tarih,Uye.Adi,Uye.Soyadi,Aciklama,Tutar"; if(Type == null) { CommandString += ",OdemeTipi.Adi"; CommandString += " from dbo.Odeme"; CommandString += " join dbo.Uye on Uye.ID = Odeme.UyeID"; CommandString += " join dbo.OdemeTipi on OdemeTipi.ID = Odeme.OdemeTipi"; CommandString += " where (Tarih between "; CommandString += "'" + convertToSqlDate(First.ToShortDateString()) + "' and "; CommandString += "'" + convertToSqlDate(Last.ToShortDateString()) + "')"; SqlCommand cmd = new SqlCommand(CommandString, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Odeme Current = new Odeme(reader.GetDateTime(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetDecimal(4), reader.GetString(5)); Value.Add(Current); } reader.Close(); con.Close(); } else { CommandString += " from dbo.Odeme"; CommandString += " join dbo.Uye on Uye.ID = Odeme.UyeID"; CommandString += " join dbo.OdemeTipi on OdemeTipi.ID = Odeme.OdemeTipi"; CommandString += " where (Tarih between "; CommandString += "'" + convertToSqlDate(First.ToShortDateString()) + "' and "; CommandString += "'" + convertToSqlDate(Last.ToShortDateString()) + "')"; CommandString += " and (Odeme.OdemeTipi=" + Type.ID.ToString() + ")"; SqlCommand cmd = new SqlCommand(CommandString, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Odeme Current = new Odeme(reader.GetDateTime(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetDecimal(4), ""); Value.Add(Current); } reader.Close(); con.Close(); } return Value; }
protected void btnDesaprueba_Click(object sender, ImageClickEventArgs e) { A11NSA = Request.QueryString["A11NSA"]; FechaSis = DateTime.Now; CultureInfo ci = new CultureInfo("Es-Es"); DIASEMANA = (ci.DateTimeFormat.GetDayName(FechaSis.DayOfWeek)).Substring(0, 1); fecha = FechaSis.ToShortDateString().Substring(6, 4) + FechaSis.ToShortDateString().Substring(3, 2) + FechaSis.ToShortDateString().Substring(0, 2); if (Convert.ToDecimal(FechaSis.Minute.ToString()) <= 9) { Hora = FechaSis.Hour.ToString() + "0" + FechaSis.Minute.ToString(); } else { Hora = FechaSis.Hour.ToString() + FechaSis.Minute.ToString(); } int h = objTab.InUpDelTablas("UPDATE ALI011UTIL SET A11CA1 = '" + Convert.ToDecimal((string)(Session["CodPlanilla"])) + "', A11UA1 = '" + (string)(Session["Usuario"]).ToString().Trim() + "',A11FA1 = '" + fecha + "',A11UH1=" + Convert.ToDecimal(Hora) + ",A11AUT = '" + Convert.ToDecimal((string)(Session["CodPlanilla"])) + "',A11STT='E' WHERE A11NSA= '" + A11NSA.Trim() + "'"); Mensaje("Requerimiento " + A11NSA.Trim().ToString() + " ha sido Desaprobado"); Response.Redirect("~/Utiles/Transaccion/WebAprobacionReqUtiles.aspx"); }
public ClientBillingDetailHeader(DateTime startDate, DateTime endDate) { this.m_ReportTitle1 = "Yellowstone Pathology Institute"; this.m_ReportTitle2 = "Client Billing Detail Report"; if (startDate == endDate) { this.m_ReportTitle3 = "Billing Detail Posted On: " + startDate.ToShortDateString(); } else { this.m_ReportTitle3 = "Billing Detail Posted Between: " + startDate.ToShortDateString() + " and " + endDate.ToShortDateString(); } }
// Get all order between a time period. // Returns the DataTable contains all transactions in that time period. public static DataTable GetAllOrdersBetween(DateTime startDate, DateTime endDate) { String sql_getAllTransactions = ""; if (DBConnectionUtil.DBConn.dbType == DatabaseType.Access) { sql_getAllTransactions = string.Format("select * from [Transaction] where SaleDate > #{0}# and SaleDate < #{1}# order by SaleDate desc", startDate.ToShortDateString(), endDate.ToShortDateString()); } else { sql_getAllTransactions = string.Format("select * from [Transaction] where SaleDate > '{0}' and SaleDate < '{1}' order by SaleDate desc", startDate.ToShortDateString(), endDate.ToShortDateString()); } DataTable dt = DataFactory.ExecuteSqlReturnTable(sql_getAllTransactions); return dt; }
/// <summary> /// Преобразует содержимое DataGridView, переданного в качестве парметра, в HTML-страницу /// </summary> /// <param name="dgvInf">Таблица</param> /// <param name="from">Дата начала периода</param> /// <param name="to">Дата конца периода</param> /// <param name="subscriberFullName">ФИО абонента</param> /// <param name="phoneNumber">Телефонный номер</param> /// <param name="totalSum">Итог</param> /// <param name="fileName">Имя файла</param> public static void DetailedInfToHtml(DataGridView dgvInf, DateTime from, DateTime to, string subscriberFullName, string phoneNumber, double totalSum, string fileName) { using (StreamWriter writer = new StreamWriter(fileName, false, Encoding.UTF8)) { writer.WriteLine("<html>"); writer.WriteLine("<head>"); writer.WriteLine("<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>"); writer.WriteLine("<title>Детализация за период с " + from.ToShortDateString() + " по " + to.ToShortDateString() + "</title>"); writer.WriteLine("</head>"); writer.WriteLine("<body>"); writer.WriteLine("<div align='center'><font size='5'><b>Детализированная информация</b></font></div>"); writer.WriteLine("<div align='center'><font size='3'>за период с " + from.ToShortDateString() + " по " + to.ToShortDateString() + "</div>"); writer.WriteLine("<br>"); writer.WriteLine("<div align='left'>ФИО абонента: " + subscriberFullName + "</div>"); writer.WriteLine("<div align='left'>Абонентский номер: " + phoneNumber + "</div>"); writer.WriteLine("<table width='100%' border='1' cellspacing='0'>"); for (int i = 0; i <= dgvInf.RowCount; i++) { writer.WriteLine("<tr align='center' valign='middle'>"); for (int j = 0; j < dgvInf.ColumnCount; j++) { if (i == 0) { writer.WriteLine("<td><b>" + dgvInf.Columns[j].HeaderText + "</b></td>"); } else { writer.WriteLine("<td>" + dgvInf.Rows[i-1].Cells[j].Value.ToString() + "</td>"); } } writer.WriteLine("</tr>"); } writer.WriteLine("<tr>"); writer.WriteLine("<td colspan="); writer.WriteLine("'" + (dgvInf.ColumnCount - 1).ToString() + "'></td>"); writer.WriteLine("<td><b>Итого: "); writer.WriteLine(totalSum.ToString() + " " + Constants.Currency + "</b></td>"); writer.WriteLine("</tr>"); writer.WriteLine("</table>"); writer.WriteLine("</body>"); writer.WriteLine("</html>"); writer.Close(); } }
public void WriteText(System.IO.TextWriter writer, LogLevels level, DateTime dateTime, string text) { string sLevel; switch (level) { case LogLevels.Info: default: sLevel = "I"; break; case LogLevels.Diagnostic: sLevel = "D"; break; case LogLevels.Warning: sLevel = "W"; break; case LogLevels.Error: sLevel = "E"; break; } writer.WriteLine("{0}:{1} {2} [{4}]: {3}", sLevel, dateTime.ToShortDateString(), dateTime.ToLongTimeString(), text, Thread.CurrentThread.GetHashCode()); }
public void ProcessRequest(HttpContext context) { try { var nameValueCollection = (NameValueCollection)ConfigurationManager.GetSection("rrdbfileserver"); string url = nameValueCollection["url"]; rrdDbAccessInterface = new ServerAccessor(url);//"tcp://server:8100/GetRrdDbAdapter"); //string channelName = context.Request.QueryString["c"]; DateTime start = new DateTime(2005, 12, 19); DateTime end = new DateTime(2006, 12, 12); //\Users\miknil\Documents\Visual Studio 2008\Projects\rrd4n\RRDConfigTool\ string databaseName = "car_day.rra"; StringBuilder sb = new StringBuilder(); sb.AppendFormat("- --start \"{0}\" --end \"{1}\"", start.ToShortDateString(), end.ToShortDateString()); sb.Append(" --imgformat PNG"); sb.AppendFormat(" DEF:myruntime=\"{0}\":milage:AVERAGE", databaseName); sb.Append(" CDEF:mil=myruntime,86400,* LINE2:mil#FF0000 -w 800 -h 400 CDEF:km=myruntime,1000,*"); sb.Append(" SDEF:value_sum=km,TOTAL GPRINT:myruntime:TOTAL:\"usage {0}\""); GraphParser parser = new GraphParser(sb.ToString()); RrdGraphDef graphDef = parser.CreateGraphDef(); RrdGraph graph_1 = new RrdGraph(graphDef, rrdDbAccessInterface); RrdGraphInfo info = graph_1.getRrdGraphInfo(); MemoryStream ms = new MemoryStream(info.getBytes()); context.Response.ContentType = "image/png"; context.Response.BinaryWrite(ms.ToArray()); } catch (Exception ex) { context.Response.ContentType = "text/plain"; context.Response.Write(ex.Message); } }
public static string customFecha(DateTime fecha) { string fechaMySQL = fecha.ToShortDateString(); DateTime fechaalta = Convert.ToDateTime(fechaMySQL); fechaMySQL = fechaalta.ToString("yyyy/MM/dd"); return fechaMySQL; }
protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e) { DateTime newday = new DateTime(int.Parse(ddlYear.SelectedValue),int.Parse(ddlMonth.SelectedValue),1); string querystring = this.Page.Request.QueryString.ToString(); querystring = querystring.Replace("Day=" + strDay, "Day=" + newday.ToShortDateString().Replace('/', '-')); this.Page.Response.Redirect(this.Page.Request.Path + "?" + querystring); }
public void CreateBlankMessage() { ADT_A01 a01 = new ADT_A01(); DateTime birthDate = new DateTime(1980, 4, 1); a01.MSH.SendingApplication.UniversalID.Value = "ThisOne"; a01.MSH.ReceivingApplication.UniversalID.Value = "COHIE"; a01.PID.PatientIDExternalID.ID.Value = "123456"; a01.PV1.AttendingDoctor.FamilyName.Value = "Jones"; a01.PV1.AttendingDoctor.GivenName.Value = "Mike"; a01.PID.DateOfBirth.TimeOfAnEvent.SetShortDate(birthDate); PipeParser parser = new PipeParser(); string pipeMessage = parser.Encode(a01); Assert.IsNotNull(pipeMessage); IMessage test = parser.Parse(pipeMessage); ADT_A01 a01Test = test as ADT_A01; Assert.IsNotNull(a01Test); Assert.AreEqual(a01Test.MSH.ReceivingApplication.UniversalID.Value, "COHIE"); Assert.AreEqual(a01Test.PID.PatientIDExternalID.ID.Value, "123456"); Assert.AreEqual(a01Test.PID.DateOfBirth.TimeOfAnEvent.GetAsDate().ToShortDateString(), birthDate.ToShortDateString()); Assert.AreEqual(a01Test.PV1.AttendingDoctor.FamilyName.Value, "Jones"); Assert.AreEqual(a01Test.MSH.MessageType.MessageType.Value, "ADT"); Assert.AreEqual(a01Test.MSH.MessageType.TriggerEvent.Value, "A01"); }
/// <summary> /// xử lý giá trị truyền tới /// </summary> /// <param name="hdbh"></param> public frmXuLyPhieuTTNCC(Entities.HoaDonNhap[] hdbh) { try { InitializeComponent(); dateserver = DateServer.Date(); sochungtu = txtsochungtu.Text = ProID("PhieuTTNCC"); SelectHoaDonNhap(); SelectNCC(); LayTenTT(); this.Text = "Quản Lý Thanh Toán Của Nhà Cung Cấp - Thêm Phiếu Thanh Toán"; txtmancc.Text = hdbh[0].MaNhaCungCap; txtnohienthoi.Text = LaySoDuNo(txtmancc.Text); cbbtientetygia.SelectedIndex = 0; Entities.HDThanhToanKH[] hd = new Entities.HDThanhToanKH[1]; Double tongtien = Convert.ToDouble(hdbh[0].TongTien); string thanhtoanngay = hdbh[0].ThanhToanNgay; thanhtoansaukhilapphieu = hdbh[0].ThanhToanSauKhiLapPhieu; Double sono = Convert.ToDouble(tongtien) - Convert.ToDouble(thanhtoanngay) - Convert.ToDouble(thanhtoansaukhilapphieu); hd[0] = new Entities.HDThanhToanKH(hdbh[0].MaHoaDonNhap, new Common.Utilities().FormatMoney(tongtien), new Common.Utilities().FormatMoney(sono), new Common.Utilities().FormatMoney(sono),thanhtoansaukhilapphieu); dtgvNCC.DataSource = hd; mskngaychungtu.Text = new Common.Utilities().XuLy(2,dateserver.ToShortDateString()); txttongthanhtoan.Text = new Common.Utilities().FormatMoney(TinhTien()); fix(); } catch (Exception ex) { } }
/// <summary> /// 두 DateTime 값이 년(Year) 단위까지 같은지 판단합니다. /// </summary> public static bool IsSameYear(this DateTime left, DateTime right, int yearBaseMonth = TimeSpec.CalendarYearStartMonth) { if(IsDebugEnabled) log.Debug("같은 년(Year)인지 판단합니다. left=[{0}], right=[{1}], yearBaseMonth=[{2}], ", left.ToShortDateString(), right.ToShortDateString(), yearBaseMonth); return GetYearOf(left, yearBaseMonth) == GetYearOf(right, yearBaseMonth); }
private void Start() { data = System.DateTime.Now; hora = System.DateTime.Now; data.ToShortDateString(); hora.ToShortTimeString(); caminhoDiretorioRelatorios = "C:/Relatórios - Arrasta!"; criaDiretorioRelatorios(); }
static StackObject *ToShortDateString_17(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.DateTime instance_of_this_method = (System.DateTime) typeof(System.DateTime).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 16); var result_of_this_method = instance_of_this_method.ToShortDateString(); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public static void GenerateUsernameEmail(out string username, out string email) { System.DateTime currentDateTime = System.DateTime.Now; //short date from current DateTime e.g. "2/20/2012". Uses current culture e.g. mm/dd/yyyy string shortDate = currentDateTime.ToShortDateString(); //Format for use as valid e-mail address e.g. 2-20-2012 shortDate = shortDate.Replace('/', '-'); //Fraction of the day that has elapsed since midnight TimeSpan timeSinceMidnight = currentDateTime.TimeOfDay; //Seconds since midnight e.g. 47003.9293606 double secondsSinceMidnight = timeSinceMidnight.TotalSeconds; //Format lyndaqa-"shortDate"-"secondsSinceMidnight" to no decimal places. //e.g. lyndaqa-2-20-2012-47004 username = String.Format("lyndaqa-{0}-{1:0.}", shortDate, secondsSinceMidnight); email = String.Format("{0}@mailinator.com", username); }
/// <summary> /// Returns a passed time from a particular date /// </summary> /// <param name="time"></param> /// <returns></returns> public static string GetPassedTimeSpanFromNow(this System.DateTime time) { string s = time.ToShortDateString(); TimeSpan span = System.DateTime.Now - time; var mins = decimal.Round(Convert.ToDecimal(span.TotalMinutes)); var hrs = decimal.Round(Convert.ToDecimal(span.TotalHours)); var days = decimal.Round(Convert.ToDecimal(span.TotalDays)); if (mins < 1) { s = "Just Now"; } else if (hrs < 1) { if (mins == 1) { s = "1 minute ago"; } else { s = mins + " minutes ago"; } } else if (days < 1) { if (hrs == 1) { s = "1 hour ago"; } else { s = hrs + " hours ago"; } } else if (days == 1) { s = "1 day ago"; } else if (days < 31) { s = days + " days ago"; } return(s); }
/// <summary> /// Initializes a new instance of the Lynda.Test.ConsumerPages.AccountInfo class. /// </summary> /// <param name="defaultInfo">Specifies how to initalize the account information.</param> public AccountInfo(DefaultInfo defaultInfo) : this() { if (defaultInfo < DefaultInfo.Standard || defaultInfo > DefaultInfo.Standard) { throw new ArgumentOutOfRangeException("defaultInfo", defaultInfo, "Must be one of the following: Standard"); } switch (defaultInfo) { case DefaultInfo.Standard: { //Form fields FirstName = "TESTfirstname"; LastName = "test"; System.DateTime currentDateTime = System.DateTime.Now; //short date from current DateTime e.g. "2/20/2012". Uses current culture e.g. mm/dd/yyyy string shortDate = currentDateTime.ToShortDateString(); //Format for use as valid e-mail address e.g. 2-20-2012 shortDate = shortDate.Replace('/', '-'); //Fraction of the day that has elapsed since midnight TimeSpan timeSinceMidnight = currentDateTime.TimeOfDay; //Seconds since midnight e.g. 47003.9293606 double secondsSinceMidnight = timeSinceMidnight.TotalSeconds; //Format lyndaqa-"shortDate"-"secondsSinceMidnight" to no decimal places. //e.g. lyndaqa-2-20-2012-47004 Username = String.Format("lyndaqa-{0}-{1:0.}", shortDate, secondsSinceMidnight); Email = String.Format("{0}@mailinator.com", username); Password = "******"; PasswordConfirm = password; //No sign ups SignMeUpNewReleases = false; SignMeUpNewsletters = false; SignMeUpSpecial = false; break; } default: throw new Exception(String.Format("Code not implemented yet: {0}", defaultInfo.ToString())); } }
public string ConvertDate(double timestamp) { // This is an example of a UNIX timestamp for the date/time 11-04-2005 09:25. //= 1113211532; // First make a System.DateTime equivalent to the UNIX Epoch. System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); // Add the number of seconds in UNIX timestamp to be converted. dateTime = dateTime.AddSeconds(timestamp); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. string printDate = dateTime.ToShortDateString(); //dateTime.ToShortTimeString(); return(printDate); }
private void TimestampToDate() { System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); foreach (var item in this.UserLeases) { // Console.WriteLine("date "+UnixTimeStampToDateTime(Convert.ToDouble(item.StartValidity))); if (!item.StartValidity.Contains("-") && !item.StartValidity.Contains("/") && !item.StartValidity.Equals("0") && !item.EndValidity.Equals("0")) { dateTime = dateTime.AddSeconds(Convert.ToDouble(item.StartValidity)); string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); item.StartValidity = printDate; dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); dateTime = dateTime.AddSeconds(Convert.ToDouble(item.EndValidity)); printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); item.EndValidity = printDate; dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); } } }
public void TestTutoril() { var connectionString = "mongodb://[test:1234]@localhost/test"; var client = new MongoClient(connectionString); var server = client.GetServer(); var database = server.GetDatabase("test"); var collection = database.GetCollection <Entity>("entities"); var entity = new Entity { Name = "Tom", Age = 25 }; collection.Insert(entity); //var id = entity.Id; //var query = Query<Entity>.EQ( e => e.Id, id ); //entity = collection.FindOne( query ); //entity.Name = "Dick"; System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); // Add the number of seconds in UNIX timestamp to be converted. dateTime = dateTime.AddSeconds(entity.Id.Timestamp); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); // Print the date and time System.Console.WriteLine(printDate); entity.Timestamp = printDate; collection.Save(entity); //var update = Update<Entity>.Set( e => e.Name, "Harry" ); //collection.Update( query, update ); //collection.Remove( query ); }
public void SqlConnectionUpdate() { Grid grid = new Grid(); SetupTestGrid(grid); grid.StayEdit = true; grid.CurrentId = "11"; grid.MasterTable.Rows[0]["intTest"].Value = 33345; grid.MasterTable.Rows[0]["decTest"].Value = 5634; grid.MasterTable.Rows[0]["vchTest"].Value = "blah" + DateTime.Now.ToString(dateformat); ((WebGrid.Columns.DateTime)grid.MasterTable.Columns["dtmDate"]).Format = dateformat; DateTime date = DateTime.Now; grid.MasterTable.Rows[0]["dtmDate"].Value = date; grid.MasterTable.Rows[0]["bitFlag"].Value = true; grid.MasterTable.Rows[0]["bitSecondFlag"].Value = false; grid.RaisePostBackEvent("RecordUpdateClick!!False"); Assert.AreEqual(grid.SystemMessage.Count, 0); Assert.AreEqual(grid.Mode, Mode.Edit); grid = new Grid(); SetupTestGrid(grid); grid.StayEdit = true; grid.CurrentId = "11"; ((WebGrid.Columns.DateTime)grid.MasterTable.Columns["dtmDate"]).Format = dateformat; grid.MasterTable.Rows[0]["dtmDate"].Value = DateTime.Now; DateTime?seconddate = grid.MasterTable.Rows[0]["dtmDate"].Value as DateTime?; //The grid should honour the date format and therefor returns a different date time. Assert.AreNotEqual(date, seconddate); //Date should be the same Assert.AreEqual(date.ToShortDateString(), seconddate.Value.ToShortDateString()); //Hour and minutes should also be the same. Assert.AreEqual(date.ToShortTimeString(), seconddate.Value.ToShortTimeString()); }
private void button2_Click(object sender, RoutedEventArgs e) { try { WebRequest req_big_time = WebRequest.Create(big_storeurl.Text + "time"); HttpWebRequest httpreq_time = (HttpWebRequest)req_big_time; httpreq_time.Method = "GET"; httpreq_time.ContentType = "text/xml; charset=utf-8"; httpreq_time.Credentials = new NetworkCredential(big_user.Text, big_pass.Text); HttpWebResponse res_time = (HttpWebResponse)httpreq_time.GetResponse(); StreamReader rdr_time = new StreamReader(res_time.GetResponseStream()); string result_time = rdr_time.ReadToEnd(); MessageBox.Show(result_time); if (res_time.StatusCode == HttpStatusCode.OK || res_time.StatusCode == HttpStatusCode.Accepted) { XDocument doc_time = XDocument.Parse(result_time); string stime = doc_time.Element("time").Element("time").Value.ToString(); // File.WriteAllText("server_time.txt", stime); MessageBox.Show(stime); double timestamp = Convert.ToDouble(stime); // First make a System.DateTime equivalent to the UNIX Epoch. System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); // Add the number of seconds in UNIX timestamp to be converted. dateTime = dateTime.AddSeconds(timestamp); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); MessageBox.Show(printDate); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
/// <summary> /// 按照指定格式输出时间 /// </summary> /// <param name="NowDate">时间</param> /// <param name="type">输出类型</param> /// <returns></returns> public static string WriteDate(this string NowDate, int type) { double TimeZone = 0; System.DateTime NewDate = System.DateTime.Parse(NowDate).AddHours(TimeZone); string strResult = ""; switch (type) { case 1: strResult = NewDate.ToString(); break; case 2: strResult = NewDate.ToShortDateString().ToString(); break; case 3: strResult = NewDate.Year + "年" + NewDate.Month + "月" + NewDate.Day + "日 " + NewDate.Hour + "点" + NewDate.Minute + "分" + NewDate.Second + "秒"; break; case 4: strResult = NewDate.Year + "年" + NewDate.Month + "月" + NewDate.Day + "日"; break; case 5: strResult = NewDate.Year + "年" + NewDate.Month + "月" + NewDate.Day + "日 " + NewDate.Hour + "点" + NewDate.Minute + "分"; break; case 6: strResult = NewDate.Year + "-" + NewDate.Month + "-" + NewDate.Day + " " + NewDate.Hour + ":" + NewDate.Minute; break; default: strResult = NewDate.ToString(); break; } return(strResult); }
private void DrawDateTime() { //Using the System.DateTime to collect current time information System.DateTime dateTime = System.DateTime.Now; if (month == "") { month = dateTime.Month.ToString(); } //Displaying all GUI elements using Rect Rect date = new Rect(new Vector2(20, 20), new Vector2(100, 20)); GUI.Label(date, dateTime.ToShortDateString()); Rect time = new Rect(new Vector2(Screen.width - 80, 20), new Vector2(80, 20)); GUI.Label(time, dateTime.ToShortTimeString()); Rect input = new Rect(new Vector2(20, 60), new Vector2(Screen.width - 40, Screen.height / 3 - 140)); Rect outputObject = new Rect(new Vector2(20, 80 + Screen.height / 3 - 140), new Vector2(Screen.width - 40, Screen.height - 240)); currentLog = GUI.TextArea(input, currentLog); string editMode = "------------------------------------EDITING------------------------------------" + "\n"; if (finalPath != "") { if (File.Exists(finalPath)) { GUI.TextArea(outputObject, editMode + File.ReadAllText(finalPath).ToString()); } } Rect inputObject = new Rect(new Vector2(20, Screen.height - 70), new Vector2(Screen.width - 40, 20)); //Allowing input of an object to specify what the log is about (Optional Field) currentObject = (Object)EditorGUI.ObjectField(inputObject, currentObject, typeof(Object)); }
protected string GetTimeString(System.DateTime dateTime) { if (KickStarter.settingsManager.saveTimeDisplay != SaveTimeDisplay.None) { if (KickStarter.settingsManager.saveTimeDisplay == SaveTimeDisplay.CustomFormat) { string creationTime = dateTime.ToString(KickStarter.settingsManager.customSaveFormat); return(" (" + creationTime + ")"); } else { string creationTime = dateTime.ToShortDateString(); if (KickStarter.settingsManager.saveTimeDisplay == SaveTimeDisplay.TimeAndDate) { creationTime += " " + dateTime.ToShortTimeString(); } return(" (" + creationTime + ")"); } } return(string.Empty); }
static void Main(string[] args) { //DateTime System.DateTime myDate = new System.DateTime(); Console.WriteLine(myDate); System.DateTime date1 = new System.DateTime(2020, 11, 27, 12, 54, 52); //year, month, date, hour, minutes, seconds Console.WriteLine(date1); Console.WriteLine(date1.ToShortDateString()); //11/27/2020 Console.WriteLine(date1.ToShortTimeString()); //12:54 PM Console.WriteLine(date1.AddDays(-4)); //11/23/2020 12:54:52 PM System.DateTime dateNow = System.DateTime.Now; Console.WriteLine(dateNow); string formattedDate = string.Format("{0:yyyy-MMMM-d HH:mm:ss tt}", dateNow); //here we use regex MMM -month abbreviation, MMMM - full month name, dddd - day of the week, tt- AM or PM Result: 2020-November-27 01:26:57 AM Console.WriteLine(formattedDate); string formattedDateTwo = string.Format("{0:dddd 'of month' MMMM 'year' yyyy}", date1); //Friday of month November year 2020 Console.WriteLine(formattedDateTwo); }
private void button4_Click(object sender, EventArgs e) { // This is an example of a UNIX timestamp for the date/time 11-04-2005 09:25. //1422100800000 //1113211532 string str = textBox2.Text.Substring(0, 10); double timestamp = Convert.ToDouble(str); // First make a System.DateTime equivalent to the UNIX Epoch. System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); // Add the number of seconds in UNIX timestamp to be converted. dateTime = dateTime.AddSeconds(timestamp); dateTime = dateTime.AddHours(+7); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); // Print the date and time textBox3.Text = printDate; //System.Console.WriteLine(printDate); }
private void AddAppointmentToFlDay(int startDayAtFlNumber) { System.DateTime startDate = new System.DateTime(currentDate.Year, currentDate.Month, 1); System.DateTime endDate = startDate.AddMonths(1).AddDays(-1); string sql = $"select * from MealInformation where MealDate between #{startDate.ToShortDateString()}# and #{endDate.ToShortDateString()}#"; DataTable dt = @event.QueryAsDataTable(sql); foreach (DataRow dr in dt.Rows) { System.DateTime appday = System.DateTime.Parse(dr["MealDate"].ToString()); var link = new LinkLabel(); link.Tag = dr["MealID"].ToString(); link.Name = $"link{dr["MealID"]}"; link.Text = dr["MealName"].ToString(); link.BackColor = System.Drawing.Color.LightGray; link.LinkColor = System.Drawing.Color.Black; link.AutoSize = true; link.Size = new Size(96, 23); listFLDay[(appday.Day - 1) + (startDayAtFlNumber - 1)].Controls.Add(link); } }
private void GetDate() { if (dateTimeKind == DateTimeKind.Utc) { mDate = System.DateTime.UtcNow; } else { mDate = System.DateTime.Now; } mMonth = mDate.Month.ToString(DateTimeFormatInfo.InvariantInfo); mDay = mDate.Day.ToString(DateTimeFormatInfo.InvariantInfo); mYear = mDate.Year.ToString(DateTimeFormatInfo.InvariantInfo); mHour = mDate.Hour.ToString(DateTimeFormatInfo.InvariantInfo); mMinute = mDate.Minute.ToString(DateTimeFormatInfo.InvariantInfo); mSecond = mDate.Second.ToString(DateTimeFormatInfo.InvariantInfo); mMillisecond = mDate.Millisecond.ToString(DateTimeFormatInfo.InvariantInfo); mTicks = mDate.Ticks.ToString(DateTimeFormatInfo.InvariantInfo); mKind = mDate.Kind.ToString(); mTimeOfDay = mDate.TimeOfDay.ToString(); mDayOfYear = mDate.DayOfYear.ToString(DateTimeFormatInfo.InvariantInfo); mDayOfWeek = mDate.DayOfWeek.ToString(); mShortDate = mDate.ToShortDateString(); mLongDate = mDate.ToLongDateString(); mShortTime = mDate.ToShortTimeString(); mLongTime = mDate.ToLongTimeString(); if (format == null) { mFormattedTime = mDate.ToString(DateTimeFormatInfo.InvariantInfo); } else { mFormattedTime = mDate.ToString(format, DateTimeFormatInfo.InvariantInfo); } }
public static string[] GetTimeStamp(string _time) { long timeStamp = long.Parse(_time); System.DateTime dtStart = System.TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); long lTime = timeStamp * 10000000; System.TimeSpan toNow = new System.TimeSpan(lTime); System.DateTime dtResult = dtStart.Add(toNow); string date = dtResult.ToShortDateString().ToString(); string time = dtResult.ToString("HH:mm:ss"); string[] date_arr = date.Split('/'); string[] time_arr = time.Split(':'); string secondarr = time_arr[2]; char[] second = secondarr.ToCharArray(); string[] result = new string[] { date_arr[2] + "/" + date_arr[0] + "/" + date_arr[1], time_arr[0] + ":" + time_arr[1] + ":" + second[0] + second[1] }; return(result); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string queryString = WebUtils.GetQueryString("t"); string value = WebUtils.GetQueryString("st") + " 00:00:00"; string value2 = WebUtils.GetQueryString("dt") + " 23:59:59"; string queryString2 = WebUtils.GetQueryString("sy"); System.DateTime dateTime = WebUtils.GetDateTime(value, System.DateTime.Now.AddMonths(-1)); System.DateTime dateTime2 = WebUtils.GetDateTime(value2, System.DateTime.Now); if (queryString.Equals("getchart")) { DataTable trafficStat = Stat.GetTrafficStat(queryString2, dateTime, dateTime2); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append(string.Concat(new string[] { "<chart caption='", queryString2.Equals("year") ? "Thống kê lưu lượng hàng năm" : "Thống kê lưu lượng hàng tháng", "' subCaption='(", dateTime.ToShortDateString(), " - ", dateTime2.ToShortDateString(), ")' lineThickness='2' showValues='0' formatNumberScale='0' anchorRadius='2' divLineIsDashed='1' showAlternateHGridColor='1' shadowAlpha='40' labelStep='1' numvdivlines='5' bgColor='FFFFFF' bgAngle='270' bgAlpha='10,10' alternateHGridAlpha='5' alternateHGridColor='CC3300' divLineColor='CC3300' divLineAlpha='20' captionPadding='3' chartTopMargin='5' chartBottomMargin='10' chartLeftMargin='10' chartRightMargin='10' canvasBorderColor='FFCEBD' baseFontColor='000000' showBorder='0'>" })); if (queryString2.Equals("年")) { stringBuilder.Append("<categories>"); for (int i = dateTime.Year; i <= dateTime2.Year; i++) { stringBuilder.Append("<category label='năm " + i.ToString() + "' />"); } stringBuilder.Append("</categories>"); stringBuilder.Append("<dataset seriesName='P V' color='1D8BD1' anchorBorderColor='1D8BD1' anchorBgColor='1D8BD1'>"); for (int i = dateTime.Year; i <= dateTime2.Year; i++) { DataRow[] array = trafficStat.Select("Title='" + i.ToString() + "'"); string text = (array != null && array.Length > 0) ? array[0]["PV"].ToString() : "0"; stringBuilder.Append(string.Concat(new string[] { "<set value='", text, "' toolText='", i.ToString(), "Tổng số hàng năm ", text, " PV' />" })); } stringBuilder.Append("</dataset>"); stringBuilder.Append("<dataset seriesName='I P' color='F1683C' anchorBorderColor='F1683C' anchorBgColor='F1683C'>"); for (int i = dateTime.Year; i <= dateTime2.Year; i++) { DataRow[] array = trafficStat.Select("Title='" + i.ToString() + "'"); string text2 = (array != null && array.Length > 0) ? array[0]["IP"].ToString() : "0"; stringBuilder.Append(string.Concat(new string[] { "<set value='", text2, "' toolText='", i.ToString(), "Year total ", text2, " IP' />" })); } stringBuilder.Append("</dataset>"); } else if (queryString2.Equals("月")) { stringBuilder.Append("<categories>"); for (int i = 1; i <= 12; i++) { stringBuilder.Append("<category label='tháng " + i.ToString() + "' />"); } stringBuilder.Append("</categories>"); stringBuilder.Append("<dataset seriesName='P V' color='1D8BD1' anchorBorderColor='1D8BD1' anchorBgColor='1D8BD1'>"); for (int i = 1; i <= 12; i++) { DataRow[] array = trafficStat.Select("Title='" + i.ToString() + "'"); string text = (array != null && array.Length > 0) ? array[0]["PV"].ToString() : "0"; stringBuilder.Append(string.Concat(new string[] { "<set value='", text, "' toolText='", i.ToString(), "Tổng số hàng tháng ", text, " PV' />" })); } stringBuilder.Append("</dataset>"); stringBuilder.Append("<dataset seriesName='I P' color='F1683C' anchorBorderColor='F1683C' anchorBgColor='F1683C'>"); for (int i = 1; i <= 12; i++) { DataRow[] array = trafficStat.Select("Title='" + i.ToString() + "'"); string text2 = (array != null && array.Length > 0) ? array[0]["IP"].ToString() : "0"; stringBuilder.Append(string.Concat(new string[] { "<set value='", text2, "' toolText='", i.ToString(), "Tổng số hàng tháng ", text2, " IP' />" })); } stringBuilder.Append("</dataset>"); } stringBuilder.Append(" <styles><definition><style name='CaptionFont' type='font' size='14'/></definition><application><apply toObject='CAPTION' styles='CaptionFont' /><apply toObject='SUBCAPTION' styles='CaptionFont' /></application> </styles>"); stringBuilder.Append("</chart>"); context.Response.Write(stringBuilder.ToString()); } }
public static async Task <string> GetAccessPermissions() { bool Folderflag = false; var folderPicker = new FolderPicker(); folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop; folderPicker.FileTypeFilter.Add("*"); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; StorageFolder folder = await folderPicker.PickSingleFolderAsync(); foreach (var data in FaTokenDataAccess.GetData()) { if (data.Folder == folder.Path) { Folderflag = true; break; } } if (folder != null && !Folderflag) { // Add to MRU with metadata (For example, a string that represents the date) MruToken = Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList.Add(folder, currentTime.ToShortDateString()); // Add to FA without metadata FaToken = Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.Add(folder, currentTime.ToShortDateString()); } else { return("Operation cancelled."); } return(folder.Path); }
public string grabarEventoProfAsignados(Models.PlanifAgendaCat evento, string[] otrosProfesionales, bool confirmarBorrado) { int idEvento = 0; string result = ""; string sOtrosProfNoCita = ""; ArrayList aListCorreo = new ArrayList(); bool bDias = false; bool[] bDia = new bool[7]; bool bConTransaccion = false; Guid methodOwnerID = new Guid("C9762B5E-8973-4DFC-81A6-C233F3503749"); OpenDbConn(); if (cDblib.Transaction.ownerID.Equals(new Guid())) { bConTransaccion = true; } if (bConTransaccion) { cDblib.beginTransaction(methodOwnerID); } try { int idEventoProf = 0; ArrayList profesionalesNoCita = new ArrayList(); int idFicepiProf = 0; string codRedProf = ""; Models.ValidarTareaAgenda accesoATarea = new Models.ValidarTareaAgenda(); DAL.PlanifAgendaCat planifAgendaCatDAL = new DAL.PlanifAgendaCat(cDblib); DAL.PromotoresAgendaCat promotoresAgendaCatDAL = new DAL.PromotoresAgendaCat(cDblib); DAL.ValidarTareaAgenda validarTareaAgendaDAL = new DAL.ValidarTareaAgenda(cDblib); Models.PlanifAgendaCat newEvento; foreach (string oProf in otrosProfesionales) { string[] aProf = Regex.Split(oProf, "//"); idFicepiProf = int.Parse(aProf[0]); codRedProf = aProf[1]; //si la cita es a tarea, comprobar que el profesional tiene acceso a la tarea. if (evento.IdTarea != null) { accesoATarea = validarTareaAgendaDAL.Select(idFicepiProf, (int)evento.IdTarea); if (accesoATarea == null) { profesionalesNoCita.Add(idFicepiProf); if (sOtrosProfNoCita == "") { sOtrosProfNoCita = idFicepiProf.ToString(); } else { sOtrosProfNoCita += "," + idFicepiProf.ToString(); } continue; } } #region Control días de la semana bDia = evento.DiasSemana; if (Array.Exists(bDia, element => element == true)) { bDias = true; } #endregion if (bDias) { #region Una reserva cada día para el rango horario indicado newEvento = new Models.PlanifAgendaCat(); newEvento = duplicarEvento(evento); newEvento.Privado = ""; //El campo privado que ha escrito el interesado no se inserta a los otros profesionales. newEvento.Idficepi = idFicepiProf; //Se asigna el idficepi del profesional que se está tratando int nDiff = IB.SUPER.Shared.Fechas.DateDiff("day", evento.StartTime, evento.EndTime); for (int b = 0; b <= nDiff; b++) { //comprobar que el día a grabar está entre los días seleccionados System.DateTime dAux = evento.StartTime.AddDays(b); switch (dAux.DayOfWeek) { case System.DayOfWeek.Monday: if (bDia[0] == false) { continue; } break; case System.DayOfWeek.Tuesday: if (bDia[1] == false) { continue; } break; case System.DayOfWeek.Wednesday: if (bDia[2] == false) { continue; } break; case System.DayOfWeek.Thursday: if (bDia[3] == false) { continue; } break; case System.DayOfWeek.Friday: if (bDia[4] == false) { continue; } break; case System.DayOfWeek.Saturday: if (bDia[5] == false) { continue; } break; case System.DayOfWeek.Sunday: if (bDia[6] == false) { continue; } break; } //Si llega aquí es que hay que grabar los datos de la reserva para ese día. DateTime dFechaHoraFin = IB.SUPER.Shared.Fechas.crearDateTime(dAux.ToShortDateString(), evento.EndTime.ToShortTimeString()); //Antes de realizar la reserva, comprobar la disponibilidad; if (planifAgendaCatDAL.getDisponibilidad(newEvento.Idficepi, dAux, dFechaHoraFin, 0)) { //En caso de tener disponibilidad se inserta el evento en BBDD // y si hay necesidad de enviar correo, se crea el correo y se añade a la lista de correos newEvento.StartTime = dAux; newEvento.EndTime = dFechaHoraFin; idEventoProf = planifAgendaCatDAL.Insert(newEvento); newEvento.ID = idEventoProf; aListCorreo.Add(crearCorreo(newEvento, codRedProf)); } else { profesionalesNoCita.Add(idFicepiProf); if (sOtrosProfNoCita == "") { sOtrosProfNoCita = newEvento.Idficepi.ToString(); } else { sOtrosProfNoCita += "," + newEvento.Idficepi.ToString(); } break; } #endregion } //Fin de bucle de días } else { #region Una sola reserva para el rango desde la fecha de inicio a la de fin //Antes de realizar la reserva, comprobar la disponibilidad; newEvento = new Models.PlanifAgendaCat(); newEvento = duplicarEvento(evento); newEvento.Privado = ""; //El campo privado que ha escrito el interesado no se inserta a los otros profesionales. newEvento.Idficepi = idFicepiProf; //Se asigna el idficepi del profesional que se está tratando if (planifAgendaCatDAL.getDisponibilidad(newEvento.Idficepi, evento.StartTime, evento.EndTime, 0)) { //En caso de tener disponibilidad se inserta el evento en BBDD // y si hay necesidad de enviar correo, se crea el correo y se añade a la lista de correos idEventoProf = planifAgendaCatDAL.Insert(newEvento); newEvento.ID = idEventoProf; aListCorreo.Add(crearCorreo(newEvento, codRedProf)); } else { profesionalesNoCita.Add(idFicepiProf); if (sOtrosProfNoCita == "") { sOtrosProfNoCita = newEvento.Idficepi.ToString(); } else { sOtrosProfNoCita += "," + newEvento.Idficepi.ToString(); } } #endregion } //Fin de If (bDias) } //Fin de bucle de profesionales if (sOtrosProfNoCita != "") { throw new ValidationException(""); } if (bConTransaccion) { cDblib.commitTransaction(methodOwnerID); } } catch (ValidationException ex) { //rollback if (cDblib.Transaction.ownerID.Equals(new Guid())) { cDblib.rollbackTransaction(methodOwnerID); } if (sOtrosProfNoCita != "") { return(idEvento + "//" + sOtrosProfNoCita); } throw ex; } catch (Exception ex) { //rollback if (cDblib.Transaction.ownerID.Equals(new Guid())) { cDblib.rollbackTransaction(methodOwnerID); } throw new Exception("La planificación para el profesional ha sido realizada con éxito. Sin embargo, se ha producido un error en la programación de las citas de los profesionales asignados: " + ex.Message); } finally { } try { if (aListCorreo.Count > 0) { Correo.EnviarCorreosCita(aListCorreo); } } catch (Exception ex) { //sResul = "Error@#@" + Errores.mostrarError("Error al enviar el mail a los responsables del proyecto", ex); IB.SUPER.Shared.LogError.LogearError("Error al enviar los mails de convocatoria:", ex); } return("OK"); }
public int grabarEvento(Models.PlanifAgendaCat evento, bool confirmarBorrado) { bool bEnviarEmail = false; int idEvento = 0; bool errorControlado = false; ArrayList aListCorreo = new ArrayList(); bool bDias = false; bool[] bDia = new bool[7]; Models.PlanifAgendaCat oEvento; bool bConTransaccion = false; Guid methodOwnerID = new Guid("F35A931C-50C1-4FAA-B3AB-3819DE6E0C79"); OpenDbConn(); if (cDblib.Transaction.ownerID.Equals(new Guid())) { bConTransaccion = true; } if (bConTransaccion) { cDblib.beginTransaction(methodOwnerID); } try { DAL.PlanifAgendaCat planifAgendaCatDAL = new DAL.PlanifAgendaCat(cDblib); DAL.PromotoresAgendaCat promotoresAgendaCatDAL = new DAL.PromotoresAgendaCat(cDblib); evento.Idficepi = int.Parse(HttpContext.Current.Session["IDFICEPI_IAP"].ToString()); evento.IdficepiMod = int.Parse(HttpContext.Current.Session["IDFICEPI_IAP"].ToString()); //En caso de que el evento ya exista, hay que comprobar los datos que han sido modificados para //ver si es necesario enviar mail if (evento.ID != 0) { #region Update del evento oEvento = planifAgendaCatDAL.Select(evento.ID); //comprobación de si hay que comunicar el cambio if (evento.StartTime != oEvento.StartTime || evento.EndTime != oEvento.EndTime || (evento.IdTarea != -1 && evento.IdTarea != oEvento.IdTarea)) { bEnviarEmail = true; } //Se comprueba si el evento tiene dsponibilidad o no if (planifAgendaCatDAL.getDisponibilidad(evento.Idficepi, evento.StartTime, evento.EndTime, evento.ID)) { //En caso de tener disponibilidad se actualiza el evento en BBDD // y si hay necesidad de enviar correo, se crea el correo y se añade a la lista de correos if (bEnviarEmail) { evento.IdficepiMod = int.Parse(HttpContext.Current.Session["IDFICEPI_ENTRADA"].ToString()); } idEvento = planifAgendaCatDAL.Update(evento); if (bEnviarEmail) { aListCorreo.Add(crearCorreoMod(evento, oEvento, null)); } } //Si no tiene disponibilidad se manda un mensaje de error else { throw new ValidationException("Cita denegada por solapamiento. Revisa el mapa de citas."); } #endregion } //El evento no existe, se debe hacer un Insert en BBDD else { #region insert del evento #region Control días de la semana bDia = evento.DiasSemana; if (Array.Exists(bDia, element => element == true)) { bDias = true; } #endregion if (bDias) { #region Una reserva cada día para el rango horario indicado Models.PlanifAgendaCat newEvento = new Models.PlanifAgendaCat(); newEvento = duplicarEvento(evento); int nDiff = IB.SUPER.Shared.Fechas.DateDiff("day", evento.StartTime, evento.EndTime); for (int b = 0; b <= nDiff; b++) { //comprobar que el día a grabar está entre los días seleccionados System.DateTime dAux = evento.StartTime.AddDays(b); switch (dAux.DayOfWeek) { case System.DayOfWeek.Monday: if (bDia[0] == false) { continue; } break; case System.DayOfWeek.Tuesday: if (bDia[1] == false) { continue; } break; case System.DayOfWeek.Wednesday: if (bDia[2] == false) { continue; } break; case System.DayOfWeek.Thursday: if (bDia[3] == false) { continue; } break; case System.DayOfWeek.Friday: if (bDia[4] == false) { continue; } break; case System.DayOfWeek.Saturday: if (bDia[5] == false) { continue; } break; case System.DayOfWeek.Sunday: if (bDia[6] == false) { continue; } break; } //Si llega aquí es que hay que grabar los datos de la reserva para ese día. DateTime dFechaHoraFin = IB.SUPER.Shared.Fechas.crearDateTime(dAux.ToShortDateString(), evento.EndTime.ToShortTimeString()); //Antes de realizar la reserva, comprobar la disponibilidad; if (planifAgendaCatDAL.getDisponibilidad(evento.Idficepi, dAux, dFechaHoraFin, 0)) { //En caso de tener disponibilidad se inserta el evento en BBDD // y si hay necesidad de enviar correo, se crea el correo y se añade a la lista de correos newEvento.StartTime = dAux; newEvento.EndTime = dFechaHoraFin; newEvento.IdficepiMod = int.Parse(HttpContext.Current.Session["IDFICEPI_ENTRADA"].ToString()); idEvento = planifAgendaCatDAL.Insert(newEvento); newEvento.ID = idEvento; aListCorreo.Add(crearCorreo(newEvento, null)); } else { if (evento.Idficepi != (int)HttpContext.Current.Session["IDFICEPI_ENTRADA"]) { throw new Exception("Cita denegada por solapamiento. Revisa el mapa de citas."); } if (!confirmarBorrado) { Models.PromotoresAgendaCat oPromotoresAgendaCat = new Models.PromotoresAgendaCat(); List <Models.PromotoresAgendaCat> listaPromotoresEvento = new List <Models.PromotoresAgendaCat>(); oPromotoresAgendaCat.t458_idPlanif = 0; oPromotoresAgendaCat.t458_fechoraini = dAux; oPromotoresAgendaCat.t458_fechorafin = dFechaHoraFin; oPromotoresAgendaCat.t001_idficepi = evento.Idficepi; listaPromotoresEvento = promotoresAgendaCatDAL.Catalogo(oPromotoresAgendaCat); foreach (Models.PromotoresAgendaCat oProm in listaPromotoresEvento) { if (oProm.t001_idficepi_mod == evento.Idficepi) { throw new Exception("Cita denegada por solapamiento. Revisa el mapa de citas."); } } errorControlado = true; throw new Exception(""); } else { //Hay que borrar las citas solapadas. Models.PromotoresAgendaCat oPromotoresAgendaCat = new Models.PromotoresAgendaCat(); List <Models.PromotoresAgendaCat> listaPromotoresEvento = new List <Models.PromotoresAgendaCat>(); oPromotoresAgendaCat.t458_idPlanif = 0; oPromotoresAgendaCat.t458_fechoraini = dAux; oPromotoresAgendaCat.t458_fechorafin = dFechaHoraFin; oPromotoresAgendaCat.t001_idficepi = evento.Idficepi; listaPromotoresEvento = promotoresAgendaCatDAL.Catalogo(oPromotoresAgendaCat); Models.PlanifAgendaCat eventoEliminar; foreach (Models.PromotoresAgendaCat oProm in listaPromotoresEvento) { eventoEliminar = new Models.PlanifAgendaCat(); eventoEliminar.ID = oProm.t458_idPlanif; eventoEliminar.IdficepiMod = oProm.t001_idficepi_mod; eventoEliminar.StartTime = oProm.t458_fechoraini; eventoEliminar.EndTime = oProm.t458_fechorafin; eventoEliminar.Motivo = oProm.Motivo; eventoEliminar.Profesional = oProm.Profesional; eventoEliminar.CodRedPromotor = oProm.t001_codred_promotor; planifAgendaCatDAL.Delete(eventoEliminar.ID); aListCorreo.Add(crearCorreoEliminacionEventoPorSolapamiento(eventoEliminar)); } //Una vez eliminados los eventos que generan los solapamientos se procede a insertar el evento newEvento.StartTime = dAux; newEvento.EndTime = dFechaHoraFin; newEvento.IdficepiMod = int.Parse(HttpContext.Current.Session["IDFICEPI_ENTRADA"].ToString()); newEvento.ID = planifAgendaCatDAL.Insert(newEvento); aListCorreo.Add(crearCorreo(newEvento, null)); } } } #endregion if (idEvento == 0) { throw new ValidationException("Las fechas y/o los días de repetición seleccionados no son correctos"); } } else { #region Una sola reserva para el rango desde la fecha de inicio a la de fin //Antes de realizar la reserva, comprobar la disponibilidad; if (planifAgendaCatDAL.getDisponibilidad(evento.Idficepi, evento.StartTime, evento.EndTime, 0)) { //En caso de tener disponibilidad se inserta el evento en BBDD // y si hay necesidad de enviar correo, se crea el correo y se añade a la lista de correos evento.IdficepiMod = int.Parse(HttpContext.Current.Session["IDFICEPI_ENTRADA"].ToString()); idEvento = planifAgendaCatDAL.Insert(evento); evento.ID = idEvento; aListCorreo.Add(crearCorreo(evento, null)); } else { if (evento.Idficepi != (int)HttpContext.Current.Session["IDFICEPI_ENTRADA"]) { throw new Exception("Cita denegada por solapamiento. Revisa el mapa de citas."); } if (!confirmarBorrado) { Models.PromotoresAgendaCat oPromotoresAgendaCat = new Models.PromotoresAgendaCat(); List <Models.PromotoresAgendaCat> listaPromotoresEvento = new List <Models.PromotoresAgendaCat>(); oPromotoresAgendaCat.t458_idPlanif = 0; oPromotoresAgendaCat.t458_fechoraini = evento.StartTime; oPromotoresAgendaCat.t458_fechorafin = evento.EndTime; oPromotoresAgendaCat.t001_idficepi = evento.Idficepi; listaPromotoresEvento = promotoresAgendaCatDAL.Catalogo(oPromotoresAgendaCat); foreach (Models.PromotoresAgendaCat oProm in listaPromotoresEvento) { if (oProm.t001_idficepi_mod == evento.Idficepi) { break; } } errorControlado = true; throw new Exception(""); } //En caso de que el usuario haya decidido eliminar las citas que solapan la cita actual, se procede al borrado else { //Hay que borrar las citas solapadas. Models.PromotoresAgendaCat oPromotoresAgendaCat = new Models.PromotoresAgendaCat(); List <Models.PromotoresAgendaCat> listaPromotoresEvento = new List <Models.PromotoresAgendaCat>(); oPromotoresAgendaCat.t458_idPlanif = 0; oPromotoresAgendaCat.t458_fechoraini = evento.StartTime; oPromotoresAgendaCat.t458_fechorafin = evento.EndTime; oPromotoresAgendaCat.t001_idficepi = evento.Idficepi; listaPromotoresEvento = promotoresAgendaCatDAL.Catalogo(oPromotoresAgendaCat); Models.PlanifAgendaCat eventoEliminar; foreach (Models.PromotoresAgendaCat oProm in listaPromotoresEvento) { eventoEliminar = new Models.PlanifAgendaCat(); eventoEliminar.ID = oProm.t458_idPlanif; eventoEliminar.IdficepiMod = oProm.t001_idficepi_mod; eventoEliminar.StartTime = oProm.t458_fechoraini; eventoEliminar.EndTime = oProm.t458_fechorafin; eventoEliminar.Motivo = oProm.Motivo; eventoEliminar.Profesional = oProm.Profesional; eventoEliminar.CodRedPromotor = oProm.t001_codred_promotor; planifAgendaCatDAL.Delete(eventoEliminar.ID); aListCorreo.Add(crearCorreoEliminacionEventoPorSolapamiento(eventoEliminar)); } //Una vez eliminados los eventos que generan los solapamientos se procede a insertar el evento evento.IdficepiMod = int.Parse(HttpContext.Current.Session["IDFICEPI_ENTRADA"].ToString()); idEvento = planifAgendaCatDAL.Insert(evento); evento.ID = idEvento; aListCorreo.Add(crearCorreo(evento, null)); } } #endregion } #endregion } if (bConTransaccion) { cDblib.commitTransaction(methodOwnerID); } } catch (ValidationException ex) { //rollback if (cDblib.Transaction.ownerID.Equals(new Guid())) { cDblib.rollbackTransaction(methodOwnerID); } throw ex; } catch (Exception ex) { //rollback if (cDblib.Transaction.ownerID.Equals(new Guid())) { cDblib.rollbackTransaction(methodOwnerID); } if (!errorControlado) { throw ex; } return(-1); } finally { } try { if (aListCorreo.Count > 0) { Correo.EnviarCorreosCita(aListCorreo); } } catch (Exception ex) { //sResul = "Error@#@" + Errores.mostrarError("Error al enviar el mail a los responsables del proyecto", ex); IB.SUPER.Shared.LogError.LogearError("Error al enviar los mails de convocatoria:", ex); } return(idEvento); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = AppSettings.MouseDefaultMoveTime; Keyboard.DefaultKeyPressTime = AppSettings.KeyboardDefaultKeyPressTime; Delay.SpeedFactor = 1.0; CreateEducatorRepo repo = CreateEducatorRepo.Instance; //e.g. admin.release.lynda.com/welcome.aspx string url = string.Format("admin.{0}/welcome.aspx", AppSettings.Domain); Browser browser = new Browser(AppSettings.Browser, url, true); //Deal with security warning per Browser switch (AppSettings.Browser) { case BrowserProduct.IE: { repo.DOM.IECertificateErrorPage.OverrideLink.Click(); break; } case BrowserProduct.Firefox: { Validate.Exists(repo.DOM.FirefoxUntrustedConnectionPage.IUnderstandTheRisks); repo.DOM.FirefoxUntrustedConnectionPage.IUnderstandTheRisks.Click(); Validate.Exists(repo.DOM.FirefoxUntrustedConnectionPage.AddExceptionButton); repo.DOM.FirefoxUntrustedConnectionPage.AddExceptionButton.Click(); //Make sure the check box exists before seeing if it is checked, //otherwise .Checked can return the incorrect result if the check box is not enabled yet in the dialog. Validate.Exists(repo.AddSecurityExceptionDialogFirefox.PermanentlyStoreThisExceptionCheckBoxChecked); if (repo.AddSecurityExceptionDialogFirefox.PermanentlyStoreThisExceptionCheckBoxChecked.Checked) { //Uncheck the box if it's checked repo.AddSecurityExceptionDialogFirefox.PermanentlyStoreThisExceptionCheckBoxChecked.Click(); } Validate.Exists(repo.AddSecurityExceptionDialogFirefox.ConfirmSecurityExceptionButton); repo.AddSecurityExceptionDialogFirefox.ConfirmSecurityExceptionButton.Click(); break; } case BrowserProduct.Safari: { repo.ReviewCoursesConfirmDialogSafari.ContinueButton.Click(); break; } case BrowserProduct.Chrome: { //Handle Chrome "This is probably not the site you are looking for!" page //Ranorex doesn't support this page yet. //Click navigate edit box then tab to "Proceed anyway" button and press Enter for now. Text navigateEditBox = "/form[@title='SSL Error - Google Chrome']/element/text[@accessiblename='Address']"; Validate.Exists(navigateEditBox); navigateEditBox.Click(); Keyboard.Press(System.Windows.Forms.Keys.Tab); Keyboard.Press("{Enter}"); break; } default: throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString())); } //Login repo.DOM.AdminWelcomePageNotLoggedIn.UsernameInput.PressKeys("knvirtualuser7"); repo.DOM.AdminWelcomePageNotLoggedIn.PasswordInput.PressKeys("lynda1"); repo.DOM.AdminWelcomePageNotLoggedIn.LoginInput.Click(); //Deal with already logged in dialog (if it appears) //"Hello Keynote Virtualuser!You are currently logged in to your lynda.com account at another computer. //Would you like to log off the other computer and login to your account on this computer?" switch (AppSettings.Browser) { case BrowserProduct.Chrome: { if (Validate.Exists(repo.CurrentlyLoggedInDialogChrome.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogChrome.HelloTextInfo.SearchTimeout, "{0}", new Validate.Options(false, ReportLevel.Info))) { repo.CurrentlyLoggedInDialogChrome.OKButton.Click(); } else { Report.Info("Chrome Already Logged In dialog not found, so no need to handle."); } break; } case BrowserProduct.IE: { if (Validate.Exists(repo.CurrentlyLoggedInDialogIE.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogIE.HelloTextInfo.SearchTimeout, "{0}", new Validate.Options(false, ReportLevel.Info))) { repo.CurrentlyLoggedInDialogIE.OKButton.Click(); } else { Report.Info("IE Already Logged In dialog not found, so no need to handle."); } break; } case BrowserProduct.Firefox: { if (Validate.Exists(repo.CurrentlyLoggedInDialogFirefox.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogFirefox.HelloTextInfo.SearchTimeout, "{0}", new Validate.Options(false, ReportLevel.Info))) { Validate.Exists(repo.CurrentlyLoggedInDialogFirefox.OKButton); repo.CurrentlyLoggedInDialogFirefox.OKButton.Click(); } else { Report.Info("Firefox Already Logged In dialog not found, so no need to handle."); } break; } case BrowserProduct.Safari: { if (Validate.Exists(repo.CurrentlyLoggedInDialogSafari.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogSafari.HelloTextInfo.SearchTimeout, "{0}", new Validate.Options(false, ReportLevel.Info))) { repo.CurrentlyLoggedInDialogSafari.OKButton.Click(); //Workaround for bug where you click on the CS menu after clicking OK to the above dialog and the CS page doesn't appear; //workaround is to click the CS menu here before it is clicked again after this switch code block. Validate.Exists(repo.DOM.AdminWelcomePageLoggedIn.WelcomeMessage); Validate.Exists(repo.DOM.AdminHeaderMenusAbstractPage.CSmenu); repo.DOM.AdminHeaderMenusAbstractPage.CSmenu.Click(); Report.Info("Clicking CS menu to workaround bug where the CS page doesn't appear on the first click. Bug http://bugzilla.ldcint.com/bugzilla/show_bug.cgi?id=11318"); } else { Report.Info("Safari Already Logged In dialog not found, so no need to handle."); } break; } default: throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString())); } //Validate on Welcome page Validate.Exists(repo.DOM.AdminWelcomePageLoggedIn.WelcomeMessage); //Click CS Validate.Exists(repo.DOM.AdminHeaderMenusAbstractPage.CSmenu); repo.DOM.AdminHeaderMenusAbstractPage.CSmenu.Click(); //Click New Account repo.DOM.AdminHeaderMenusAbstractPage.CSmenuNewAccount.Click(); //Select Educator Radio repo.DOM.AdminCSNewAccountPage.EducatorRadio.Click(); //Select Regular Radio Validate.Exists(repo.DOM.AdminCSNewAccountPage.RegularRadio); repo.DOM.AdminCSNewAccountPage.RegularRadio.Click(); //Click continue repo.DOM.AdminCSNewAccountPage.ContinueButton.Click(); //Fill-out Educator Registration step 1 page SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep1Page.CountrySelect, "United States"); repo.DOM.AdminCSRegStep1Page.FirstNameInput.PressKeys("Testfirstname"); repo.DOM.AdminCSRegStep1Page.LastNameInput.PressKeys("Testlastname"); repo.DOM.AdminCSRegStep1Page.PositionTitleInput.PressKeys("tester"); repo.DOM.AdminCSRegStep1Page.DepartmentInput.PressKeys("testDepartment"); repo.DOM.AdminCSRegStep1Page.SchoolInput.PressKeys("testSchool"); repo.DOM.AdminCSRegStep1Page.PhoneInput.PressKeys("5555555555"); string username, email; const string password = "******"; FormDataAccount.GenerateUsernameEmail(out username, out email); email = string.Format("edu{0}", email); username = string.Format("edu{0}", username); repo.DOM.AdminCSRegStep1Page.EmailInput.PressKeys(email); Report.Info(string.Format("Entering username:{0}", username)); repo.DOM.AdminCSRegStep1Page.UsernameInput.PressKeys(username); repo.DOM.AdminCSRegStep1Page.PasswordInput.PressKeys(password); repo.DOM.AdminCSRegStep1Page.PasswordConfirmInput.PressKeys(password); Validate.Exists(repo.DOM.AdminCSRegStep1Page.ContinueButton); repo.DOM.AdminCSRegStep1Page.ContinueButton.Click(); //Fill-out step 2 page repo.DOM.AdminCSRegStep2Page.ClassNameInput.PressKeys("classTest"); repo.DOM.AdminCSRegStep2Page.ClassIDInput.PressKeys("1"); System.DateTime startDateTime = System.DateTime.Now; string shortStartDateTime = startDateTime.ToShortDateString(); System.DateTime endDateTime = startDateTime.AddDays(7); string shortEndDateTime = endDateTime.ToShortDateString(); repo.DOM.AdminCSRegStep2Page.StartDateInput.PressKeys(shortStartDateTime); repo.DOM.AdminCSRegStep2Page.EndDateInput.PressKeys(shortEndDateTime); Validate.Exists(repo.DOM.AdminCSRegStep2Page.ContinueButton); repo.DOM.AdminCSRegStep2Page.ContinueButton.Click(); //step3 page Validate.Exists(repo.DOM.AdminCSRegStep3Page.AddCourseButton); repo.DOM.AdminCSRegStep3Page.AddCourseButton.Click(); //Verify table appears Validate.Exists(repo.DOM.AdminCSRegStep3Page.CoursesTableColumn); //Click Continue Validate.Exists(repo.DOM.AdminCSRegStep3Page.ContinueButton); repo.DOM.AdminCSRegStep3Page.ContinueButton.Click(); //Click OK in review courses dialog switch (AppSettings.Browser) { case BrowserProduct.IE: { Validate.Exists(repo.ReviewCoursesConfirmDialogIE.OKButton); Validate.IsTrue(repo.ReviewCoursesConfirmDialogIE.OKButton.Visible); repo.ReviewCoursesConfirmDialogIE.OKButton.Click(); break; } case BrowserProduct.Firefox: { Validate.Exists(repo.ReviewCoursesConfirmDialogFirefox.OKButton); Validate.IsTrue(repo.ReviewCoursesConfirmDialogFirefox.OKButton.Visible); repo.ReviewCoursesConfirmDialogFirefox.OKButton.Click(); break; } case BrowserProduct.Safari: { Validate.Exists(repo.ReviewCoursesConfirmDialogSafari.OKButton); Validate.IsTrue(repo.ReviewCoursesConfirmDialogSafari.OKButton.Visible); repo.ReviewCoursesConfirmDialogSafari.OKButton.Click(); break; } case BrowserProduct.Chrome: { Validate.Exists(repo.ReviewCoursesConfirmDialogChrome.OKButton); Validate.IsTrue(repo.ReviewCoursesConfirmDialogChrome.OKButton.Visible); repo.ReviewCoursesConfirmDialogChrome.OKButton.Click(); break; } default: throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString())); } //step 4 page string usernameNotUsed, studentEmail; FormDataAccount.GenerateUsernameEmail(out usernameNotUsed, out studentEmail); string studentFirstName = "testStudentFirst"; string studentLastName = "testStudentLast"; repo.DOM.AdminCSRegStep4Page.FirstNameInput.PressKeys(studentFirstName); repo.DOM.AdminCSRegStep4Page.LastNameInput.PressKeys(studentLastName); repo.DOM.AdminCSRegStep4Page.EmailInput.PressKeys(studentEmail); repo.DOM.AdminCSRegStep4Page.AddStudentButton.Click(); //Verify table appears Validate.Exists(repo.DOM.AdminCSRegStep4Page.StudentNameTableColumn); //Click Continue Validate.Exists(repo.DOM.AdminCSRegStep4Page.ContinueButton); repo.DOM.AdminCSRegStep4Page.ContinueButton.Click(); //step 5 page repo.DOM.AdminCSRegStep5Page.PaidBySchoolRadio.Click(); SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.PaymentTypeSelect, "Credit Card"); //billing info... repo.DOM.AdminCSRegStep5Page.BillingAddressInput.PressKeys("6410 via real"); repo.DOM.AdminCSRegStep5Page.BillingAptSuiteInput.PressKeys("test"); repo.DOM.AdminCSRegStep5Page.BillingCityInput.PressKeys("carpintera"); SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.BillingStateSelect, "California"); repo.DOM.AdminCSRegStep5Page.BillingZipInput.PressKeys("93013"); //credit card info... SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.CardTypeSelect, "Visa"); repo.DOM.AdminCSRegStep5Page.CardNumberInput.PressKeys("4111111111111111"); repo.DOM.AdminCSRegStep5Page.CardNameInput.PressKeys("Sue Axelband"); repo.DOM.AdminCSRegStep5Page.CardCodeInput.PressKeys("670"); SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.CardMonthSelect, "08 - August"); SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.CardYearSelect, "2012"); //sales info... SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.SalesRep1Select, "Donna Gill"); SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.SalesOperationTypeSelect, "New"); //click continue Validate.Exists(repo.DOM.AdminCSRegStep5Page.ContinueButton); repo.DOM.AdminCSRegStep5Page.ContinueButton.Click(); //step 6 page. Validate.AreEqual(string.Compare(repo.DOM.AdminCSRegStep6Page.StudentEmail.InnerText.Trim(), studentEmail, false), 0, "Actual:{0} Expected:{1}" + string.Format(" Actual:{0} Expected:{1}", repo.DOM.AdminCSRegStep6Page.StudentEmail.InnerText, studentEmail), true); //repo.DOM.AdminCSRegStep6Page.StudentName e.g. "testStudentFirst testStudentLast" string patternExpectedPageStudentName = String.Format(@"^{0} {1}$", studentFirstName, studentLastName); string expectedPageStudentName = string.Format("{0} {1}", studentFirstName, studentLastName); string actualPageStudentName = repo.DOM.AdminCSRegStep6Page.StudentName.InnerText.Trim(); if (!Regex.IsMatch(actualPageStudentName, patternExpectedPageStudentName)) { throw new Ranorex.ValidationException(string.Format("Student Name. Actual:\"{0}\" Expected:\"{1}\"", actualPageStudentName, expectedPageStudentName)); } Validate.Exists(repo.DOM.AdminCSRegStep6Page.ApproveNowButton); repo.DOM.AdminCSRegStep6Page.ApproveNowButton.Click(); //reg confirmation page. Click continue. Validate.Exists(repo.DOM.AdminCSRegConfirmPage.ContinueButton); repo.DOM.AdminCSRegConfirmPage.ContinueButton.Click(); //Wait for Customer Details page. Validate.Exists(repo.DOM.AdminDisplayCustomerPage.CustomerDetailsText); //click logout on customer details display customer page Validate.Exists(repo.DOM.AdminHeaderMenusAbstractPage.LogoutButton); repo.DOM.AdminHeaderMenusAbstractPage.LogoutButton.Click(); //Wait for login button to appear to signify logout completion Validate.Exists(repo.DOM.AdminWelcomePageNotLoggedIn.LoginInput); //login and handle terms and conditions page browser.Navigate(string.Format("{0}", AppSettings.Domain)); Validate.Exists(repo.DOM.MemberHomePage.LoginLink); repo.DOM.MemberHomePage.LoginLink.Click(); Validate.Exists(repo.DOM.MemberHomePage.LoginUsername); repo.DOM.MemberHomePage.LoginUsername.PressKeys(username); repo.DOM.MemberHomePage.LoginPassword.PressKeys(password); repo.DOM.MemberHomePage.LoginButton.Click(); Duration waitForAcceptButtonNotExistTime = new Duration(10000); switch (AppSettings.Browser) { case BrowserProduct.IE: { Validate.Exists(repo.TermsAndConditionsPageIE.IAcceptButton); repo.TermsAndConditionsPageIE.IAcceptButton.EnsureVisible(); repo.TermsAndConditionsPageIE.IAcceptButton.Click(); repo.TermsAndConditionsPageIE.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime); break; } case BrowserProduct.Firefox: { Validate.Exists(repo.TermsAndConditionsPageFirefox.IAcceptButton); repo.TermsAndConditionsPageFirefox.IAcceptButton.EnsureVisible(); repo.TermsAndConditionsPageFirefox.IAcceptButton.Click(); repo.TermsAndConditionsPageFirefox.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime); break; } case BrowserProduct.Safari: { Validate.Exists(repo.TermsAndConditionsPageSafari.IAcceptButton); repo.TermsAndConditionsPageSafari.IAcceptButton.EnsureVisible(); repo.TermsAndConditionsPageSafari.IAcceptButton.Click(); repo.TermsAndConditionsPageSafari.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime); //Due to issue with Ranorex with Safari in identifying the DOM at this point, //navigate to member home page a couple of times so the DOM is visible. for (int i = 0; i <= 1; i++) { browser.Navigate(string.Format("{0}", AppSettings.Domain)); } break; } case BrowserProduct.Chrome: { Validate.Exists(repo.TermsAndConditionsPageChrome.IAcceptButton); repo.TermsAndConditionsPageChrome.IAcceptButton.EnsureVisible(); repo.TermsAndConditionsPageChrome.IAcceptButton.Click(); repo.TermsAndConditionsPageChrome.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime); break; } default: throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString())); } //Verify now on member home page; "My courses" shows. Validate.Exists(repo.DOM.MemberHomePage.MyCoursesText); //Click log out link. Validate.Exists(repo.DOM.MemberHomePage.LogoutLink); repo.DOM.MemberHomePage.LogoutLink.Click(); //Verify logout complete; check for login link Validate.Exists(repo.DOM.MemberHomePage.LoginLink); }
public override string ToString() { return("Mark Id: " + Mark_Id + " Value: " + Value + " Weight: " + Weight.GetValueOrDefault() + " Pupil Id: " + Pupil_Id + " Employee Id: " + Employee_Id + " Subject Id: " + Subject_Id + " Describe: " + Describe + " Mark date: " + Mark_Date.ToShortDateString()); }
public override string ToString() { return(fam + " " + name + " was born on " + date.ToShortDateString()); }
void UpdateLocDisp() { if (Input.location == null) { Status.text = "Input.location was null"; return; } if (Input.location.status == LocationServiceStatus.Failed) { Status.text = "Input.location failed"; return; } if (Input.location.status != LocationServiceStatus.Running) { Status.text = string.Format("Input.location.status was not running, status={0}", Input.location.status); return; } Status.text = string.Format( "Running... (x,y) = ({0}, {1})", MapUtils.LonToX(Input.location.lastData.longitude), MapUtils.LatToY(Input.location.lastData.latitude) ); System.DateTime dt = Locator.UnixTimeStampToDateTime(Input.location.lastData.timestamp); int lblCols = 0; LastUpdate.text = string.Format("{0}: {1} {2}", "Last Update".PadLeft(lblCols), dt.ToShortDateString(), dt.ToLongTimeString()); Altitude.text = string.Format("{0}: {1:N7}", "Altitude".PadLeft(lblCols), Input.location.lastData.altitude); Latitude.text = string.Format("{0}: {1:N7}", "Latitude".PadLeft(lblCols), Input.location.lastData.latitude); Longitude.text = string.Format("{0}: {1:N7}", "Longitude".PadLeft(lblCols), Input.location.lastData.longitude); Accuracy_Horiz.text = string.Format("{0}: {1}", "Horizontal Acc".PadLeft(lblCols), Input.location.lastData.horizontalAccuracy); Accuracy_Vert.text = string.Format("{0}: {1}", "Vertical Acc".PadLeft(lblCols), Input.location.lastData.verticalAccuracy); }
// Use this for initialization IEnumerator MyCandleProgram() { // implememt WWW to get json data from any url string url = "https://poloniex.com/public?command=returnChartData¤cyPair=USDT_LTC&start=1483228801&end=1514764801&period=86400"; WWW www = new WWW(url); yield return(www); // store text in www to json string if (string.IsNullOrEmpty(www.error)) { jsonData = www.text; } // use simpleJSON to get values stored in JSON data for different key value pair JSONNode jsonNode = SimpleJSON.JSON.Parse(jsonData); // get values at the nodes, to get values at node either use the name directly or the position number of the node // here instead of "Department", you can also write jsonNode[0][0] Debug.Log("Department 0 " + jsonNode[0].ToString()); Debug.Log("Department 1 " + jsonNode[1].ToString()); // get individual values from Department 0 to 40 while (loopIncrementer < 365) { loopIncrementer++; high_list.Add(jsonNode[loopIncrementer]["high"].ToString()); low_list.Add(jsonNode[loopIncrementer]["low"].ToString()); open_list.Add(jsonNode[loopIncrementer]["open"].ToString()); close_list.Add(jsonNode[loopIncrementer]["close"].ToString()); date_list.Add(jsonNode[loopIncrementer]["date"].ToString()); vol_list.Add(jsonNode[loopIncrementer]["quoteVolume"].ToString()); } // First make a System.DateTime equivalent to the UNIX Epoch. System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); // Add the number of seconds in UNIX timestamp to be converted. dateTime = dateTime.AddSeconds(myDate); // The dateTime now contains the right date/time so to format the string, // use the standard formatting methods of the DateTime object. string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString(); // Print the date and time Debug.Log(printDate); for (int i = 0, j = 0; i < 365; i++, j++) { lenngthOfStick = float.Parse(high_list[i]) - float.Parse(low_list[i]); widthOfStick = float.Parse(vol_list[i]); Wick.transform.localScale = new Vector3(0.3f, lenngthOfStick * 3, 0.2f); Instantiate(Wick, new Vector3(j * x, float.Parse(low_list[i]), 0), Quaternion.identity); // TextMe.GetComponent<TextMesh>().text = i + ""; //Instantiate(TextMe, new Vector3(j * x, 0, -2.0f), Quaternion.identity); openList = float.Parse(open_list[i]); closeList = float.Parse(close_list[i]); volList = float.Parse(vol_list[i]); volList1 = float.Parse(vol_list[i]); if (openList < closeList) // green { GreenLength = closeList - openList; GreenWidth = volList; Candle_Green.transform.localScale = new Vector3(1, GreenLength * 3, GreenWidth / 10000); Instantiate(Candle_Green, new Vector3(j * x, float.Parse(open_list[i]), 0), Quaternion.identity); } if (openList > closeList) // red { RedLength = openList - closeList; RedWidth = volList1; Candle_Red.transform.localScale = new Vector3(1, RedLength * 3, RedWidth / 10000); Instantiate(Candle_Red, new Vector3(j * x, float.Parse(close_list[i]), 0), Quaternion.identity); } } }
public override string ToString() { return ( m_dtCalcOrderDate.ToShortDateString() + " " + m_strNum ); }
public override string ToString() { return ( m_strNum + " (год: " + m_iYear.ToString() + ", месяц: " + m_iMonth.ToString() + " от " + m_dtSalePrognosisDate.ToShortDateString() + ")" ); }
private static Task GetTask(Process process) { string cpuMeasure = TryToGetCpuMeasure(process).ToString(); dynamic extraProcessInfo = ProcessExtraInfoLoader.GetProcessExtraInformation(process.Id); long ramBytes = process.PagedMemorySize64; string ramPercentage = TryToGetRamPercentage(ramBytes); string ramMeasure = TryToGetRamMeasure(ramBytes); string processOwner = TryToGetProcessOwner(extraProcessInfo); DateTime startDateTime = TryToGetDateTime(process); Task task = new Task(process.ProcessName, process.Id, process.Responding, cpuMeasure, ramPercentage, ramMeasure, process.Threads.Count, processOwner, startDateTime.ToShortDateString()); return(task); }