当前位置: 首页>>代码示例>>C#>>正文


C# ISchedule.GetType方法代码示例

本文整理汇总了C#中ISchedule.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ISchedule.GetType方法的具体用法?C# ISchedule.GetType怎么用?C# ISchedule.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISchedule的用法示例。


在下文中一共展示了ISchedule.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddSchedule

        public static long AddSchedule(ISchedule itm)
        {
            long itmID = getNextScheduleID();
            IBaseQueryData query = new InsertQueryData();
            query.TableName = "Schedules";
            query.Fields.Add(new FieldData { FieldName = "ScheduleID", FieldValue = itmID.ToString(), FieldType = SqlDbType.BigInt });

            if (itm.GetType() == typeof(YearlySchedule))
            {
                YearlySchedule ySched = (YearlySchedule)itm;
                query.Fields.Add(new FieldData { FieldName = "RecurType", FieldValue = "4", FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "StartDate", FieldValue = ySched.StartDate.ToString(Constants.DATE_FORMAT_SQL) , FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "EndDate", FieldValue = ySched.EndDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "RecurUnits", FieldValue = ySched.RecurEveryNoOfYears.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnDay", FieldValue = ySched.OnDay.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnMonth", FieldValue = ySched.OnMonth.ToString(), FieldType = SqlDbType.Int });
            }
            else if (itm.GetType() == typeof(MonthlySchedule))
            {
                MonthlySchedule mSched = (MonthlySchedule)itm;
                query.Fields.Add(new FieldData { FieldName = "RecurType", FieldValue = "3", FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "RecurUnits", FieldValue = mSched.RecurEveryNoOfMonths.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "StartDate", FieldValue = mSched.StartDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "EndDate", FieldValue = mSched.EndDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "OnDay", FieldValue = mSched.OnDay.ToString(), FieldType = SqlDbType.Int });
            }
                else if (itm.GetType() == typeof(WeeklySchedule))
            {
                WeeklySchedule wSched = (WeeklySchedule)itm;
                query.Fields.Add(new FieldData { FieldName = "RecurType", FieldValue = "2", FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "RecurUnits", FieldValue = wSched.RecurEveryNoOfWeeks.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "StartDate", FieldValue = wSched.StartDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "EndDate", FieldValue = wSched.EndDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "OnMondays", FieldValue = wSched.OnMondays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnTuesdays", FieldValue = wSched.OnTuesdays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnWednesdays", FieldValue = wSched.OnWednesdays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnThursdays", FieldValue = wSched.OnThursdays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnFridays", FieldValue = wSched.OnFridays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnSaturdays", FieldValue = wSched.OnSaturdays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "OnSundays", FieldValue = wSched.OnSundays.ToString(), FieldType = SqlDbType.Int });
            }
            else
            {
                DailySchedule dSched = (DailySchedule)itm;
                query.Fields.Add(new FieldData { FieldName = "RecurType", FieldValue = "1", FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "RecurUnits", FieldValue = dSched.RecurEveryNoOfDays.ToString(), FieldType = SqlDbType.Int });
                query.Fields.Add(new FieldData { FieldName = "StartDate", FieldValue = dSched.StartDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "EndDate", FieldValue = dSched.EndDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.DateTime });
                query.Fields.Add(new FieldData { FieldName = "WeekDaysOnly", FieldValue = dSched.WeekDaysOnly.ToString(), FieldType = SqlDbType.Bit });
            }
            if (!SQLWrapper.ExecuteQuery(query))
            {
                itmID = 0;
            }
            return itmID;
        }
开发者ID:kalirajanl,项目名称:UBRS,代码行数:56,代码来源:DALSchedule.cs

示例2: LoadSchedule

 public void LoadSchedule(ISchedule sched)
 {
     if (sched != null)
     {
         if (sched.GetType() == typeof(WeeklySchedule))
         {
             WeeklySchedule wSched = (WeeklySchedule)sched;
             this.rdobtnWeekly.Checked = true;
             this.dtpStartDate.Value = wSched.StartDate;
             this.dtpEndDate.Value = wSched.EndDate;
             this.chkFriday.Checked = wSched.OnFridays;
             this.chkMonday.Checked = wSched.OnMondays;
             this.chkSaturday.Checked = wSched.OnSaturdays;
             this.chkSunday.Checked = wSched.OnSundays;
             this.chkThursday.Checked = wSched.OnThursdays;
             this.chkTuesday.Checked = wSched.OnTuesdays;
             this.chkWednesday.Checked = wSched.OnWednesdays;
             this.txtWlyUnits.Text = wSched.RecurEveryNoOfWeeks.ToString();
         }
         else if (sched.GetType() == typeof(MonthlySchedule))
         {
             MonthlySchedule mSched = (MonthlySchedule)sched;
             this.rdobtnMonthly.Checked = true;
             this.dtpStartDate.Value = mSched.StartDate;
             this.dtpEndDate.Value = mSched.EndDate;
             this.txtMlyOnDay.Text = mSched.OnDay.ToString();
             this.txtMlyUnits.Text = mSched.RecurEveryNoOfMonths.ToString();
         }
         else if (sched.GetType() == typeof(YearlySchedule))
         {
             YearlySchedule ySched = (YearlySchedule)sched;
             this.rdobtnYearly.Checked = true;
             this.dtpStartDate.Value = ySched.StartDate;
             this.dtpEndDate.Value = ySched.EndDate;
             this.txtYlyOnDay.Text = ySched.OnDay.ToString();
             this.cboYlyOnMonth.SelectedIndex = Convert.ToInt32(ySched.OnMonth);
             this.txtYlyUnits.Text = ySched.RecurEveryNoOfYears.ToString();
         }
         else
         {
             DailySchedule dSched = (DailySchedule)sched;
             this.rdobtnDaily.Checked = true;
             this.dtpStartDate.Value = dSched.StartDate;
             this.dtpEndDate.Value = dSched.EndDate;
             this.txtDlyUnits.Text = dSched.RecurEveryNoOfDays.ToString();
             this.rdobtnDlyWeekdaysOnly.Checked = dSched.WeekDaysOnly;
         }
     }
 }
开发者ID:kalirajanl,项目名称:UBRS,代码行数:49,代码来源:frmRecur.cs

示例3: GetInstanceDates

 public static List<DateTime> GetInstanceDates(ISchedule sched, DateTime startDate, DateTime finishDate)
 {
     List<DateTime> dates = null;
     if (sched == null)
     {
         dates = new List<DateTime>();
         for (DateTime tmpdate = startDate; tmpdate <= finishDate; tmpdate = tmpdate.AddDays(1))
         {
             dates.Add(tmpdate);
         }
     }
     else if (sched.GetType() == typeof(YearlySchedule))
     {
         YearlySchedule ySched = (YearlySchedule)sched;
         dates = getYearlyInstanceDates(ySched, startDate, finishDate);
     }
     else if (sched.GetType() == typeof(MonthlySchedule))
     {
         MonthlySchedule mSched = (MonthlySchedule)sched;
         dates = getMonthlyInstanceDates(mSched, startDate, finishDate);
     }
     else if (sched.GetType() == typeof(WeeklySchedule))
     {
         WeeklySchedule wSched = (WeeklySchedule)sched;
         dates = getWeeklyInstanceDates(wSched, startDate, finishDate);
     }
     else
     {
         DailySchedule dSched = (DailySchedule)sched;
         dates = getDailyInstanceDates(dSched, startDate, finishDate);
     }
     if (dates.Count <= 0)
     {
         dates.Add(startDate);
     }
     return dates;
 }
开发者ID:kalirajanl,项目名称:UBRS,代码行数:37,代码来源:Schedule.cs


注:本文中的ISchedule.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。