/// <summary> /// 获取JsApi支付参数 /// </summary> public WxPayParameter GetJsApiPayParameter(string orderNo, int amount, string body, string ip, string openId, string attach = null) { WxPayParameter param = null; var preOrder = CreatePrePayOrder(TenPayV3Type.JSAPI, orderNo, amount, body, ip, openId, null, attach); if (preOrder.IsReturnCodeSuccess() && preOrder.IsResultCodeSuccess()) { param = new WxPayParameter() { AppId = preOrder.appid, PartnerId = preOrder.mch_id, PrepayId = preOrder.prepay_id, NonceStr = preOrder.nonce_str, Timestamp = DateTime2.GetTimestamp().ToString(), Package = string.Format("prepay_id={0}", preOrder.prepay_id), }; param.Sign = GetJsApiPaySign(param.NonceStr, param.Package, param.SignType, param.Timestamp); } else { //预支付订单创建失败,记日志 } return(param); }
public static bool TryParse(string input, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result) { result = MinValue; styles = ValidateStyles(styles, nameof(styles)); var inputOffset = ParseOffset(input); if (inputOffset.HasValue || (styles & DateTimeStyles.AssumeUniversal) > 0) { styles |= DateTimeStyles.AdjustToUniversal; } DateTime dtParsed; if (!DateTime2.TryParse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out dtParsed)) { return(false); } if (inputOffset.HasValue) { result = new DateTimeOffset(dtParsed, inputOffset.Value, false); } else { result = new DateTimeOffset(dtParsed); } return(true); }
/// <summary> /// 获取支付参数 /// </summary> /// <returns></returns> public WxPayParameter GetPayParameter(string orderNo, int amount, string body, string ip, string openId, string attach) { WxPayParameter param = null; var wxOrder = CreatePrePayOrder(orderNo, amount, body, openId, ip, attach); if (wxOrder.IsReturnCodeSuccess() && wxOrder.IsResultCodeSuccess()) { param = new WxPayParameter() { AppId = wxOrder.appid, PartnerId = wxOrder.mch_id, PrepayId = wxOrder.prepay_id, NonceStr = wxOrder.nonce_str, Timestamp = DateTime2.GetTimestamp().ToString(), Package = string.Format("prepay_id={0}", wxOrder.prepay_id) }; //param.Sign = TenPayV3.GetJsPaySign(AppId, param.TimeStamp, param.NonceStr, param.Package, Key, param.SignType); param.Sign = GetPaySign(param.NonceStr, param.Package, param.SignType, param.Timestamp); } else { //预支付订单创建失败,记日志 } return(param); }
/// <summary> /// 获取支付参数 /// </summary> /// <returns></returns> public WxPayParameter GetPayParameter(string orderNo, int amount, string body, string ip, string attach = null) { WxPayParameter param = null; var wxOrder = CreatePrePayOrder(orderNo, amount, body, ip, attach); if (wxOrder.IsReturnCodeSuccess() && wxOrder.IsResultCodeSuccess()) { param = new WxPayParameter() { AppId = wxOrder.appid, PartnerId = wxOrder.mch_id, PrepayId = wxOrder.prepay_id, NonceStr = wxOrder.nonce_str, Timestamp = DateTime2.GetTimestamp().ToString(), Package = "Sign=WXPay", }; param.Sign = GetPaySign(param.NonceStr, param.Package, param.PrepayId, param.Timestamp); } else { //预支付订单创建失败,记日志 Console.WriteLine(wxOrder.ToJson()); } return(param); }
public static bool TryParseExact(string input, string[] formats, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result) { if (formats == null) { throw new ArgumentNullException(nameof(formats)); } if (formats.Length == 0) { throw new FormatException("The list of formats cannot be empty"); } for (int i = 0; i < formats.Length; i++) { if (formats[i].Equals("u", StringComparison.Ordinal)) { formats[i] = UtcFormatString + "Z"; } else if (formats[i].Equals("r", StringComparison.OrdinalIgnoreCase)) { formats[i] = RUtcFormatString + "z"; int gmtIndex = input.Length - 4; if (input.IndexOf(" GMT") == gmtIndex) { input = string.Concat(input.Remove(gmtIndex), "+0"); } } } result = MinValue; styles = ValidateStyles(styles, nameof(styles)); var inputOffset = ParseOffset(input); if (inputOffset.HasValue || (styles & DateTimeStyles.AssumeUniversal) > 0) { styles |= DateTimeStyles.AdjustToUniversal; } DateTime dtParsed; if (!DateTime2.TryParseExact(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out dtParsed)) { return(false); } if (inputOffset.HasValue) { result = new DateTimeOffset(dtParsed, inputOffset.Value, false); } else { result = new DateTimeOffset(dtParsed); } return(true); }
/// <inheritdoc/> public override int GetHashCode() { // Overflow is fine, just wrap. unchecked { int hash = 17; hash *= 23 + DateTime1.GetHashCode(); hash *= 23 + DateTime2.GetHashCode(); hash *= 23 + Date1.GetHashCode(); hash *= 23 + Date2.GetHashCode(); return(hash); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, DirectEventArgs e) { try { string startTime = "'" + DateTime1.GetValue() + "'"; string endTime = "'" + DateTime2.GetValue() + "'"; grp_nhatkytrucap.OutSideQuery = " Time > " + startTime + " and Time < " + endTime; grp_nhatkytrucap.ReloadStore(); wdChooseTime.Hide(); } catch (Exception ex) { Dialog.ShowError(ex.Message); } }
public override string ToString() { return(year + " " + DateTime1.ToString("MMM") + " - " + DateTime2.ToString("MMM")); }
public IActionResult Index() { var user = authProvider.GetCurrentUser(); if (user.Role == "Admin") { ViewBag.Users = authProvider.GetAllUsers(); return(View("AdminIndex", user)); } else { ViewBag.Hours = hoursDAL.GetAllHours(user.UserId, true); // alert section IList <PayrollTable> payrollList = payrollDAL.GetTimeReport(user.UserId); if (payrollList.Count > 0) { int isOver = hoursDAL.IsOverWeeklyHoursAlert(user.UserId, payrollList[0].StartDate, payrollList[0].EndDate); ViewBag.IsOver = isOver; User userRole = authProvider.GetCurrentUser(); ViewBag.UserRole = userRole.Role; } // end of alert section // reminder section if (payrollList.Count > 0) { DateTime startPayPeriodDate = payrollList[0].StartDate; DateTime endPayPeriodDate = payrollList[0].EndDate; DateTime dateToday = DateTime.Now; int numOfWeekendDays = CalculateWeekends(startPayPeriodDate, endPayPeriodDate); // not correct int CalculateWeekends(DateTime DateTime1, DateTime DateTime2) { int iReturn = 0; TimeSpan xTimeSpan; if (DateTime2 > DateTime1) { xTimeSpan = DateTime2.Subtract(DateTime1); } else { xTimeSpan = DateTime1.Subtract(DateTime2); } int iDays = 5 + System.Convert.ToInt32(xTimeSpan.TotalDays); iReturn = (iDays / 7); return(iReturn); } TimeSpan expectedDaysTimeSpan = dateToday.Subtract(startPayPeriodDate); int expectedDaysInt = (int)expectedDaysTimeSpan.TotalDays - numOfWeekendDays; int numberOfDaysLoggedWithCurrentPayPeriod = logDAL.GetUserLogWithinPayPeriod(user.UserId, startPayPeriodDate, endPayPeriodDate); bool allLogsEntered = true; if (expectedDaysInt != numberOfDaysLoggedWithCurrentPayPeriod) { allLogsEntered = false; } ViewBag.AllLogsEntered = allLogsEntered; } // end of reminder section return(View(user)); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { bool isset_ADDR_ID = false; bool isset_ADDRESS = false; bool isset_FLONG = false; bool isset_LAT = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I64) { ADDR_ID = iprot.ReadI64(); isset_ADDR_ID = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { ADDRESS = iprot.ReadString(); isset_ADDRESS = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { AREA = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Double) { FLONG = iprot.ReadDouble(); isset_FLONG = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Double) { LAT = iprot.ReadDouble(); isset_LAT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.String) { REMARK = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { Time = new DateTime2(); Time.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Struct) { Time2 = new DateTime2(); Time2.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_ADDR_ID) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ADDR_ID not set"); } if (!isset_ADDRESS) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ADDRESS not set"); } if (!isset_FLONG) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field FLONG not set"); } if (!isset_LAT) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field LAT not set"); } } finally { iprot.DecrementRecursionDepth(); } }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { bool isset_ID = false; bool isset_CATEGORY = false; bool isset_STATUS = false; bool isset_CONTENT = false; bool isset_SENT_AT = false; bool isset_SENT_COUNT = false; bool isset_REQUEST_AT = false; bool isset_CREATED_AT = false; bool isset_SMS_COUNT = false; bool isset_SURPLUS_COUNT = false; bool isset_SEND_STATE = false; TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { ID = iprot.ReadString(); isset_ID = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { CATEGORY = iprot.ReadI32(); isset_CATEGORY = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { STATUS = iprot.ReadI32(); isset_STATUS = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.String) { PHONE = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.String) { CONTENT = iprot.ReadString(); isset_CONTENT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Struct) { SENT_AT = new DateTime2(); SENT_AT.Read(iprot); isset_SENT_AT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.String) { RESULT = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.String) { CONTACT = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.String) { MODEM_ID = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.I32) { SENT_COUNT = iprot.ReadI32(); isset_SENT_COUNT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.String) { PLATE_NUMBER = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.String) { PLATE_COLOR = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 13: if (field.Type == TType.String) { PECCANCY_TYPE = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 14: if (field.Type == TType.String) { TERMINAL_CODE = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 15: if (field.Type == TType.String) { EVENT_CODE = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 16: if (field.Type == TType.String) { FILE_PATH = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 17: if (field.Type == TType.Struct) { REQUEST_AT = new DateTime2(); REQUEST_AT.Read(iprot); isset_REQUEST_AT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 18: if (field.Type == TType.Struct) { CREATED_AT = new DateTime2(); CREATED_AT.Read(iprot); isset_CREATED_AT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 19: if (field.Type == TType.String) { REMARK = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 20: if (field.Type == TType.String) { IMG_INFO = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 21: if (field.Type == TType.String) { ENTITY_ID = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 22: if (field.Type == TType.I32) { SMS_COUNT = iprot.ReadI32(); isset_SMS_COUNT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 23: if (field.Type == TType.I32) { SURPLUS_COUNT = iprot.ReadI32(); isset_SURPLUS_COUNT = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 24: if (field.Type == TType.Bool) { SEND_STATE = iprot.ReadBool(); isset_SEND_STATE = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 25: if (field.Type == TType.String) { CREATED_BY = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_ID) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_CATEGORY) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_STATUS) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_CONTENT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_SENT_AT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_SENT_COUNT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_REQUEST_AT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_CREATED_AT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_SMS_COUNT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_SURPLUS_COUNT) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_SEND_STATE) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } }
public SmsSendShortMessageDTO(string ID, int CATEGORY, int STATUS, string CONTENT, DateTime2 SENT_AT, int SENT_COUNT, DateTime2 REQUEST_AT, DateTime2 CREATED_AT, int SMS_COUNT, int SURPLUS_COUNT, bool SEND_STATE) : this() { this.ID = ID; this.CATEGORY = CATEGORY; this.STATUS = STATUS; this.CONTENT = CONTENT; this.SENT_AT = SENT_AT; this.SENT_COUNT = SENT_COUNT; this.REQUEST_AT = REQUEST_AT; this.CREATED_AT = CREATED_AT; this.SMS_COUNT = SMS_COUNT; this.SURPLUS_COUNT = SURPLUS_COUNT; this.SEND_STATE = SEND_STATE; }