public CustomJsonResult Add(string pOperater, RopSysMenuAdd rop) { var sysMenu = new SysMenu(); sysMenu.Id = GuidUtil.New(); sysMenu.Name = rop.Name; sysMenu.Url = rop.Url; sysMenu.Description = rop.Description; sysMenu.PId = rop.PMenuId; sysMenu.IsCanDelete = true; sysMenu.Creator = pOperater; sysMenu.CreateTime = DateTime.Now; CurrentDb.SysMenu.Add(sysMenu); CurrentDb.SaveChanges(); if (rop.PermissionIds != null) { foreach (var id in rop.PermissionIds) { CurrentDb.SysMenuPermission.Add(new SysMenuPermission { Id = GuidUtil.New(), MenuId = sysMenu.Id, PermissionId = id, Creator = pOperater, CreateTime = DateTime.Now }); } } CurrentDb.SaveChanges(); return(new CustomJsonResult(ResultType.Success, ResultCode.Success, "添加成功")); }
public CustomJsonResult Add(string operater, RopAdminOrgAdd rop) { var result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { var isExists = CurrentDb.SysOrg.Where(m => m.Name == rop.Name).FirstOrDefault(); if (isExists != null) { return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "该名称已经存在")); } var sysOrg = new SysOrg(); sysOrg.Id = GuidUtil.New(); sysOrg.Name = rop.Name; sysOrg.Description = rop.Description; sysOrg.PId = rop.PId; sysOrg.BelongSite = Enumeration.BelongSite.Admin; sysOrg.ReferenceId = GuidUtil.Empty(); sysOrg.Depth = 0; sysOrg.CreateTime = DateTime.Now; sysOrg.Creator = operater; CurrentDb.SysOrg.Add(sysOrg); CurrentDb.SaveChanges(); ts.Complete(); result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "保存成功"); } return(result); }
public CustomJsonResult Delete(string pOperater, string[] pMenuIds) { if (pMenuIds != null) { foreach (var id in pMenuIds) { var sysMenu = CurrentDb.SysMenu.Where(m => m.Id == id).FirstOrDefault(); if (!sysMenu.IsCanDelete) { return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, string.Format("所选菜单({0})不允许删除", sysMenu.Name))); } CurrentDb.SysMenu.Remove(sysMenu); var sysRoleMenus = CurrentDb.SysRoleMenu.Where(r => r.MenuId == id).ToList(); foreach (var sysRoleMenu in sysRoleMenus) { CurrentDb.SysRoleMenu.Remove(sysRoleMenu); } CurrentDb.SaveChanges(); } } return(new CustomJsonResult(ResultType.Success, ResultCode.Success, "删除成功")); }
public CustomJsonResult Cancle(int operater, string orderSn) { CustomJsonResult result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { var order = CurrentDb.Order.Where(m => m.Sn == orderSn).FirstOrDefault(); if (order == null) { return(new CustomJsonResult(ResultType.Failure, "找不到该订单")); } if (order.Status == Enumeration.OrderStatus.Completed) { return(new CustomJsonResult(ResultType.Failure, "该已经完成,不能取消")); } if (order.Status == Enumeration.OrderStatus.Cancled) { return(new CustomJsonResult(ResultType.Failure, "该已经被取消")); } order.CancleTime = this.DateTime; order.Status = Enumeration.OrderStatus.Cancled; CurrentDb.SaveChanges(); ts.Complete(); result = new CustomJsonResult(ResultType.Success, "该订单取消成功"); } return(result); }
public CustomJsonResult Edit(string operater, RopAdminOrgEdit rop) { CustomJsonResult result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { var sysOrg = CurrentDb.SysOrg.Where(m => m.Id == rop.Id).FirstOrDefault(); if (sysOrg == null) { return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "数据为空")); } sysOrg.Name = rop.Name; sysOrg.Description = rop.Description; sysOrg.MendTime = DateTime.Now; sysOrg.Mender = operater; CurrentDb.SaveChanges(); ts.Complete(); result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "保存成功"); } return(result); }
public CustomJsonResult Edit(string operater, string merchId, RopPrdKindEdit rop) { CustomJsonResult result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { var prdKind = CurrentDb.PrdKind.Where(m => m.Id == rop.Id).FirstOrDefault(); if (prdKind == null) { return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "数据为空")); } prdKind.Name = rop.Name; prdKind.DispalyImgUrls = rop.DispalyImgUrls.ToJsonString(); prdKind.MainImgUrl = ImgSet.GetMain(prdKind.DispalyImgUrls); prdKind.Description = rop.Description; prdKind.MendTime = DateTime.Now; prdKind.Mender = operater; CurrentDb.SaveChanges(); ts.Complete(); result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "保存成功"); } return(result); }
private CustomJsonResult PayCarClaimCompleted(int operater, string orderSn) { CustomJsonResult result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { var orderToCarClaim = CurrentDb.OrderToCarClaim.Where(m => m.Sn == orderSn).FirstOrDefault(); if (orderToCarClaim.Status == Enumeration.OrderStatus.Completed) { ts.Complete(); return(new CustomJsonResult(ResultType.Success, ResultCode.Success, "该订单已经支付完成")); } if (orderToCarClaim.Status != Enumeration.OrderStatus.WaitPay) { ts.Complete(); return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "该订单未在就绪支付状态")); } orderToCarClaim.Status = Enumeration.OrderStatus.Completed; orderToCarClaim.PayTime = this.DateTime; orderToCarClaim.CompleteTime = this.DateTime; orderToCarClaim.LastUpdateTime = this.DateTime; orderToCarClaim.Mender = operater; if (orderToCarClaim.HandOrderId != null) { var handOrder = CurrentDb.OrderToCarClaim.Where(m => m.Id == orderToCarClaim.HandOrderId.Value).FirstOrDefault(); handOrder.Status = Enumeration.OrderStatus.Completed; handOrder.PayTime = this.DateTime; handOrder.CompleteTime = this.DateTime; handOrder.LastUpdateTime = this.DateTime; handOrder.Mender = operater; CurrentDb.SaveChanges(); var bizProcessesAudit = CurrentDb.BizProcessesAudit.Where(m => m.AduitType == Enumeration.BizProcessesAuditType.OrderToCarClaim && m.AduitReferenceId == orderToCarClaim.HandOrderId.Value).FirstOrDefault(); if (bizProcessesAudit != null) { BizFactory.BizProcessesAudit.ChangeAuditDetails(Enumeration.OperateType.Submit, Enumeration.CarClaimDealtStep.Complete, bizProcessesAudit.Id, operater, null, "支付完成", this.DateTime); BizFactory.BizProcessesAudit.ChangeCarClaimDealtStatus(operater, bizProcessesAudit.Id, Enumeration.CarClaimDealtStatus.Complete); } } CurrentDb.SaveChanges(); ts.Complete(); result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "该订单支付结果反馈成功"); } return(result); }
private CustomJsonResult App_ResultNotify(int operater, OrderPayResultNotifyByAppLog receiveNotifyLog) { CustomJsonResult result = new CustomJsonResult(); try { using (TransactionScope ts = new TransactionScope()) { var order = CurrentDb.Order.Where(m => m.Sn == receiveNotifyLog.OrderSn).FirstOrDefault(); if (order == null) { if (!string.IsNullOrEmpty(receiveNotifyLog.Order)) { receiveNotifyLog.Creator = 0; receiveNotifyLog.CreateTime = DateTime.Now; CurrentDb.OrderPayResultNotifyByAppLog.Add(receiveNotifyLog); CurrentDb.SaveChanges(); } ts.Complete(); return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "找不到对应的订单号")); } receiveNotifyLog.MerchantId = order.MerchantId; receiveNotifyLog.PosMachineId = order.PosMachineId; receiveNotifyLog.UserId = order.UserId; receiveNotifyLog.Creator = 0; receiveNotifyLog.CreateTime = DateTime.Now; switch (order.Type) { case Enumeration.OrderType.PosMachineServiceFee: result = PayServiceFeeCompleted(operater, order.Sn); break; case Enumeration.OrderType.LllegalQueryRecharge: result = PayLllegalQueryRechargeCompleted(operater, order.Sn); break; case Enumeration.OrderType.LllegalDealt: result = PayLllegalDealtCompleted(operater, order.Sn); break; } CurrentDb.OrderPayResultNotifyByAppLog.Add(receiveNotifyLog); CurrentDb.SaveChanges(); ts.Complete(); } } catch (Exception ex) { Log.ErrorFormat("订单号({0})结果反馈发生异常,原因:{1}", receiveNotifyLog.OrderSn, ex.StackTrace); result = new CustomJsonResult(ResultType.Exception, ResultCode.Exception, "支付通知失败"); } return(result); }
public CustomJsonResult Confirm(int operater, PayConfirmModel model) { CustomJsonResult result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { OrderConfirmInfo yOrder = new OrderConfirmInfo(); switch (model.OrderType) { case Enumeration.OrderType.PosMachineServiceFee: #region 务费 var orderToServiceFee = CurrentDb.OrderToServiceFee.Where(m => m.Sn == model.OrderSn).FirstOrDefault(); //yOrder = BizFactory.Merchant.GetOrderConfirmInfoByServiceFee(orderToServiceFee); result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "确认成功", yOrder); #endregion break; } CurrentDb.SaveChanges(); ts.Complete(); } return(result); }
public CustomJsonResult RemoveMachine(string operater, string merchId, RopStoreRemoveMachine rop) { CustomJsonResult result = new CustomJsonResult(); using (TransactionScope ts = new TransactionScope()) { var merchMachine = CurrentDb.MerchMachine.Where(m => m.MerchId == merchId && m.MachineId == rop.MachineId).FirstOrDefault(); if (merchMachine == null) { return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "找不到商户的机器")); } if (string.IsNullOrEmpty(merchMachine.StoreId)) { return(new CustomJsonResult(ResultType.Failure, ResultCode.Failure, "已被移除")); } merchMachine.StoreId = null; merchMachine.Mender = operater; merchMachine.MendTime = DateTime.Now; CurrentDb.SaveChanges(); ts.Complete(); result = new CustomJsonResult(ResultType.Success, ResultCode.Success, "移除成功"); } return(result); }