/// <summary> 设置订单支付状态 /// </summary> /// <param name="saleFilialeId"></param> /// <param name="orderId"></param> /// <param name="payState"></param> public static void SetOrderPayState(Guid saleFilialeId, Guid orderId, PayState payState) { using (var client = ClientProxy.CreateB2CWcfClient(saleFilialeId)) { client.Instance.SetOrderPayState(Guid.NewGuid(), orderId, (Int32)payState); } }
/// <summary> /// /// </summary> /// <returns></returns> public override bool Update() { switch (m_eState) { case PayState.Nomal: break; case PayState.ReStart: this.m_fDis = Time.fixedTime; this.m_eState++; break; case PayState.ClientSend: float dis = Time.fixedTime - m_fDis; if (dis >= SEND_PER) { this.m_eState = PayState.Nomal; //关闭重新发送,在发送handle中,接受到请求后再进入2s重新发送 } break; case PayState.Sucess: break; default: break; } return(base.Update()); }
// Start is called before the first frame update void Start() { manager = new HFSMManagerSystem(); HomeSystem homeSystem = new HomeSystem("HomeSystem", manager); ReadBookState readBookState = new ReadBookState("ReadBookState", homeSystem, systemText, stateText); readBookState.AddTransition("Cook", "CookState"); CookState cookState = new CookState("CookState", homeSystem, systemText, stateText); cookState.AddTransition("Sleep", "SleepState"); SleepState sleepState = new SleepState("SleepState", homeSystem, systemText, stateText); sleepState.AddTransition("ReadBook", "ReadBookState"); homeSystem.AddState(readBookState); homeSystem.AddState(cookState); homeSystem.AddState(sleepState); MarketSystem marketSystem = new MarketSystem("MarketSystem", manager); BuyState buyState = new BuyState("BuyState", marketSystem, systemText, stateText); buyState.AddTransition("Pay", "PayState"); PayState payState = new PayState("PayState", marketSystem, systemText, stateText); payState.AddTransition("Buy", "BuyState"); marketSystem.AddState(buyState); marketSystem.AddState(payState); manager.AddSubSystem(homeSystem); manager.AddSubSystem(marketSystem); }
/// <summary> /// 根据PayState获取分页数据,并且包含Product、Client、Client.Company对象 /// </summary> /// <param name="payState">付款状态</param> /// <param name="startPage">第N页</param> /// <param name="pageSize">每页记录</param> /// <returns></returns> public List <Order> GetByPayState(PayState payState, int startPage, int pageSize, string searchVal) { Expression <Func <Order, bool> > orderwhere = o => o.PayState == payState; if (!string.IsNullOrEmpty(searchVal)) { orderwhere = orderwhere.And(o => o.Name.Contains(searchVal) || o.CarNo.Contains(searchVal)); } return(LoadPageList(startPage, pageSize, out int count, true, false, orderwhere) .Include(o => o.Product) .Include(o => o.Client) .Include(o => o.Client.Company) .Include(o => o.Payments) .OrderByDescending(o => o.LastUpdatedAt) .ToList()); }
public void UpdatePayNoticState(Guid payid, PayState yon, string des) { var parms = new[] { new SqlParameter(PAYID, SqlDbType.UniqueIdentifier), new SqlParameter(PAYSTATE, SqlDbType.Int), new SqlParameter(PAYDES, SqlDbType.VarChar) }; parms[0].Value = payid; parms[1].Value = (int)yon; parms[2].Value = des; try { SqlHelper.ExecuteNonQuery(GlobalConfig.ERP_DB_NAME, false, SQL_PN_UPDATE_STATE, parms); } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
//public PayState GetState(int StateId) //{ // return _paymentDbContext.PayStates.Find(StateId); //} //public IEnumerable<PayState> GetStates() //{ // return _paymentDbContext.PayStates.ToList(); //} public void InsertState(PayState payState) { _paymentDbContext.Add(payState); Save(); }
public ActionResult <PayState> ProcessPayment(Request request) { if (request != null) { if (request.Amount <= 20) { var cheapPay = new CheapPay(); var payState = cheapPay.ChPay(request); if (payState == Ok()) { _repo.InsertRequest(request); //return payState processed var paych = new PayState() { Id = request.Id, State = "Processed" }; _stateRepository.InsertState(paych); return(new PayState() { Id = request.Id, State = "Processed" });; } } else if (request.Amount > 20 || request.Amount <= 500) { var expPAy = new ExpensivePay(); var payState = expPAy.ChPay(request); if (payState == Ok()) { _repo.InsertRequest(request); //return payState processed var pay = new PayState() { Id = request.Id, State = "Processed" }; _stateRepository.InsertState(pay); return(new PayState() { Id = request.Id, State = "Processed" }); } } else if (request.Amount > 500) { var paye = new PayState() { Id = request.Id, State = "Pending" }; _stateRepository.InsertState(paye); return(new BadRequestObjectResult(new { message = "try only PremiumPaymentService and retry up to 3 times in case payment does not get processed", currentDate = DateTime.Now })); //try only PremiumPaymentService and retry up to 3 times in case payment does not get processed } else { return(BadRequest()); } } var Reerror = new PayState() { Id = request.Id, State = "failed" }; _stateRepository.InsertState(Reerror); return(new PayState() { Id = request.Id, State = "failed" }); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + Id.GetHashCode(); if (When != null) { hashCode = hashCode * 59 + When.GetHashCode(); } if (Actual != null) { hashCode = hashCode * 59 + Actual.GetHashCode(); } hashCode = hashCode * 59 + WorkTime.GetHashCode(); hashCode = hashCode * 59 + ContractedTime.GetHashCode(); hashCode = hashCode * 59 + PayState.GetHashCode(); if (EmployeeType != null) { hashCode = hashCode * 59 + EmployeeType.GetHashCode(); } if (Person != null) { hashCode = hashCode * 59 + Person.GetHashCode(); } if (Assignment != null) { hashCode = hashCode * 59 + Assignment.GetHashCode(); } if (Post != null) { hashCode = hashCode * 59 + Post.GetHashCode(); } if (Posting != null) { hashCode = hashCode * 59 + Posting.GetHashCode(); } if (Cancellation != null) { hashCode = hashCode * 59 + Cancellation.GetHashCode(); } hashCode = hashCode * 59 + InCharge.GetHashCode(); if (Shift != null) { hashCode = hashCode * 59 + Shift.GetHashCode(); } if (Duty != null) { hashCode = hashCode * 59 + Duty.GetHashCode(); } if (Fulfillment != null) { hashCode = hashCode * 59 + Fulfillment.GetHashCode(); } if (CostCentre != null) { hashCode = hashCode * 59 + CostCentre.GetHashCode(); } if (OwningUnit != null) { hashCode = hashCode * 59 + OwningUnit.GetHashCode(); } if (ResourcingUnit != null) { hashCode = hashCode * 59 + ResourcingUnit.GetHashCode(); } if (Requirement != null) { hashCode = hashCode * 59 + Requirement.GetHashCode(); } if (Location != null) { hashCode = hashCode * 59 + Location.GetHashCode(); } if (AdditionalDutyReason != null) { hashCode = hashCode * 59 + AdditionalDutyReason.GetHashCode(); } hashCode = hashCode * 59 + DutyHasWarnings.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns true if HoursAssignment instances are equal /// </summary> /// <param name="other">Instance of HoursAssignment to be compared</param> /// <returns>Boolean</returns> public bool Equals(HoursAssignment other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( When == other.When || When != null && When.Equals(other.When) ) && ( Actual == other.Actual || Actual != null && Actual.Equals(other.Actual) ) && ( WorkTime == other.WorkTime || WorkTime.Equals(other.WorkTime) ) && ( ContractedTime == other.ContractedTime || ContractedTime.Equals(other.ContractedTime) ) && ( PayState == other.PayState || PayState.Equals(other.PayState) ) && ( EmployeeType == other.EmployeeType || EmployeeType != null && EmployeeType.Equals(other.EmployeeType) ) && ( Person == other.Person || Person != null && Person.Equals(other.Person) ) && ( Assignment == other.Assignment || Assignment != null && Assignment.Equals(other.Assignment) ) && ( Post == other.Post || Post != null && Post.Equals(other.Post) ) && ( Posting == other.Posting || Posting != null && Posting.Equals(other.Posting) ) && ( Cancellation == other.Cancellation || Cancellation != null && Cancellation.Equals(other.Cancellation) ) && ( InCharge == other.InCharge || InCharge.Equals(other.InCharge) ) && ( Shift == other.Shift || Shift != null && Shift.Equals(other.Shift) ) && ( Duty == other.Duty || Duty != null && Duty.Equals(other.Duty) ) && ( Fulfillment == other.Fulfillment || Fulfillment != null && Fulfillment.Equals(other.Fulfillment) ) && ( CostCentre == other.CostCentre || CostCentre != null && CostCentre.Equals(other.CostCentre) ) && ( OwningUnit == other.OwningUnit || OwningUnit != null && OwningUnit.Equals(other.OwningUnit) ) && ( ResourcingUnit == other.ResourcingUnit || ResourcingUnit != null && ResourcingUnit.Equals(other.ResourcingUnit) ) && ( Requirement == other.Requirement || Requirement != null && Requirement.Equals(other.Requirement) ) && ( Location == other.Location || Location != null && Location.Equals(other.Location) ) && ( AdditionalDutyReason == other.AdditionalDutyReason || AdditionalDutyReason != null && AdditionalDutyReason.Equals(other.AdditionalDutyReason) ) && ( DutyHasWarnings == other.DutyHasWarnings || DutyHasWarnings.Equals(other.DutyHasWarnings) )); }
/// <summary>修改订单支付状态(不插入异常数据) /// </summary> /// <param name="saleFilialeId"></param> /// <param name="orderId">订单id</param> /// <param name="payState">支付状态</param> /// <param name="state">GoodsOrderPayState订单状态</param> public static bool UpdatePayStateByOrderIdAndStateBool(Guid saleFilialeId, Guid orderId, PayState payState, GoodsOrderPayState state) { var pushDataId = Guid.NewGuid(); using (var client = ClientProxy.CreateB2CWcfClient(saleFilialeId)) { var result = client.Instance.UpdatePayStateByOrderIdAndState(pushDataId, orderId, (Int32)payState, (Int32)state); if (result == null || result.IsAccomplishExecuted == false) { return(false); } return(true); } }