Exemple #1
0
        /// <summary>
        /// 查询用户信息
        /// </summary>
        /// <param name="type"></param>
        /// <param name="uiccd"></param>
        /// <returns></returns>
        public async Task <JsonResult> QueryCustInfo(int type, string uiccd)
        {
            Response resp = new Response();

            #region
            CWICCard cwiccd = new CWICCard();
            Customer cust   = null;
            if (type == 1)
            {
                //是卡号
                ICCard iccd = await cwiccd.FindAsync(ic => ic.UserCode == uiccd);

                if (iccd == null)
                {
                    resp.Message = "不是本系统用卡,iccode - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                if (iccd.CustID == 0)
                {
                    resp.Message = "当前用卡为临时用卡,无法完成操作! ICCode - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                cust = cwiccd.FindCust(iccd.CustID);
            }
            else if (type == 2)
            {
                //是车牌
                cust = await cwiccd.FindCustAsync(cc => cc.PlateNum == uiccd);
            }
            else if (type == 3)
            {
                //是车主姓名
                cust = await cwiccd.FindCustAsync(cc => cc.UserName == uiccd);
            }
            if (cust == null)
            {
                resp.Message = "当前用户不存在,无法进行操作!iccode - " + uiccd;
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }
            if (cust.Type == EnmICCardType.Temp)
            {
                resp.Message = "临时用户,不在此界面缴费! iccode - " + uiccd;
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }

            FixChargingRule rule = new CWTariff().FindFixCharge(fix => fix.Unit == EnmFeeUnit.Month && fix.ICType == cust.Type);
            if (rule == null)
            {
                resp.Message = "找不到(月份)收费规则,ICType - " + cust.Type.ToString();
                return(Json(resp, JsonRequestBehavior.AllowGet));
            }

            FixCustInfo info = new FixCustInfo
            {
                CustID       = cust.ID,
                Proof        = uiccd,
                ICType       = (int)cust.Type,
                CurrDeadline = cust.Deadline.ToString(),
                MonthFee     = rule.Fee
            };
            resp.Code    = 1;
            resp.Message = "查询成功";
            resp.Data    = info;

            TempData["CustInfo"] = info;
            #endregion
            return(Json(resp, JsonRequestBehavior.AllowGet));
        }