예제 #1
0
    public static DateTime ConvertToDatetime(string timestamp)
    {
        long     lTime = long.Parse(timestamp + "0000000");
        TimeSpan toNow = new TimeSpan(lTime);

        return(DtStart.Add(toNow));
    }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = DtStart?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (DtEnd?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Location?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Status.GetHashCode();
         hashCode = (hashCode * 397) ^ IsActive().GetHashCode();
         hashCode = (hashCode * 397) ^ Transparency.GetHashCode();
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Resources);
         return(hashCode);
     }
 }
예제 #3
0
        public bool Equals(CalendarEvent other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(DtStart.Equals(other.DtStart) && Description == other.Description && Location == other.Location &&
                   Summary == other.Summary);
        }
예제 #4
0
 private void ExtrapolateTimes()
 {
     if (DtEnd == null && DtStart != null && Duration != default(TimeSpan))
     {
         DtEnd = DtStart.Add(Duration);
     }
     else if (Duration == default(TimeSpan) && DtStart != null && DtEnd != null)
     {
         Duration = DtEnd.Subtract(DtStart);
     }
     else if (DtStart == null && Duration != default(TimeSpan) && DtEnd != null)
     {
         DtStart = DtEnd.Subtract(Duration);
     }
 }
예제 #5
0
 public int CompareTo(CalendarEvent other)
 {
     if (DtStart.Equals(other.DtStart))
     {
         return(0);
     }
     if (DtStart.LessThan(other.DtStart))
     {
         return(-1);
     }
     if (DtStart.GreaterThan(other.DtStart))
     {
         return(1);
     }
     throw new Exception("An error occurred while comparing two CalDateTimes.");
 }
예제 #6
0
파일: Event.cs 프로젝트: johnbouma/ical.net
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = DtStart?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (DtEnd?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Location?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Status.GetHashCode();
         hashCode = (hashCode * 397) ^ IsActive().GetHashCode();
         hashCode = (hashCode * 397) ^ Transparency.GetHashCode();
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Attachments);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Resources);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCodeForNestedCollection(ExceptionDates);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(ExceptionRules);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCodeForNestedCollection(RecurrenceDates);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(RecurrenceRules);
         return(hashCode);
     }
 }
예제 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = DtStart?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ Priority.GetHashCode();
         hashCode = (hashCode * 397) ^ (Summary?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Class?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Description?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (RecurrenceId?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Attachments);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Categories);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(Contacts);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(ExceptionDates);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(ExceptionRules);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(RecurrenceDates);
         hashCode = (hashCode * 397) ^ CollectionHelpers.GetHashCode(RecurrenceRules);
         return(hashCode);
     }
 }
예제 #8
0
        public void SurgeryClearType()
        {
            //  clear surgery dates
            if (SurgerySearchVar.ClearType == 0)
            {
                helper.SetDateToToday(DtEnd);

                helper.SetDateToToday(DtStart);

                DtStart.Focus();
            }

            //  clear fiscal year
            if (SurgerySearchVar.ClearType == 1)
            {
                helper.SetDateToToday(DtFiscalEnd);

                helper.SetDateToToday(DtFiscalStart);

                DtFiscalStart.Focus();
            }
        }
예제 #9
0
        public Wlst.client.FaultTypes.FaultSettingRuleOne BackTo()
        {
            var d1 = 0;
            var d2 = 0;

            if (OpTimeSet == 2)
            {
                if (!IsNumberic(DtStart) || !IsNumberic(DtEnd))
                {
                    return(null);
                }
                d1 = Convert.ToInt32(DtStart.Trim());//gettostr(DtStart);
                d2 = Convert.ToInt32(DtEnd.Trim());
                //d1 = DtS2;
                //StrTip = "开灯后设置为分钟数值";
            }
            else if (OpTimeSet == 3)
            {
                if (!IsNumberic(DtStart) || !IsNumberic(DtEnd))
                {
                    return(null);
                }
                d1 = Convert.ToInt32(DtStart.Trim());//gettostr(DtStart);
                d2 = Convert.ToInt32(DtEnd.Trim());
                //d1 = DtS2;
                //StrTip = "关灯后设置为分钟数值";
            }
            else if (OpTimeSet == 1)
            {
                d1 = getStrInt(DtStart);
                d2 = getStrInt(DtEnd);
                //StrTip = "全天时间 为几点几分";
            }
            else if (OpTimeSet == 4)
            {
                //lvf 负数 判断
                if (DtStart.StartsWith("-"))                     //先判断是否以-开头
                {
                    string subdtStartStr = DtStart.Substring(1); //取-剩下的字符串
                    if (!IsNumberic(subdtStartStr))
                    {
                        return(null);
                    }
                }
                if (DtEnd.StartsWith("-"))                   //先判断是否以-开头
                {
                    string subdtEndStr = DtEnd.Substring(1); //取-剩下的字符串
                    if (!IsNumberic(subdtEndStr))
                    {
                        return(null);
                    }
                }
                //if (!IsNumberic(DtStart) || !IsNumberic(DtEnd)) return null;
                d1 = Convert.ToInt32(DtStart.Trim()); //gettostr(DtStart);
                d2 = Convert.ToInt32(DtEnd.Trim());
                //StrTip = "日出-日落偏移量 为分钟数值";
            }
            else if (OpTimeSet == 5)
            {
                if (DtStart.StartsWith("-"))                     //先判断是否以-开头
                {
                    string subdtStartStr = DtStart.Substring(1); //取-剩下的字符串
                    if (!IsNumberic(subdtStartStr))
                    {
                        return(null);
                    }
                }
                if (DtEnd.StartsWith("-"))                   //先判断是否以-开头
                {
                    string subdtEndStr = DtEnd.Substring(1); //取-剩下的字符串
                    if (!IsNumberic(subdtEndStr))
                    {
                        return(null);
                    }
                }
                //if (!IsNumberic(DtStart) || !IsNumberic(DtEnd)) return null;
                d1 = Convert.ToInt32(DtStart.Trim());//gettostr(DtStart);
                d2 = Convert.ToInt32(DtEnd.Trim());
                //StrTip = "日落-日出偏移量 为分钟数值";
            }

            //int optimeset = OpTimeSet;
            //if (OpTimeSet < 4) optimeset = OpTimeSet - 1;
            var rtn = new Wlst.client.FaultTypes.FaultSettingRuleOne()
            {
                FaultsAddTo       = new List <int>(),
                AlarmTimeEnd      = d2,
                AlarmTimeSet      = OpTimeSet - 1,
                AlarmTimeStart    = d1,
                FaultsRemoveOff   = (from t in ItemsRemoveto where t.IsSelected select t.Value).ToList(),
                ProperyContainKey =
                    (from t in ProperyContainKey where string.IsNullOrEmpty(t.Name) == false select t.Name)
                    .ToList(),

                Op       = Op,
                OpExtend = Op_extend,

                RuleId          = RuleId,
                RuleName        = Rule_name,
                TargetEquipment = 1
            };

            return(rtn);
        }