private void DataSelect_SelectedDateChanged(object sender, System.EventArgs e)
 {
     if (this.DataSelect.IsDropDownOpen && this.DataSelect.IsInitialized)
     {
         this.InitUI();
         this.Clear();
         System.DateTime dt     = this.DataSelect.SelectedDate.Value;
         string          format = "yyyy-MM-dd";
         string          time   = dt.ToString(format, System.Globalization.DateTimeFormatInfo.InvariantInfo);
         System.Globalization.DateTimeFormatInfo info  = new System.Globalization.DateTimeFormatInfo();
         System.Globalization.DateTimeStyles     style = System.Globalization.DateTimeStyles.None;
         this.DataSelect.SelectedDate = new System.DateTime?(System.DateTime.Parse(time, info, style));
         this.Starttime = time + " 00:00:00";
         this.endtime   = time + " 24:00:00";
         if (this.type == MessageActorType.EntStaff)
         {
             Staff staff = this.dataService.GetStaff(this.id);
             if (staff != null)
             {
                 this.viewModel.SendStaffDataSearchMessage(this.sessionService.Uid, staff.Uid, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                 this.sessionService.IsDateSearch = true;
             }
         }
         else
         {
             if (this.type == MessageActorType.CooperationStaff)
             {
                 if (this.coopStaff != null)
                 {
                     this.viewModel.SendCooperationMessageRecordRequestByDate(this.sessionService.Uid, this.coopStaff.Uid, this.coopStaff.ProjectId, this.Starttime, this.page, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                 }
             }
             else
             {
                 EntGroup group = this.dataService.GetEntGroup(this.id);
                 if (group != null)
                 {
                     this.viewModel.SendGroupSearchRecord(this.sessionService.Uid, this.id, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CHAT_RECORD);
                     this.sessionService.IsDateSearch = true;
                 }
             }
         }
         this.InitPage();
         this.DataSelect.Text           = this.endtime;
         this.DataSelect.IsDropDownOpen = false;
     }
 }
Ejemplo n.º 2
0
 private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.DateSelect.IsDropDownOpen && this.DateSelect.Text != this.startTime)
     {
         this.DateSearch = true;
         this.trgMessageTable.Rows.Clear();
         System.DateTime dt     = this.DateSelect.SelectedDate.Value;
         string          format = "yyyy-MM-dd";
         string          time   = dt.ToString(format, System.Globalization.DateTimeFormatInfo.InvariantInfo);
         System.Globalization.DateTimeFormatInfo info  = new System.Globalization.DateTimeFormatInfo();
         System.Globalization.DateTimeStyles     style = System.Globalization.DateTimeStyles.None;
         this.DateSelect.SelectedDate = new System.DateTime?(System.DateTime.Parse(time, info, style));
         this.startTime = time + " 00:00:00";
         this.endTime   = time + " 24:00:00";
         this.messageCenter.SendOADataSearch(this.sessionService.Uid, this.startTime, 0, 10, this.type, this.endTime);
     }
 }
Ejemplo n.º 3
0
 private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.DateSelect.IsInitialized && this.DateSelect.IsDropDownOpen)
     {
         System.DateTime dt     = this.DateSelect.SelectedDate.Value;
         string          format = "yyyy-MM-dd";
         string          time   = dt.ToString(format, System.Globalization.DateTimeFormatInfo.InvariantInfo);
         System.Globalization.DateTimeFormatInfo info  = new System.Globalization.DateTimeFormatInfo();
         System.Globalization.DateTimeStyles     style = System.Globalization.DateTimeStyles.None;
         this.DateSelect.SelectedDate = new System.DateTime?(System.DateTime.Parse(time, info, style));
         this.Starttime = time + " 00:00:00";
         this.endtime   = time + " 24:00:00";
         this.Showpage  = 0;
         if (this.IsMark)
         {
             if (this.IsStaff)
             {
                 this.messageCenter.SendStaffDateSearchMark(this.sessionService.Uid, this.ID, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CENTER_RECORD);
                 this.IsDataSearch = true;
             }
             else
             {
                 this.messageCenter.SendGroupDateSearchMark(this.ID, this.Starttime, 0, 10, this.sessionService.Uid, this.endtime, MessageRecordType.MESSAGE_CENTER_RECORD);
                 this.IsDataSearch = true;
             }
         }
         else
         {
             if (this.IsStaff)
             {
                 this.viewModel.SendStaffSearchRecord(this.sessionService.Uid, this.ID, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CENTER_RECORD);
                 this.IsDataSearch = true;
             }
             else
             {
                 this.viewModel.SendGroupSearchRecord(this.sessionService.Uid, this.ID, this.Starttime, 0, 10, this.endtime, MessageRecordType.MESSAGE_CENTER_RECORD);
                 this.IsDataSearch = true;
             }
         }
         this.DateSelect.IsDropDownOpen = false;
     }
 }
Ejemplo n.º 4
0
 public static DateTime?AsNullableDateTime(this object val,
                                           DateTime?dflt = null,
                                           ConvertErrorHandling handling = ConvertErrorHandling.ReturnDefault,
                                           System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None)
 {
     try
     {
         if (val == null)
         {
             return(null);
         }
         return(val.AsDateTime(styles));
     }
     catch
     {
         if (handling != ConvertErrorHandling.ReturnDefault)
         {
             throw;
         }
         return(dflt);
     }
 }
Ejemplo n.º 5
0
    //format options are semicoloned.
    public static DateTime?ParseUSDateTimeNull(this string value, string formatoptions = null)    // formatoptions = Local only.
    {
        DateTime res;

        System.Globalization.DateTimeStyles dts = System.Globalization.DateTimeStyles.AssumeUniversal | System.Globalization.DateTimeStyles.AdjustToUniversal;

        string[] t = formatoptions?.ToLowerInvariant().Split(';');

        if (t != null && Array.IndexOf(t, "local") != -1)
        {
            dts = System.Globalization.DateTimeStyles.AssumeLocal;
        }

        // presuming its univeral means no translation in the values to local.
        if (DateTime.TryParse(value, System.Globalization.CultureInfo.CreateSpecificCulture("en-US"), dts, out res))
        {
            return(res);
        }
        else
        {
            return(null);
        }
    }
 public DateTimeTypeConverter(string p_ToStringFormat, string[] p_ParseFormats, System.Globalization.DateTimeStyles p_DateTimeStyles)
 {
     parseFormats = p_ParseFormats;
       format = p_ToStringFormat;
       dateTimeStyles = p_DateTimeStyles;
 }
Ejemplo n.º 7
0
 public IsoDateTimeConverter()
 {
     Class6.yDnXvgqzyB5jw();
     this._dateTimeStyles = System.Globalization.DateTimeStyles.RoundtripKind;
     base();
 }
 public DateTimeTypeConverter(string p_ToStringFormat, string[] p_ParseFormats, System.Globalization.DateTimeStyles p_DateTimeStyles)
 {
     parseFormats   = p_ParseFormats;
     format         = p_ToStringFormat;
     dateTimeStyles = p_DateTimeStyles;
 }
Ejemplo n.º 9
0
        public static DateTime AsDateTime(this object val, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None)
        {
            if (val is string)
            {
                var sval = ((string)val).Trim();

                if (DateTime.TryParse(sval, null, styles, out var dtval))
                {
                    return(dtval);
                }

                long ival;
                if (long.TryParse(sval, out ival))
                {
                    return(ival.FromSecondsSinceUnixEpochStart());
                }

                double dval;
                if (double.TryParse(sval, out dval))
                {
                    return(((long)dval).FromSecondsSinceUnixEpochStart());
                }

                decimal dcval;
                if (decimal.TryParse(sval, out dcval))
                {
                    return(((long)dcval).FromSecondsSinceUnixEpochStart());
                }
            }

            if (val is int _int)
            {
                return(((long)_int).FromSecondsSinceUnixEpochStart());
            }
            if (val is uint _uint)
            {
                return(((long)_uint).FromSecondsSinceUnixEpochStart());
            }
            if (val is long _long)
            {
                return((_long).FromSecondsSinceUnixEpochStart());
            }
            if (val is ulong _ulong)
            {
                return((_ulong).FromSecondsSinceUnixEpochStart());
            }

            if (val is double _double)
            {
                return(((long)_double).FromSecondsSinceUnixEpochStart());
            }
            if (val is float _float)
            {
                return(((long)_float).FromSecondsSinceUnixEpochStart());
            }
            if (val is decimal _decimal)
            {
                return(((long)_decimal).FromSecondsSinceUnixEpochStart());
            }

            return(Convert.ToDateTime(val, INVARIANT));
        }
Ejemplo n.º 10
0
 /// <summary>Parses a date string.</summary>
 /// <param name="value">The value to parse.</param>
 /// <param name="formatProvider">The format provider.</param>
 /// <param name="styles">The styles to use.</param>
 /// <returns>The date.</returns>
 /// <remarks>
 /// Any time component of the string is ignored.
 /// </remarks>
 public static Date Parse(string value, IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles)
 {
     return(new Date(DateTime.Parse(value, formatProvider, styles)));
 }
Ejemplo n.º 11
0
 public static DateTime ParseDateTime(string value, string format, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles)
 {
     // Parse
     if (value != null && value.Length > 0)
     {
         return(DateTime.ParseExact(value, format, formatProvider, styles));
     }
     else
     {
         return(Null.DateTime);
     }
 }