/// <summary> /// The check nth weekday by month. /// </summary> /// <param name="weekday"> /// The weekday. /// </param> /// <param name="nthWeekday"> /// The nth Weekday. /// </param> /// <param name="currentDate"> /// The current Date. /// </param> /// <returns> /// Check if the current day of week is correct. /// </returns> private bool CheckNthWeekdayByMonth(Weekdays weekday, WeekdaySequences nthWeekday, DateTime currentDate) { var dates = this.GetDates(currentDate.Year, currentDate.Month) .Where(date => date.DayOfWeek.ToString() == weekday.ToString()) .ToList(); switch (nthWeekday) { case WeekdaySequences.First: return(dates[((int)WeekdaySequences.First - 1)] == currentDate); case WeekdaySequences.Second: return(dates[((int)WeekdaySequences.Second - 1)] == currentDate); case WeekdaySequences.Third: return(dates[((int)WeekdaySequences.Third - 1)] == currentDate); case WeekdaySequences.Fourth: return(dates[((int)WeekdaySequences.Fourth - 1)] == currentDate); case WeekdaySequences.Last: return(dates[dates.Count() - 1] == currentDate); } return(false); }
static void Main(string[] args) { int dag = 2; Weekdays d2 = (Weekdays)3; Console.WriteLine(d2); }
public static Weekdays Map(WeekdaysViewModel weekdays) { if (weekdays == null || !weekdays.PriceReductions.Any()) { return(null); } var result = new Weekdays(); var reductions = new List <PriceReduction>(); var red = weekdays.PriceReductions.Distinct().ToList(); for (int i = 0; i < red.Count(); i++) { reductions.Add(new PriceReduction { Number = i, Amount = red[i] }); } result.PriceReductions = reductions; result.Monday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[0]).Number; result.Tuesday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[1]).Number; result.Wednesday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[2]).Number; result.Thursday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[3]).Number; result.Friday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[4]).Number; result.Saturday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[5]).Number; result.Sunday = reductions.FirstOrDefault(c => c.Amount == weekdays.PriceReductions[6]).Number; result.Total = reductions.Count(); return(result); }
public void Count_SameDate_Inclusive_One() { DateTime date = new(2020, 1, 1); // Wednesday int count = Weekdays.Count(date, date, true); Assert.Equal(1, count); }
/// <summary> /// Gets the name of the weekday in Persian. /// </summary> /// <param name="w">The weekday to get its name</param> /// <returns></returns> public static string GetPersianWeekdayName(Weekdays w) { switch (w) { case Weekdays.Sat: return(Shanbeh); case Weekdays.Sun: return(Yekshanbeh); case Weekdays.Mon: return(Doshanbeh); case Weekdays.Tue: return(Seshanbeh); case Weekdays.Wed: return(Chaharshanbeh); case Weekdays.Thu: return(Panjshanbeh); case Weekdays.Fri: return(Jomeh); case Weekdays.Illeagal: default: return(""); } }
public void Count_SameDate_NotInclusive_Zero() { DateTime date = new(2020, 1, 1); // Wednesday int count = Weekdays.Count(date, date, false); Assert.Equal(0, count); }
public bool Evaluate() { TimeSpan tfrom = new TimeSpan(Int32.Parse(TimeFrom.Split(':')[0]), Int32.Parse(TimeFrom.Split(':')[1]), 0); TimeSpan ttill = new TimeSpan(Int32.Parse(TimeTill.Split(':')[0]), Int32.Parse(TimeTill.Split(':')[1]), 0); TimeSpan tnow = DateTime.Now.TimeOfDay; Weekdays dfrom = (Weekdays)Enum.Parse(typeof(Weekdays), DayFrom); Weekdays dtill = (Weekdays)Enum.Parse(typeof(Weekdays), DayTill); Weekdays dnow = (Weekdays)Enum.Parse(typeof(Weekdays), DateTime.Now.DayOfWeek.ToString().ToUpper().Substring(0, 3)); bool eval = (int)dnow >= (int)dfrom && (int)dnow <= (int)dtill && tnow >= tfrom && tnow <= ttill; if (!eval) { return(false); } foreach (var i in Triggers) { if (Link.Equals("AND")) { eval &= i.Evaluate(); } else if (Link.Equals("OR")) { eval |= i.Evaluate(); } else { eval = false; } } return(eval); }
Weekdays TwoDaysAfter(Weekdays twoAft) { if (twoAft == Weekdays.Sunday) { twoAft = Weekdays.Tuesday; } }
private Weekdays ConvertJobWeekdaysToEnum(JobVM jobVM) { Weekdays weekdays = 0; if (jobVM.Sunday) { weekdays |= Weekdays.Sunday; } if (jobVM.Monday) { weekdays |= Weekdays.Monday; } if (jobVM.Tuesday) { weekdays |= Weekdays.Tuesday; } if (jobVM.Wednesday) { weekdays |= Weekdays.Wednesday; } if (jobVM.Thursday) { weekdays |= Weekdays.Thursday; } if (jobVM.Friday) { weekdays |= Weekdays.Friday; } if (jobVM.Saturday) { weekdays |= Weekdays.Saturday; } return(weekdays); }
private Weekdays ConvertWeekdaysToEnum(LabourerVM labourerVM) { Weekdays weekdays = 0; if (labourerVM.Sunday) { weekdays |= Weekdays.Sunday; } if (labourerVM.Monday) { weekdays |= Weekdays.Monday; } if (labourerVM.Tuesday) { weekdays |= Weekdays.Tuesday; } if (labourerVM.Wednesday) { weekdays |= Weekdays.Wednesday; } if (labourerVM.Thursday) { weekdays |= Weekdays.Thursday; } if (labourerVM.Friday) { weekdays |= Weekdays.Friday; } if (labourerVM.Saturday) { weekdays |= Weekdays.Saturday; } return(weekdays); }
/// <summary> /// Initializes a new instance of the <see cref="TimerTaskRunner"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="taskType">Type of the task.</param> /// <param name="parameters">The parameters.</param> /// <param name="interval">The interval.</param> /// <param name="recurrence">The recurrence.</param> /// <param name="weekdays">The weekdays.</param> /// <param name="startDateTime">The start date time.</param> /// <param name="endDateTime">The end date time.</param> /// <param name="dayStartTime">The day start time.</param> /// <param name="dayEndTime">The day end time.</param> /// <param name="timeZoneInfo">The time zone information.</param> /// <param name="traceType">Type of the trace.</param> /// <exception cref="ArgumentOutOfRangeException"> /// Interval cannot be less than 1 /// or /// Recurrence has to be greater than 0 or euqal to -1 /// or /// Start date time should be less than End date time /// or /// Start time cannot be negative /// or /// End time cannot be negative /// or /// Start time should be less than 23:59:59 /// or /// End time should be less than 23:59:59 /// or /// No weekday is selected to run the task /// </exception> public TimerTaskRunner(string name, Type taskType, Dictionary <string, object> parameters, long interval, long recurrence, Weekdays weekdays, DateTime startDateTime, DateTime endDateTime, TimeSpan dayStartTime, TimeSpan dayEndTime, TimeZoneInfo timeZoneInfo, LogType traceType) : base(name, taskType, parameters, traceType) { /*} * public TimerTaskRunner(string name, Type taskType, StringDictionary parameters, long interval, long recurrence, * DateTime startDateTime, DateTime endDateTime, TimeSpan dayStartTime, TimeSpan dayEndTime, TimeZoneInfo timeZoneInfo) : * base(name, taskType, parameters) * {*/ if (interval < 1) { throw new ArgumentOutOfRangeException(nameof(interval), "Interval cannot be less than 1"); } if (recurrence != -1 && recurrence < 1) { throw new ArgumentOutOfRangeException(nameof(recurrence), "Recurrence has to be greater than 0 or euqal to -1"); } if (endDateTime < startDateTime) { throw new ArgumentOutOfRangeException(nameof(startDateTime), "Start date time should be less than End date time"); } if (dayStartTime < Time.DayMinTime) { throw new ArgumentOutOfRangeException(nameof(dayStartTime), "Start time cannot be negative"); } if (dayEndTime < Time.DayMinTime) { throw new ArgumentOutOfRangeException(nameof(dayEndTime), "End time cannot be negative"); } if (dayStartTime > Time.DayMaxTime) { throw new ArgumentOutOfRangeException(nameof(dayStartTime), "Start time should be less than 23:59:59"); } if (dayEndTime > Time.DayMaxTime) { throw new ArgumentOutOfRangeException(nameof(dayEndTime), "End time should be less than 23:59:59"); } if (weekdays == Weekdays.None) { throw new ArgumentOutOfRangeException(nameof(weekdays), "No weekday is selected to run the task"); } _weekdays = weekdays; _timeZoneInfo = timeZoneInfo ?? TimeZoneInfo.Local; _interval = interval; _recurrence = recurrence; _startDateTime = startDateTime; _endDateTime = endDateTime; _dayStartTime = dayStartTime; _dayEndTime = dayEndTime; }
public Day(Weekdays dayInWeek, int shiftsInDay, bool isHoliday, DateTime opening, DateTime closing) { weekday = dayInWeek; numberOfShifts = shiftsInDay; holiday = isHoliday; openingHour = opening; closingHour = closing; }
public void Count_OverWeekend_CountsWeekdays_Negative() { DateTime date1 = new(2020, 1, 6); DateTime date2 = new(2020, 1, 3); int count = Weekdays.Count(date1, date2, true); Assert.Equal(-2, count); }
public void Count_EndBeforeStart_Inclusive_NegativeCount() { DateTime date1 = new(2020, 1, 2); DateTime date2 = new(2020, 1, 1); int count = Weekdays.Count(date1, date2, true); Assert.Equal(-2, count); }
public void Count_StartBeforeEnd_Inclusive_Counts() { DateTime date1 = new(2020, 1, 1); DateTime date2 = new(2020, 1, 2); int count = Weekdays.Count(date1, date2, true); Assert.Equal(2, count); }
/// <summary> /// Take a day as input and return whether it is a WeekDay or a WeekEnd. /// </summary> /// <param name="d"> The input day </param> /// <returns>Returns WeekDay or WeekEnd. </returns> static Days WhatDay(Weekdays d) { return(d switch { _ when d >= Weekdays.Mon && d <= Weekdays.Fri => Days.WeekDay, _ when d == Weekdays.Sat || d == Weekdays.Sun => Days.WeekEnd, _ => Days.WeekEnd });
public void initializeSubRepetitions(CalendarEvent parentCalendarEvent, IEnumerable <CalendarEvent> calEvents) { Dictionary <DayOfWeek, List <CalendarEvent> > dayOfWeekTOCalEVents = Weekdays.ToDictionary(day => day, day => new List <CalendarEvent>()); List <Repetition> subRepetitions = dayOfWeekTOCalEVents.Where(kvp => kvp.Value.Count > 0).Select(kvp => ((Repetition) new DB_Repetition(parentCalendarEvent, kvp.Value, (int)kvp.Key, true))).ToList(); this.SubRepetitions = subRepetitions; }
static void Main(string[] args) { int weekday = 2; Weekdays wd = Weekdays.Tuesday; Console.WriteLine((Weekdays)weekday); Console.WriteLine(wd); }
static void Task8() { Console.WriteLine("*********** TASK 8 ************"); Weekdays wd = Weekdays.Friday; Console.WriteLine(wd); Console.WriteLine("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); }
Weekdays nextDay(Weekdays next) { if (next == Weekdays.Sunday) { Weekdays = Weekdays.Monday; } return(next); }
public RepetitionPosition(Weekdays weekday = Weekdays.Monday, int dayNum = 1, int weekNum = 1, int hourNum = 1, int minuteNum = 0, int secondNum = 0) { Weekday = weekday; DayNum = dayNum; WeekNum = weekNum; HourNum = hourNum; MinuteNum = minuteNum; SecondNum = secondNum; }
/// <summary> /// Initializes a new instance of the <see cref="ParallelTaskBuilder"/> class. /// </summary> /// <param name="config">The configuration.</param> /// <param name="name">The name.</param> /// <param name="taskType">Type of the task.</param> /// <param name="logType">Type of the log.</param> internal ParallelTaskBuilder(FlowConfiguration config, string name, Type taskType, LogType logType = LogType.All) : base(config, name, taskType, logType) { _min = 1; _weekdays = Weekdays.All; _timeZone = TimeZoneInfo.Local; _from = Time.DayMinTime; _to = Time.DayMaxTime; }
/// <summary> /// Runs the on weekdays. /// </summary> /// <param name="weekdays">The weekdays.</param> /// <returns> /// Returns <see cref="ILifetime" /> /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">No weekday is selected to run the task</exception> ILifetime IWeekdays.OnWeekdays(Weekdays weekdays) { if (weekdays == Weekdays.None) { throw new ArgumentOutOfRangeException(nameof(weekdays), "No weekday is selected to run the task"); } _weekdays = weekdays; return(this); }
/// <summary> /// Runs the on weekdays. /// </summary> /// <param name="weekdays">The weekdays.</param> /// <returns> /// Returns <see cref="IOperationalTime" /> /// </returns> /// <exception cref="System.ArgumentOutOfRangeException">Weekdays must at least one week day</exception> IOperationalTime IWeekdays.OnWeekdays(Weekdays weekdays) { if (weekdays == Weekdays.None) { throw new ArgumentOutOfRangeException(nameof(weekdays), "Weekdays must at least one week day"); } _weekdays = weekdays; return(this); }
protected void grdJobsTrigger_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName != "Job.Weekdays") return; Weekdays weekDays = new Weekdays {AllDays = Convert.ToByte(e.Value)}; if (weekDays.AllDays == 0) e.DisplayText = "No Diario"; else e.DisplayText = Utils.UI.Helper.BuildPopulateDaysLegend(weekDays); }
/// <summary> /// Gets a date description string from the specified values and calendar types. /// The string is a descriptive statement in Persian Language. /// </summary> /// <param name="t">The type of calendar.</param> /// <param name="w">The day of the week.</param> /// <param name="dayNumber">The day of the month.</param> /// <param name="monthNum">The month number.</param> /// <param name="yearNum">The year number.</param> /// <returns></returns> public static string GetPersianDateString(DateCalendarType t, Weekdays w, int dayNumber, int monthNum, int yearNum) { string strWeekday = GetPersianWeekdayName(w); string strMonth = ""; switch (t) { case DateCalendarType.Gregorian: strMonth = GetPersianGregorianMonthName(monthNum); break; case DateCalendarType.Jalali: strMonth = GetPresianJalaliMonthName(monthNum); break; case DateCalendarType.HijriGhamari: strMonth = GetPersianGhamariMonthName(monthNum); break; } string day = ""; if (0 < dayNumber && dayNumber < 35) { day = NumberToPersianString.ToString(dayNumber); } string year = ""; if (0 <= yearNum) { year = NumberToPersianString.ToString(yearNum); } StringBuilder sb = new StringBuilder(); if (strWeekday.Length > 0) { sb.Append(strWeekday + " "); } if (day.Length > 0) { sb.Append(day + " "); } if (strMonth.Length > 0) { sb.Append(strMonth + " "); } if (year.Length > 0) { sb.Append(year + " "); } return(sb.ToString().Trim()); }
/// <summary> /// Initializes a new instance of the <see cref="EnglishDatePatternInfo"/> class. /// </summary> /// <param name="content">The m_content.</param> /// <param name="index">The m_index.</param> /// <param name="length">The length of the pattern found.</param> /// <param name="t">The type of the calendar.</param> /// <param name="w">The day of the week.</param> /// <param name="dayNo">The day number (in month).</param> /// <param name="monthNo">The month number.</param> /// <param name="yearNo">The year number.</param> public EnglishDatePatternInfo(string content, int index, int length, DateCalendarType t, Weekdays w, int dayNo, int monthNo, int yearNo) { m_content = content; m_index = index; m_length = length; m_calType = t; m_weekday = w; m_dayNumber = dayNo; m_monthNumber = monthNo; m_yearNumber = yearNo; }
/// <summary> /// Extracts and parses the week-day. /// </summary> /// <param name="m">The regex Match object to parse.</param> /// <returns></returns> private Weekdays ExtractWeekday(Match m) { Weekdays w = Weekdays.Illeagal; foreach (Capture c in m.Groups["Weekday"].Captures) { w = EnglishWeekday(c.Value); } return(w); }
/// <summary> /// Initializes a new instance of the <see cref="PersianDatePatternInfo"/> class. /// </summary> /// <param name="content">The content.</param> /// <param name="index">The index.</param> /// <param name="length">The length of the found pattern.</param> /// <param name="t">The calendar type.</param> /// <param name="w">The day of the week.</param> /// <param name="dayNo">The day number (in month).</param> /// <param name="monthNo">The month number.</param> /// <param name="yearNo">The year number.</param> public PersianDatePatternInfo(string content, int index, int length, DateCalendarType t, Weekdays w, int dayNo, int monthNo, int yearNo) { this.content = content; this.index = index; this.length = length; this.calType = t; this.weekday = w; this.dayNumber = dayNo; this.monthNumber = monthNo; this.yearNumber = yearNo; }
public static bool[] AsArray(this Weekdays days) { var d = new bool[7]; d[0] = days.Sunday; d[1] = days.Monday; d[2] = days.Tuesday; d[3] = days.Wednesday; d[4] = days.Thursday; d[5] = days.Friday; d[6] = days.Saturday; return(d); }
static void Main(string[] args) { Weekdays myday = Weekdays.星期日; //声明weekdays枚举类型的变量myday Console.Title = "chpt3-3b"; Console.WriteLine("今天是:{0}", DateTime.Now.Date.ToShortDateString()); //输出日期 Console.WriteLine("今天是:{0}", DateTime.Now.DayOfWeek); //输出英文星期 myday = (Weekdays)DateTime.Now.DayOfWeek; //将当前日期强制转换为weekdays枚举类型 Console.WriteLine(myday); Console.Read(); }
public static string BuildPopulateDaysLegend(Weekdays weekdays) { string legend = (weekdays.Sunday)? "Dom-": ""; legend = (weekdays.Monday)? legend + "Lun-": legend; legend = (weekdays.Tuesday)? legend + "Mar-": legend; legend = (weekdays.Wednesday)? legend + "Mie-": legend; legend = (weekdays.Thursday)? legend + "Jue-": legend; legend = (weekdays.Friday)? legend + "Vie-": legend; legend = (weekdays.Saturday)? legend + "Sab": legend; if (legend.EndsWith("-")) { legend = legend.Remove(legend.Length - 1); } return legend; }
protected void FillUI(Job job) { var sqlJob = (SqlJob)job; ltrlProcessType.Text = sqlJob.JobType.ToString(); lblProcessName.Text = "ID: " + job.JobId + " - Proceso: " + job.Name + " - Grupo: " + job.Group; lblDescription.Text = "Descripción: " + job.Description; lblComments.Text = "Comentarios: " + sqlJob.Comments; lblProcessOwner.Text = "Creado Por: " + job.CreatedBy; if (sqlJob.JobType == JobType.Automático) { divInputSchemaProcedure.Visible = false; if (sqlJob.AutomaticProcessTime.HasValue && sqlJob.Weekdays != 0) { lblAutomaticProcessTime.Text = "Hora Ejecución: " + sqlJob.AutomaticProcessTime.Value.ToString("HH:mm:ss"); } else lblAutomaticProcessTime.Text = "Hora Ejecución: --:-- --"; } else { divInputSchemaProcedure.Visible = true; divAutomaticProcessTime.Visible = false; } lblProcessType.Text = "Tipo de Proceso: " + sqlJob.JobType; lblServerName.Text = "Nombre Servidor: " + sqlJob.ServerName; lblDataBaseName.Text = "Nombre BD: " + sqlJob.DatabaseName; lblStoredProcedure.Text = "Stored de Ejecución: " + sqlJob.ExecProcedure; lblDataBaseUser.Text = "Usuario DB: " + sqlJob.UserName; lblInputXmlFixedParameters.Text = "Valores Fijos: " + sqlJob.InputXmlFixedParameters; if (sqlJob.JobType == JobType.Automático) divInputSchemaProcedure.Visible = false; else lblInputSchemaProcedure.Text = "Stored de Config: " + sqlJob.InputSchemaProcedure; Weekdays weekdays = new Weekdays(); weekdays.AllDays = Convert.ToByte(sqlJob.Weekdays); if (weekdays.AllDays == 0) lblWeekDays.Text = "Frecuencia: No Diaria"; else lblWeekDays.Text = "Frecuencia: " + Utils.UI.Helper.BuildPopulateDaysLegend(weekdays); }
protected void FillUI(SqlJob sqlJob) { txtGroup.Value = sqlJob.Group; txtName.Value = sqlJob.Name; txtDescription.Value = sqlJob.Description; if (sqlJob.ParentJobId.HasValue && sqlJob.ParentJobId.Value != 0) { cmbRelatedProcess.Value = jobSchedulerService.GetJobById(sqlJob.ParentJobId.Value).JobId.ToString(); } if (sqlJob.ParentJobId.HasValue && sqlJob.ParentJobId.Value == 0) { cmbRelatedProcess.Value = "Ninguno"; } cmbJobType.Value = sqlJob.JobTypeEnum.ToString(); chkFavorite.Checked = sqlJob.IsFavorite; chkGeneral.Checked = sqlJob.IsGeneral; txtComments.Value = sqlJob.Comments; txtProcedureServerName.Value = sqlJob.ServerName; txtProcedureDataBaseName.Value = sqlJob.DatabaseName; if (sqlJob.JobType == JobType.Manual) { lblProcessTime.Visible = false; } else { if (sqlJob.AutomaticProcessTime.HasValue) dtAutomaticProcessTime.Value = sqlJob.AutomaticProcessTime.Value.TimeOfDay.Hours.ToString().PadLeft(2, '0') + ":" + sqlJob.AutomaticProcessTime.Value.TimeOfDay.Minutes.ToString().PadLeft(2, '0'); lblInputSchemaProcedure.Visible = false; } if (sqlJob.InputSchemaProcedure == null || sqlJob.InputSchemaProcedure.Trim() == "") { btnCheckInputDialog.Visible = false; } txtProcedureUserName.Value = sqlJob.UserName; txtInputSchemaProcedure.Value = sqlJob.InputSchemaProcedure; txtExecProcedure.Value = sqlJob.ExecProcedure; txtInputXmlFixedParameters.Value = sqlJob.InputXmlFixedParameters.Replace("<INPUTXMLFIXEDPARAMETERS>", "").Replace("</INPUTXMLFIXEDPARAMETERS>", ""); Weekdays weekdays = new Weekdays(); weekdays.AllDays = Convert.ToByte(sqlJob.Weekdays); PopulateCheckBoxes(weekdays); }
protected void FillReport(JobTrigger jobTrigger) { var sqlJobTrigger = (SqlJobTrigger)jobTrigger; /* DATOS JOB */ lblProcessName.Text = jobTrigger.Job.Name + " (" + jobTrigger.Job.Group + ") - " + jobTrigger.Job.JobId + " -" ; lblProcessOwner.Text = jobTrigger.Job.CreatedBy; lblDescription.Text = jobTrigger.Job.Description; lblInputValues.Text = Utils.UI.Helper.FormatXml(sqlJobTrigger.Job.InputXmlFixedParameters + sqlJobTrigger.InputFormXmlValues); lblComments.Text = sqlJobTrigger.Job.Comments; lblProcessType.Text = sqlJobTrigger.Job.JobType.ToString(); Weekdays weekdays = new Weekdays(); weekdays.AllDays = Convert.ToByte(((SqlJob)sqlJobTrigger.Job).Weekdays); if (weekdays.AllDays == 0) lblWeekDays.Text = "No Diaria"; else lblWeekDays.Text = Utils.UI.Helper.BuildPopulateDaysLegend(weekdays); lblServerName.Text = ((SqlJob)sqlJobTrigger.Job).ServerName; lblDataBaseName.Text = ((SqlJob)sqlJobTrigger.Job).DatabaseName; lblStoredProcedure.Text = ((SqlJob)sqlJobTrigger.Job).ExecProcedure; lblInputXmlFixedParameters.Text = Utils.UI.Helper.FormatXml(sqlJobTrigger.Job.InputXmlFixedParameters); lblInputXmlFixedParameters.Text = lblInputXmlFixedParameters.Text.Replace("<ROOT>", "").Replace("</ROOT>", ""); if (sqlJobTrigger.Job.JobType == JobType.Automático) { lblScheduledStartExecutionDate.Text = sqlJobTrigger.ScheduledStartExecutionDate.ToString("dd/MM/yyyy HH:mm:ss"); if (sqlJobTrigger.Job.AutomaticProcessTime.HasValue && sqlJobTrigger.Job.Weekdays != 0) { lblAutomaticProcessTime.Text = "Hora Ejecución: " + sqlJobTrigger.Job.AutomaticProcessTime.Value.ToString("HH:mm:ss"); } else lblAutomaticProcessTime.Text = "-"; } else { lblScheduledStartExecutionDate.Text = sqlJobTrigger.ScheduledStartExecutionDate.ToString("dd/MM/yyyy"); lblInputSchemaProcedure.Text = sqlJobTrigger.Job.InputSchemaProcedure; lblAutomaticProcessTime.Text = "-"; } /* FIN DATOS JOB */ /* DATOS JOBTRIGGER */ if (String.IsNullOrEmpty(sqlJobTrigger.OutputExecutionStatus)) lblOutputStatus.Text = "NO Ejecutado"; else lblOutputStatus.Text = sqlJobTrigger.OutputExecutionStatus; lblTrigger.Text = jobTrigger.JobTriggerId.ToString(); if ((sqlJobTrigger.RecordsAffected == 0) && (sqlJobTrigger.RecordsProcessed == 0)) lblRecords.Text = "- / -"; else lblRecords.Text = sqlJobTrigger.RecordsAffected.ToString() + "/" + sqlJobTrigger.RecordsProcessed.ToString(); lblOuputExecutionLog.Text = string.IsNullOrEmpty(sqlJobTrigger.OutputExecutionLog) ? "SIN DATOS PARA MOSTRAR" : sqlJobTrigger.OutputExecutionLog; lblOutputResult.Text = string.IsNullOrEmpty(sqlJobTrigger.OutputExecutionResult) ? "SIN DATOS PARA MOSTRAR" : sqlJobTrigger.OutputExecutionResult; lblOutputExecutionTrace.Text = string.IsNullOrEmpty(sqlJobTrigger.OutputExecutionTrace) ? "SIN DATOS PARA MOSTRAR" : sqlJobTrigger.OutputExecutionTrace; lblJobTriggerStatus.Text = sqlJobTrigger.JobTriggerStatus.ToString().ToUpper(); lblStartExecutionDate.Text = ((sqlJobTrigger.StartExecutionDate.HasValue) ? sqlJobTrigger.StartExecutionDate.Value.ToString("dd/MM/yyyy HH:mm:ss") : ""); lblEndExecutionDate.Text = ((sqlJobTrigger.EndExecutionDate.HasValue) ? sqlJobTrigger.EndExecutionDate.Value.ToString("dd/MM/yyyy HH:mm:ss") : ""); /* FIN DATOS JOBTRIGGER */ }
private void PopulateCheckBoxes(Weekdays weekdays) { chkSunday.Checked = weekdays.Sunday; chkMonday.Checked = weekdays.Monday; chkTuesday.Checked = weekdays.Tuesday; chkWednesday.Checked = weekdays.Wednesday; chkThursday.Checked = weekdays.Thursday; chkFriday.Checked = weekdays.Friday; chkSaturday.Checked = weekdays.Saturday; }
private Weekdays GetCheckBoxesSelections() { Weekdays weekdays = new Weekdays { Sunday = chkSunday.Checked, Monday = chkMonday.Checked, Tuesday = chkTuesday.Checked, Wednesday = chkWednesday.Checked, Thursday = chkThursday.Checked, Friday = chkFriday.Checked, Saturday = chkSaturday.Checked }; return weekdays; }
protected void FillUI(SqlJob sqlJob) { hdnJobId.Value = sqlJob.JobId.ToString(); txtGroup.Value = sqlJob.Group; if (sqlJob.JobType == JobType.Manual) { lblInputSchemaProcedure.Visible = true; lblAutomaticProcessTime.Visible = false; } else { if (sqlJob.AutomaticProcessTime.HasValue) dtAutomaticProcessTime.Value = sqlJob.AutomaticProcessTime.Value.TimeOfDay.Hours.ToString().PadLeft(2, '0') + ":" + sqlJob.AutomaticProcessTime.Value.TimeOfDay.Minutes.ToString().PadLeft(2, '0'); lblInputSchemaProcedure.Visible = false; } txtName.Value = sqlJob.Name; txtDescription.Value = sqlJob.Description; txtComments.Value = sqlJob.Comments; chkGeneral.Checked =sqlJob.IsGeneral; cmbJobType.Value = sqlJob.JobTypeEnum.ToString(); if (sqlJob.ParentJobId.HasValue && sqlJob.ParentJobId.Value == 0) { cmbRelatedProcess.Value = "Ninguno"; } else { if (sqlJob.ParentJobId.HasValue) { cmbRelatedProcess.Value = jobSchedulerService.GetJobById(sqlJob.ParentJobId.Value).Name; } else { cmbRelatedProcess.Value = "Ninguno"; } } chkFavorite.Checked = sqlJob.IsFavorite; txtProcedureServerName.Value = sqlJob.ServerName; txtProcedureDataBaseName.Value = sqlJob.DatabaseName; txtProcedureUserName.Value = sqlJob.UserName; txtInputSchemaProcedure.Value = sqlJob.InputSchemaProcedure; Weekdays weekdays = new Weekdays(); weekdays.AllDays = Convert.ToByte(sqlJob.Weekdays); PopulateCheckBoxes(weekdays); }
public DayCardViewModel(Weekdays day) { Day = day.ToString(); }
Weekdays nextDay(Weekdays next) { if (next == Weekdays.Sunday) Weekdays = Weekdays.Monday; return next; }
Weekdays TwoDaysAfter(Weekdays twoAft) { if (twoAft == Weekdays.Sunday) twoAft = Weekdays.Tuesday; }
protected void FillUI(JobTrigger jobTrigger) { var sqlJobTrigger = (SqlJobTrigger)jobTrigger; ltrlProcessType.Text = sqlJobTrigger.Job.JobType.ToString(); /* DATOS JOB */ lblProcessName.Text = "ID: " + jobTrigger.Job.JobId + " - Proceso: " + jobTrigger.Job.Name + " - Grupo: " + jobTrigger.Job.Group; lblProcessOwner.Text = "Usuario: " + jobTrigger.Job.CreatedBy; lblDescription.Text = "Descripción: " + jobTrigger.Job.Description; // Formatea los datos con el estilo XML que muestra Internet Explorer txtInputValues.Text = Utils.UI.Helper.FormatXml(sqlJobTrigger.Job.InputXmlFixedParameters + sqlJobTrigger.InputFormXmlValues); lblComments.Text = "Comentarios: " + sqlJobTrigger.Job.Comments; lblProcessType.Text = "Tipo de Proceso: " + sqlJobTrigger.Job.JobType; Weekdays weekdays = new Weekdays(); weekdays.AllDays = Convert.ToByte(((SqlJob)sqlJobTrigger.Job).Weekdays); if (weekdays.AllDays == 0) lblWeekDays.Text = "Frecuencia: No Diaria"; else lblWeekDays.Text = "Frecuencia: " + Utils.UI.Helper.BuildPopulateDaysLegend(weekdays); lblServerName.Text = "Nombre Servidor: " + ((SqlJob)sqlJobTrigger.Job).ServerName; lblDataBaseName.Text = "Nombre BD: " + ((SqlJob)sqlJobTrigger.Job).DatabaseName; lblStoredProcedure.Text = "Stored de Ejecución: " + ((SqlJob)sqlJobTrigger.Job).ExecProcedure; lblInputXmlFixedParameters.Text = "Valores Fijos: " + sqlJobTrigger.Job.InputXmlFixedParameters; if (sqlJobTrigger.Job.JobType == JobType.Automático) { lblScheduledStartExecutionDate.Text = "Agendado el: " + sqlJobTrigger.ScheduledStartExecutionDate.ToString("dd/MM/yyyy HH:mm"); lblInputSchemaProcedure.Text = "Stored de Config: -"; if (sqlJobTrigger.Job.AutomaticProcessTime.HasValue && sqlJobTrigger.Job.Weekdays != 0) { lblAutomaticProcessTime.Text = "Hora Ejecución: " + sqlJobTrigger.Job.AutomaticProcessTime.Value.ToString("HH:mm:ss"); } else divAutomaticProcessTime.Visible = false; } else { lblScheduledStartExecutionDate.Text = "Agendado el: " + sqlJobTrigger.ScheduledStartExecutionDate.ToString("dd/MM/yyyy"); lblInputSchemaProcedure.Text = "Stored de Config: " + sqlJobTrigger.Job.InputSchemaProcedure; divInputSchemaProcedure.Visible = true; divAutomaticProcessTime.Visible = false; } /* FIN DATOS JOB */ /* DATOS JOBTRIGGER */ if (String.IsNullOrEmpty(sqlJobTrigger.OutputExecutionStatus)) lblOutputStatus.Text = "Estado de la Salida: NO Ejecutado"; else lblOutputStatus.Text = "Estado de la Salida: " + sqlJobTrigger.OutputExecutionStatus; lblTrigger.Text = "Trigger: " + jobTrigger.JobTriggerId; if ((sqlJobTrigger.RecordsAffected == 0) && (sqlJobTrigger.RecordsProcessed == 0)) lblRecords.Text = "Registros: - / -"; else lblRecords.Text = "Registros: " + sqlJobTrigger.RecordsAffected.ToString() + "/" + sqlJobTrigger.RecordsProcessed.ToString(); switch (jobTrigger.JobTriggerStatus) { case JobTriggerStatus.Agendado: btnDelete.Visible = true; btnKillProcess.Visible = false; break; case JobTriggerStatus.Ejecutando: btnDelete.Visible = false; btnKillProcess.Visible = true; break; default: btnDelete.Visible = false; btnKillProcess.Visible = false; break; } // TODO: Poner un tag en el xmlResultado para mostrar datos luego de que arme la tabla. // InputValues es el resultado de la ejecución del stored de Configuración que arma el Form Dinámico txtXmlInputTable.Text= sqlJobTrigger.InputXmlTable; txtXmlOutputTable.Text = sqlJobTrigger.OutputXmlTable; ltrlOuputExecutionLog.Text = string.IsNullOrEmpty(sqlJobTrigger.OutputExecutionLog) ? "SIN DATOS PARA MOSTRAR" : sqlJobTrigger.OutputExecutionLog; ltrlOutputResult.Text = string.IsNullOrEmpty(sqlJobTrigger.OutputExecutionResult) ? "SIN DATOS PARA MOSTRAR" : sqlJobTrigger.OutputExecutionResult; ltrlOutputExecutionTrace.Text = string.IsNullOrEmpty(sqlJobTrigger.OutputExecutionTrace) ? "SIN DATOS PARA MOSTRAR" : sqlJobTrigger.OutputExecutionTrace; lblJobTriggerStatus.Text = "Estado del Proceso: " + sqlJobTrigger.JobTriggerStatus.ToString().ToUpper(); lblStartExecutionDate.Text = "Inicio Ejecución: " + ((sqlJobTrigger.StartExecutionDate.HasValue) ? sqlJobTrigger.StartExecutionDate.Value.ToString("dd/MM/yyyy hh:mm:ss") : ""); lblEndExecutionDate.Text = "Fin Ejecución: " + ((sqlJobTrigger.EndExecutionDate.HasValue) ? sqlJobTrigger.EndExecutionDate.Value.ToString("dd/MM/yyyy hh:mm:ss") : ""); /* FIN DATOS JOBTRIGGER */ lnkPrint.HRef = "/Reports/JobTriggerInfo.aspx?triggerId=" + jobTrigger.JobTriggerId; }
// Use this for initialization void Start() { myday1 = Weekdays.Sunday; myday1 = nextDay (myday1); }