public JsonResult AddXian(string orderAmount, string orderId) { OrderInfo o = ServiceHelper.Create <IOrderService>().GetOrder(long.Parse(orderId)); decimal dmmoney = decimal.Parse(orderAmount); int cointypes = int.Parse(o.CoinType.ToString()); long oid = long.Parse(orderId); ApplyAmountInfo model = new ApplyAmountInfo(); model.ApplyUserId = base.CurrentUser.Id; model.AuthorId = base.CurrentUser.ParentSellerId; model.ApplyAmount = dmmoney; model.OrderId = oid; model.ApplyDate = DateTime.Now; model.AuthDate = DateTime.Now; model.ApplyStatus = 0; model.CoinType = cointypes; bool flag = ServiceHelper.Create <IApplyAmountService>().AddApplyAmount(model); ServiceHelper.Create <ISiteMessagesService>().SendLimitedAmountMessage(base.CurrentUser.ParentSellerId); if (flag) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public JsonResult IsExitsApply(long orderId) { ApplyAmountInfo ApplyInfo = ServiceHelper.Create <IApplyAmountService>().GetApplyByOrderId(base.CurrentUser.Id, orderId); if (ApplyInfo != null) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public ApplyAmountInfo GetApplyById(long Id) { ApplyAmountInfo ApplyAmount = context.ApplyAmountInfo.FirstOrDefault((ApplyAmountInfo m) => m.Id == Id); UserMemberInfo userInfo = context.UserMemberInfo.FirstOrDefault((UserMemberInfo m) => m.Id.Equals(ApplyAmount.ApplyUserId)); ApplyAmount.ApplyName = (userInfo == null ? "" : userInfo.UserName); if (ApplyAmount != null) { UserMemberInfo userInfos = context.UserMemberInfo.FirstOrDefault((UserMemberInfo m) => m.Id.Equals(ApplyAmount.AuthorId)); ApplyAmount.AuthorName = (userInfo == null ? "" : userInfos.UserName); ChemCloud_Dictionaries dicts = context.ChemCloud_Dictionaries.FirstOrDefault((ChemCloud_Dictionaries m) => m.DictionaryTypeId == 1 && m.DValue == ApplyAmount.CoinType.ToString()); ApplyAmount.CoinName = dicts.DKey; } return(ApplyAmount); }
public JsonResult IsLimitedAmountOver(long Id, int Cointype) { ApplyAmountInfo ApplyAmount = ServiceHelper.Create <IApplyAmountService>().GetApplyById(Id); Organization orgInfo = ServiceHelper.Create <IOrganizationService>().GetOrganizationByUserId(base.CurrentUser.Id); LimitedAmount limited = ServiceHelper.Create <IOrganizationService>().GetlimitedByRoleId(orgInfo.RoleId, Cointype); if (ApplyAmount.ApplyAmount > limited.Money) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public bool Delete(long Id) { ApplyAmountInfo ApplyAmount = GetApplyById(Id); context.ApplyAmountInfo.Remove(ApplyAmount); int i = context.SaveChanges(); if (i > 0) { return(true); } else { return(false); } }
public bool UpdateAuthor(long Id, long ParentId) { ApplyAmountInfo ApplyAmount = GetApplyById(Id); ApplyAmount.AuthorId = ParentId; int i = context.SaveChanges(); if (i > 0) { return(true); } else { return(false); } }
public ActionResult Auth(long Id) { ApplyAmountInfo model = ServiceHelper.Create <IApplyAmountService>().GetApplyById(Id); OrderInfo orderModel = ServiceHelper.Create <IOrderService>().GetOrder(model.OrderId); Organization orgInfo = ServiceHelper.Create <IOrganizationService>().GetOrganizationByUserId(base.CurrentUser.Id); if (orgInfo.RoleName != "管理员" && orgInfo.RoleName != "Admin") { LimitedAmount limited = ServiceHelper.Create <IOrganizationService>().GetlimitedByRoleId(orgInfo.RoleId, model.CoinType); ViewBag.Money = limited.Money; } ViewBag.AuthorId = base.CurrentUser.Id; ViewBag.Id = Id; ViewBag.RoleName = orgInfo.RoleName; ViewBag.orderId = orderModel.Id; return(View(model)); }
public bool UpdateApplyStatus(long Id, int status, long AuthorId) { ApplyAmountInfo ApplyAmount = GetApplyById(Id); ApplyAmount.AuthorId = AuthorId; ApplyAmount.AuthDate = DateTime.Now; ApplyAmount.ApplyStatus = status; int i = context.SaveChanges(); if (i > 0) { return(true); } else { return(false); } }
public bool IsPassAuth(long UserId, long OrderId) { ApplyAmountInfo ApplyAmount = context.ApplyAmountInfo.FirstOrDefault((ApplyAmountInfo m) => m.ApplyUserId == UserId && m.ApplyAmount == OrderId); if (ApplyAmount != null) { if (ApplyAmount.ApplyStatus == 1) { return(true); } else { return(false); } } else { return(false); } }
/// <summary> /// 修改“限额申请” /// </summary> /// <param name="query"></param> /// <returns></returns> public Result_Msg Update_Apply(QueryCommon <ApplyAmountInfo> query) { Result_Msg res = new Result_Msg(); ApplyAmountInfo ApplyAmount = GetApplyById(query.ParamInfo.Id); ApplyAmount.ApplyDate = query.ParamInfo.ApplyDate; ApplyAmount.ApplyAmount = query.ParamInfo.ApplyAmount; ApplyAmount.CoinType = query.ParamInfo.CoinType; ApplyAmount.ApplyStatus = query.ParamInfo.ApplyStatus; int i = context.SaveChanges(); if (i > 0) { res.IsSuccess = true; } else { res.IsSuccess = false; } return(res); }
public bool AddApplyAmount(ApplyAmountInfo ApplyAmount) { int i = 0; try { // 写数据库 context.ApplyAmountInfo.Add(ApplyAmount); i = context.SaveChanges(); } catch (DbEntityValidationException dbEx) { } if (i > 0) { return(true); } else { return(false); } }
public JsonResult UpdateApplyStatus(long Id, int status, long AuthorId) { bool flag = ServiceHelper.Create <IApplyAmountService>().UpdateApplyStatus(Id, status, base.CurrentUser.Id); ApplyAmountInfo ApplyAmount = ServiceHelper.Create <IApplyAmountService>().GetApplyById(Id); if (flag) { if (status == 1) { ServiceHelper.Create <ISiteMessagesService>().SendApplyPassMessage(ApplyAmount == null ? 0 : ApplyAmount.ApplyUserId); } else if (status == 2) { ServiceHelper.Create <ISiteMessagesService>().SendApplyNoPassMessage(ApplyAmount == null ? 0 : ApplyAmount.ApplyUserId); } return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public JsonResult AddApplyAmount(long applyUserId, decimal orderAmount, long orderId, int coinType) { ApplyAmountInfo model = new ApplyAmountInfo() { ApplyUserId = applyUserId, AuthorId = base.CurrentUser.ParentSellerId, ApplyAmount = orderAmount, ApplyDate = DateTime.Now, CoinType = coinType, OrderId = orderId }; bool flag = ServiceHelper.Create <IApplyAmountService>().AddApplyAmount(model); ServiceHelper.Create <ISiteMessagesService>().SendLimitedAmountMessage(base.CurrentUser.Id); if (ServiceHelper.Create <IMemberService>().GetMemberByName(base.CurrentUser.UserName) != null) { string email = ServiceHelper.Create <IMemberService>().GetMemberByName(base.CurrentUser.UserName).Email; string mailsubject = "您的限额申请审核已通过"; string mailcontent = ""; long LanguageType = long.Parse(System.Configuration.ConfigurationManager.AppSettings["Language"].ToString()); MessageSetting models = ServiceHelper.Create <IMessageSettingService>().GetSettingByLanguageType(ChemCloud.Model.MessageSetting.MessageModuleStatus.LimitedAount, LanguageType); if (models != null) { mailcontent = models.MessageContent == null ? mailcontent : models.MessageContent; } string str = mailcontent.Replace("#userName", base.CurrentUser.UserName); ChemCloud.Service.SendMail.SendEmail(email, mailsubject, str); } if (flag) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public ApplyAmountInfo GetApplyByUserId(long UserId, long OrderId) { ApplyAmountInfo ApplyAmount = context.ApplyAmountInfo.FirstOrDefault((ApplyAmountInfo m) => m.ApplyUserId == UserId && m.OrderId == OrderId); return(ApplyAmount); }
public ActionResult Detail(long Id) { ApplyAmountInfo model = ServiceHelper.Create <IApplyAmountService>().GetApplyById(Id); return(View(model)); }
public JsonResult CheckMyMoney(string price, string onum) { Organization oinfo = ServiceHelper.Create <IOrganizationService>().GetOrganizationByUserId(base.CurrentUser.Id); PurchaseRolesInfo roleInfo = ServiceHelper.Create <IPermissionGroupService>().GetPurchaseRole(oinfo.RoleId); if (roleInfo != null) { if ((roleInfo.RoleName == "管理员") || (roleInfo.RoleName == "Admin")) { return(Json("ok")); } else { if (oinfo != null) { OrderInfo o = ServiceHelper.Create <IOrderService>().GetOrder(long.Parse(onum)); LimitedAmount la = ServiceHelper.Create <IOrganizationService>().GetlimitedByRoleId(oinfo.RoleId, int.Parse(o.CoinType.ToString())); if (la != null) { decimal usermoney = la.Money; decimal ordermoney = decimal.Parse(price); if (usermoney >= ordermoney) { return(Json("ok")); } else { //申请判断 ApplyAmountInfo aai = ServiceHelper.Create <IApplyAmountService>().GetApplyByUserId(base.CurrentUser.Id, long.Parse(onum)); if (aai != null) { int status = aai.ApplyStatus; if (status == 0) { return(Json("您已提交限额申请,请耐心等待")); } else if (status == 1) { return(Json("ok")); } else { return(Json("您提交限额申请没有通过,请进行重新提交")); } } else { return(Json("你的限额受限"));//你的限额受限,是否提交申请? } } } else { return(Json("获取您的限额信息失败")); } } else { return(Json("您现在还没有组织架构哦")); } } } else { return(Json("您现在还没有权限组哦")); } }