Example #1
0
        /// <summary>
        /// 确认缴费并分配角色
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public string CheckPayment(Guid Id)
        {
            var            exp    = ExpressionExtension.GetExpression <CookRoleAuthor>("AuthorName", "基本", ExpressionEnum.NotLike);
            CookRoleAuthor author = Kily.Set <CookRoleAuthor>().Where(exp).Where(t => t.IsDelete == false).AsNoTracking().FirstOrDefault();
            CookVip        vip    = Kily.Set <CookVip>().Where(t => t.Id == Id).FirstOrDefault();

            vip.RoleId = author.Id;
            return(UpdateField(vip, "RoleId") ? ServiceMessage.UPDATESUCCESS : ServiceMessage.UPDATEFAIL);
        }
Example #2
0
        /// <summary>
        /// 厨师注册
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public string RegistCookAccount(RequestCookInfo Param)
        {
            Param.IsVip = false;
            CookVip        vip    = Param.MapToEntity <CookVip>();
            CookRoleAuthor author = Kily.Set <CookRoleAuthor>().Where(t => t.IsDelete == false).Where(t => t.AuthorName.Contains("基本")).FirstOrDefault();

            vip.RoleId = author.Id;
            if (NormalUtil.CheckStringChineseUn(vip.Account))
            {
                return("账号不能包含中文和特殊字符");
            }
            return(Insert <CookVip>(vip) ? ServiceMessage.INSERTSUCCESS : ServiceMessage.INSERTFAIL);
        }
Example #3
0
        /// <summary>
        /// 修改账号
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public string EditCookVip(RequestCookInfo Param)
        {
            CookVip vip = Param.MapToEntity <CookVip>();

            if (Param.Id != Guid.Empty)
            {
                return(Update(vip, Param) ? ServiceMessage.UPDATESUCCESS : ServiceMessage.UPDATEFAIL);
            }
            else
            {
                return(Insert(vip) ? ServiceMessage.INSERTSUCCESS : ServiceMessage.INSERTFAIL);
            }
        }
Example #4
0
        /// <summary>
        /// 启用
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public string StartUse(Guid Id)
        {
            CookVip vip = Kily.Set <CookVip>().Where(t => t.Id == Id).First();

            vip.IsDelete = false;
            if (UpdateField <CookVip>(vip, "IsDelete"))
            {
                return(ServiceMessage.UPDATESUCCESS);
            }
            else
            {
                return(ServiceMessage.UPDATEFAIL);
            }
        }
Example #5
0
        /// <summary>
        /// 查询微信支付
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public string WxQueryPay(Guid Param)
        {
            SystemPayInfo PayInfo = Kily.Set <SystemPayInfo>().Where(t => t.GoodsId == Param)
                                    .Where(t => t.PayType == PayEnum.WxPay)
                                    .AsNoTracking().FirstOrDefault();

            if (PayInfo != null)
            {
                String ResultCode = WxPayCore.Instance.QueryWxPay(PayInfo.TradeNo);
                if (string.IsNullOrEmpty(ResultCode))
                {
                    return(null);
                }
                if (ResultCode.Equals("SUCCESS"))
                {
                    CookVip Info = Kily.Set <CookVip>().Where(t => t.Id == Param).FirstOrDefault();
                    PayInfo.PayDes = "SUCCESS";
                    IList <string> Fields = new List <string> {
                        "IsVip", "StartTime", "EndTime"
                    };
                    Info.IsVip     = true;
                    Info.StartTime = DateTime.Now;
                    Info.EndTime   = DateTime.Now.AddYears(Convert.ToInt32(PayInfo.TagNum));
                    if (string.IsNullOrEmpty(PayInfo.PayDes))
                    {
                        UpdateField(PayInfo, "PayDes");
                        UpdateField(Info, null, Fields);
                    }
                    return("http://system.cfda.vip/StaticHtml/WxNotify.html");
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }