示例#1
0
        /// <summary>
        /// 使用明进康刷卡器时,由物理卡号查询用户信息
        /// </summary>
        /// <param name="code"></param>
        /// <param name="isPhysc"></param>
        /// <returns></returns>
        public ActionResult FindCardOfGUI(string iccode, bool isPhysc)
        {
            CWICCard cwiccd = new CWICCard();
            ICCard   iccd   = null;

            if (isPhysc)
            {
                iccd = cwiccd.Find(ic => ic.PhysicCode == iccode);
            }
            else
            {
                iccd = cwiccd.Find(ic => ic.UserCode == iccode);
            }
            if (iccd == null)
            {
                iccd = new ICCard();
                if (isPhysc)
                {
                    //如果查找不到该卡号,则查询下存车指纹库内,是否有,有的话,其编号多少
                    SaveCertificate scert = new CWSaveProof().Find(s => s.Proof == iccode);
                    if (scert != null)
                    {
                        iccd.PhysicCode = iccode;
                        iccd.UserCode   = scert.SNO.ToString();
                        iccd.Status     = EnmICCardStatus.Init;
                        iccd.CreateDate = DateTime.Parse("2017-1-1");
                        iccd.LossDate   = DateTime.Parse("2017-1-1");
                        iccd.LogoutDate = DateTime.Parse("2017-1-1");
                    }
                }
            }
            return(Json(iccd, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        /// <summary>
        /// 全库查找
        /// </summary>
        /// <returns></returns>
        private CLocation AllocateLocation(int region)
        {
            CWICCard         cwiccd       = new CWICCard();
            List <CLocation> locationList = new List <CLocation>();

            var lcta = from lct in locations
                       where lct.Type == CLocation.EnmLocationType.Normal &&
                       lct.Status == CLocation.EnmLocationStatus.Space &&
                       string.Compare(lct.Size, carsize) == 0 &&
                       cwiccd.FindFixICCard(lct.Address) == null &&
                       lct.ICCardCode == ""
                       orderby Math.Abs(lct.Region - region), lct.Index ascending
            select lct;

            locationList.AddRange(lcta);

            var lctb = from lct in locations
                       where lct.Type == CLocation.EnmLocationType.Normal &&
                       lct.Status == CLocation.EnmLocationStatus.Space &&
                       string.Compare(lct.Size, carsize) > 0 &&
                       cwiccd.FindFixICCard(lct.Address) == null &&
                       lct.ICCardCode == ""
                       orderby Math.Abs(lct.Region - region), lct.Index ascending
            select lct;

            locationList.AddRange(lctb);

            if (locationList.Count > 0)
            {
                return(locationList[0]);
            }
            return(null);
        }
示例#3
0
        public ActionResult MakeCard()
        {
            string   physc = Request.Form["physccode"];
            string   code  = Request.Form["iccode"];
            Response resp  = new CWICCard().MakeICCard(physc, code);

            return(Json(resp, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public ActionResult Edit(int ID)
        {
            CustomerModel model  = new CustomerModel();
            CWICCard      cwiccd = new CWICCard();
            Customer      cust   = cwiccd.FindCust(ID);

            model.ID            = cust.ID;
            model.UserName      = cust.UserName;
            model.FamilyAddress = cust.FamilyAddress;
            model.MobilePhone   = cust.MobilePhone;
            model.PlateNum      = cust.PlateNum;
            model.Type          = cust.Type;
            model.Warehouse     = cust.Warehouse;
            model.LocAddress    = cust.LocAddress;
            model.Deadline      = cust.Deadline.ToString();

            ICCard iccd = cwiccd.Find(ic => ic.CustID == ID);

            if (iccd != null)
            {
                model.UserCode = iccd.UserCode;
                model.Status   = iccd.Status;
            }

            List <SelectListItem> items = new List <SelectListItem>();

            foreach (var tp in Enum.GetValues(typeof(EnmICCardType)))
            {
                SelectListItem item = new SelectListItem()
                {
                    Text = tp.ToString(), Value = tp.ToString()
                };
                items.Add(item);
            }
            ViewData["list"] = items;

            #region 查找指纹
            List <FingerPrint> printList = new CWFingerPrint().FindList(p => p.CustID == ID);
            if (printList.Count == 1)
            {
                model.FingerPrint1 = printList[0].SN_Number.ToString();
            }
            if (printList.Count == 2)
            {
                model.FingerPrint1 = printList[0].SN_Number.ToString();
                model.FingerPrint2 = printList[1].SN_Number.ToString();
            }
            if (printList.Count == 3)
            {
                model.FingerPrint1 = printList[0].SN_Number.ToString();
                model.FingerPrint2 = printList[1].SN_Number.ToString();
                model.FingerPrint3 = printList[2].SN_Number.ToString();
            }
            #endregion

            return(View(model));
        }
示例#5
0
        public ActionResult FindCard()
        {
            string iccode = Request.QueryString["iccode"];
            ICCard iccd   = new CWICCard().Find(ic => ic.UserCode == iccode);

            if (iccd != null)
            {
                return(Json(iccd, JsonRequestBehavior.AllowGet));
            }
            return(Json(new ICCard(), JsonRequestBehavior.AllowGet));
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="custID"></param>
        /// <returns></returns>
        public ActionResult ChangeDeadline(int custID)
        {
            CWICCard            cwiccd   = new CWICCard();
            Customer            cust     = cwiccd.FindCust(custID);
            ChangeDeadlineModel deadline = new ChangeDeadlineModel
            {
                ID          = cust.ID,
                UserCode    = cust.UserName,
                Type        = cust.Type,
                OldDeadline = cust.Deadline,
                NewDeadline = DateTime.Parse("2017-1-1")
            };

            return(View(deadline));
        }
示例#7
0
 /// <summary>
 /// 异步读卡
 /// </summary>
 /// <returns></returns>
 private Task <ICCard> ReadICCardAsync(string ipaddrs)
 {
     return(Task <ICCard> .Factory.StartNew(() => {
         ICCard iccd = new ICCard {
             PhysicCode = "0", UserCode = ""
         };
         #region
         if (string.IsNullOrEmpty(ipaddrs))
         {
             return iccd;
         }
         Log log = LogFactory.GetLogger("ReadICCardAsync");
         try
         {
             IPAddress ip;
             if (!IPAddress.TryParse(ipaddrs, out ip))
             {
                 return iccd;
             }
             ICCardReader reader = new ICCardReader(ipaddrs);
             bool nback = reader.Connect();
             if (nback)
             {
                 uint physic = 0;
                 int ret = reader.GetPhyscard(ref physic);
                 if (ret == 0)
                 {
                     string physc = physic.ToString();
                     iccd.PhysicCode = physc;
                     ICCard ccd = new CWICCard().Find(ic => ic.PhysicCode == physc);
                     if (ccd != null)
                     {
                         iccd.UserCode = ccd.UserCode;
                     }
                 }
             }
             reader.Disconnect();
         }
         catch (Exception ex)
         {
             log.Error(ex.ToString());
         }
         #endregion
         return iccd;
     }));
 }
示例#8
0
        public ActionResult Delete(int ID)
        {
            #region
            CWICCard cwiccd = new CWICCard();
            Customer cust   = cwiccd.FindCust(ID);
            if (cust != null)
            {
                ICCard iccd = cwiccd.Find(ic => ic.CustID == ID);
                if (iccd != null)
                {
                    iccd.CustID = 0;
                    Response _resp = cwiccd.Update(iccd);
                    if (_resp.Code == 0)
                    {
                        //记录
                    }
                }
                Response resp = cwiccd.Delete(ID);
                if (resp.Code == 0)
                {
                    var data = new
                    {
                        code    = 1,
                        message = "删除用户失败,请联系管理员!"
                    };
                    return(Json(data, JsonRequestBehavior.AllowGet));
                }

                #region  除相关指纹
                CWFingerPrint      fprint    = new CWFingerPrint();
                List <FingerPrint> fingerLst = fprint.FindList(p => p.CustID == ID);
                foreach (FingerPrint print in fingerLst)
                {
                    fprint.Delete(print.ID);
                }
                #endregion
            }
            #endregion
            var nback = new
            {
                code    = 2,
                message = "删除成功!"
            };
            return(Json(nback, JsonRequestBehavior.AllowGet));
        }
示例#9
0
        public ActionResult HandleCard(string iccode, int type)
        {
            CWICCard cwiccd = new CWICCard();
            ICCard   iccd   = cwiccd.Find(ic => ic.UserCode == iccode);

            if (iccd == null)
            {
                var data = new Response
                {
                    Code    = 0,
                    Message = "找不到该卡"
                };
                return(Json(data));
            }
            switch (type)
            {
            case 1:
                iccd.Status   = EnmICCardStatus.Lost;
                iccd.LossDate = DateTime.Now;
                break;

            case 2:
                iccd.Status   = EnmICCardStatus.Normal;
                iccd.LossDate = DateTime.Parse("2017-1-1");
                break;

            case 3:
                iccd.Status     = EnmICCardStatus.Disposed;
                iccd.LogoutDate = DateTime.Now;
                break;

            default:
                break;
            }
            Response resp = cwiccd.Update(iccd);

            return(Json(resp));
        }
示例#10
0
        public async Task <ActionResult> SetFixUserFee()
        {
            Log      log  = LogFactory.GetLogger("SetFixUserFee");
            Response resp = new Response();

            #region
            CWICCard cwiccd = new CWICCard();
            try
            {
                string proof = Request.Form["uiccd"];
                //计费类型
                string feetype = Request.Form["feetype"];
                //费用标准
                string feeStd = Request.Form["feeunit"];
                //实收费用
                string actualfee = Request.Form["actualfee"];

                if (TempData["CustInfo"] == null)
                {
                    resp.Message = "请先点击< 查询信息 >,再 确认缴费 !";
                    return(Json(resp));
                }

                FixCustInfo oldInfo = (FixCustInfo)TempData["CustInfo"];
                if (proof.Trim() != oldInfo.Proof.Trim())
                {
                    resp.Message = "查询条件已改变,请先点击< 查询信息 >,再 确认缴费 !";
                    return(Json(resp));
                }
                Customer cust = await cwiccd.FindCustAsync(oldInfo.CustID);

                float standard = Convert.ToSingle(feeStd);
                float actual   = Convert.ToSingle(actualfee);
                int   rnd      = (int)(actual / standard);

                EnmFeeUnit unit   = (EnmFeeUnit)Convert.ToInt16(feetype);
                int        months = 0;
                switch (unit)
                {
                case EnmFeeUnit.Month:
                    months = 1 * rnd;
                    break;

                case EnmFeeUnit.Season:
                    months = 3 * rnd;
                    break;

                case EnmFeeUnit.Year:
                    months = 12 * rnd;
                    break;

                default:
                    break;
                }
                if (months == 0)
                {
                    resp.Message = "系统异常,rnd- " + rnd + " , Unit- " + unit.ToString();
                    return(Json(resp));
                }
                DateTime current = cust.Deadline;
                if (current == DateTime.Parse("2017-1-1"))
                {
                    current = DateTime.Now;
                }
                cust.StartDTime = DateTime.Now;
                cust.Deadline   = current.AddMonths(months);
                //更新期限
                resp = cwiccd.UpdateCust(cust);

                oldInfo.LastDeadline = oldInfo.CurrDeadline;
                oldInfo.CurrDeadline = cust.Deadline.ToString();

                if (resp.Code == 1)
                {
                    #region 记录日志
                    string uty = "";
                    switch (cust.Type)
                    {
                    case EnmICCardType.Periodical:
                        uty = "定期用户";
                        break;

                    case EnmICCardType.FixedLocation:
                        uty = "固定用户";
                        break;

                    default:
                        uty = cust.Type.ToString();
                        break;
                    }
                    string umsg = "";
                    switch (unit)
                    {
                    case EnmFeeUnit.Month:
                        umsg = "月";
                        break;

                    case EnmFeeUnit.Season:
                        umsg = "季";
                        break;

                    case EnmFeeUnit.Year:
                        umsg = "年";
                        break;

                    default:
                        break;
                    }
                    string           oprt   = User.Identity.Name;
                    FixUserChargeLog fixlog = new FixUserChargeLog
                    {
                        UserName     = cust.UserName,
                        PlateNum     = cust.PlateNum,
                        UserType     = uty,
                        Proof        = oldInfo.Proof,
                        LastDeadline = oldInfo.LastDeadline,
                        CurrDeadline = oldInfo.CurrDeadline,
                        FeeType      = umsg,
                        FeeUnit      = standard,
                        CurrFee      = actual,
                        OprtCode     = oprt,
                        RecordDTime  = DateTime.Now
                    };

                    await new CWTariffLog().AddFixLogAsync(fixlog);

                    #endregion

                    resp.Message = "缴费成功!";

                    NBackInfo nback = new NBackInfo()
                    {
                        LastDeadline = oldInfo.LastDeadline,
                        CurrDeadline = oldInfo.CurrDeadline
                    };
                    resp.Data = nback;
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            #endregion
            return(Json(resp));
        }
示例#11
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));
        }
示例#12
0
        /// <summary>
        /// 查询车位
        /// </summary>
        /// <param name="locinfo">库区_边_列_层</param>
        /// <returns></returns>
        public async Task <JsonResult> GetLocation(string locinfo)
        {
            string[] info = locinfo.Split('_');
            if (info.Length < 4)
            {
                var nback = new
                {
                    code = 0,
                    data = "数据长度不正确," + locinfo
                };
                return(Json(nback, JsonRequestBehavior.AllowGet));
            }
            Location lctn = null;

            int    wh      = Convert.ToInt32(info[0]);
            string address = info[1] + info[2].PadLeft(2, '0') + info[3].PadLeft(2, '0');

            lctn = await new CWLocation().FindLocationAsync(lc => lc.Address == address && lc.Warehouse == wh);
            if (lctn == null)
            {
                var nback = new
                {
                    code = 0,
                    data = "找不到车位," + locinfo
                };
                return(Json(nback, JsonRequestBehavior.AllowGet));
            }

            Customer cust     = new CWICCard().FindFixLocationByAddress(lctn.Warehouse, lctn.Address);
            int      isfix    = 0;
            string   custname = "";
            string   deadline = "";
            string   rcdplate = "";

            if (cust != null)
            {
                isfix    = 1;
                custname = cust.UserName;
                deadline = cust.Deadline.ToString();
                rcdplate = cust.PlateNum;
            }
            LocsMapping map = new LocsMapping
            {
                Warehouse = lctn.Warehouse,
                Address   = lctn.Address,
                LocSide   = lctn.LocSide,
                LocColumn = lctn.LocColumn,
                LocLayer  = lctn.LocLayer,
                Type      = lctn.Type,
                Status    = lctn.Status,
                LocSize   = lctn.LocSize,
                ICCode    = lctn.ICCode,
                WheelBase = lctn.WheelBase,
                CarWeight = lctn.CarWeight,
                CarSize   = lctn.CarSize,
                InDate    = lctn.InDate.ToString(),
                PlateNum  = lctn.PlateNum,
                IsFixLoc  = isfix,
                CustName  = custname,
                Deadline  = deadline,
                RcdPlate  = rcdplate
            };
            var ret = new
            {
                code = 1,
                data = map
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
示例#13
0
        /// <summary>
        /// 初始化界面用
        /// </summary>
        /// <returns></returns>
        public async Task <JsonResult> GetLocationList()
        {
            Log log = LogFactory.GetLogger("GetLocationList");

            try
            {
                CWICCard cwiccd = new CWICCard();

                List <Location> locList      = await new CWLocation().FindLocationListAsync();
                List <Customer> bindCustsLst = await cwiccd.FindCustListAsync(cc => cc.Type == EnmICCardType.FixedLocation || cc.Type == EnmICCardType.VIP);

                List <LocsMapping> mappingsLst = new List <LocsMapping>();
                foreach (Location loc in locList)
                {
                    Customer cust     = bindCustsLst.Find(cc => cc.LocAddress == loc.Address && cc.Warehouse == loc.Warehouse);
                    int      isfix    = 0;
                    string   custname = "";
                    string   deadline = "";
                    string   rcdplate = "";

                    if (cust != null)
                    {
                        isfix    = 1;
                        custname = cust.UserName;
                        deadline = cust.Deadline.ToString();
                        rcdplate = cust.PlateNum;
                    }
                    LocsMapping map = new LocsMapping
                    {
                        Warehouse = loc.Warehouse,
                        Address   = loc.Address,
                        LocSide   = loc.LocSide,
                        LocColumn = loc.LocColumn,
                        LocLayer  = loc.LocLayer,
                        Type      = loc.Type,
                        Status    = loc.Status,
                        LocSize   = loc.LocSize,
                        ICCode    = loc.ICCode,
                        WheelBase = loc.WheelBase,
                        CarWeight = loc.CarWeight,
                        CarSize   = loc.CarSize,
                        InDate    = loc.InDate.ToString(),
                        PlateNum  = loc.PlateNum,
                        IsFixLoc  = isfix,
                        CustName  = custname,
                        Deadline  = deadline,
                        RcdPlate  = rcdplate
                    };
                    mappingsLst.Add(map);
                }
                var nback = new
                {
                    code = 1,
                    data = mappingsLst
                };
                return(Json(nback, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            var bback = new
            {
                code = 0,
                data = "系统异常"
            };

            return(Json(bback, JsonRequestBehavior.AllowGet));
        }
示例#14
0
        public ActionResult FindCustomList(int?pageSize, int?pageIndex,
                                           string sortOrder, string sortName,
                                           string queryName, string queryValue)
        {
            #region
            CWICCard             cwiccd  = new CWICCard();
            List <Customer>      custLst = cwiccd.FindCustList(cust => true);
            List <CustomerModel> models  = new List <CustomerModel>();
            foreach (Customer cust in custLst)
            {
                CustomerModel model = new CustomerModel();
                model.ID            = cust.ID;
                model.UserName      = cust.UserName;
                model.PlateNum      = cust.PlateNum;
                model.Type          = cust.Type;
                model.Warehouse     = cust.Warehouse;
                model.LocAddress    = cust.LocAddress;
                model.MobilePhone   = cust.MobilePhone;
                model.Deadline      = cust.Deadline.ToString();
                model.FamilyAddress = cust.FamilyAddress;

                ICCard iccd = cwiccd.Find(ic => ic.CustID == cust.ID);
                if (iccd != null)
                {
                    model.UserCode = iccd.UserCode;
                    model.Status   = iccd.Status;
                }
                models.Add(model);
            }

            List <CustomerModel> firstQuery = new List <CustomerModel>();
            if (queryName != "0" && !string.IsNullOrEmpty(queryValue))
            {
                #region
                if (queryName == "UserCode")
                {
                    firstQuery = models.Where(md => md.UserCode.Contains(queryValue)).ToList();
                }
                else if (queryName == "Type")
                {
                    EnmICCardType type = EnmICCardType.Init;
                    if (queryValue.Contains("临时"))
                    {
                        type = EnmICCardType.Temp;
                    }
                    else if (queryValue.Contains("定期"))
                    {
                        type = EnmICCardType.Periodical;
                    }
                    else if (queryValue.Contains("固定"))
                    {
                        type = EnmICCardType.FixedLocation;
                    }
                    else if (queryValue.ToUpper().Contains("VIP"))
                    {
                        type = EnmICCardType.VIP;
                    }
                    firstQuery = models.Where(md => md.Type == type).ToList();
                }
                else if (queryName == "UserName")
                {
                    firstQuery = models.Where(md => md.UserName.Contains(queryValue)).ToList();
                }
                else if (queryName == "FamilyAddress")
                {
                    firstQuery = models.Where(md => md.FamilyAddress.Contains(queryValue)).ToList();
                }
                else if (queryName == "MobilePhone")
                {
                    firstQuery = models.Where(md => md.MobilePhone.Contains(queryValue)).ToList();
                }
                else if (queryName == "LocAddress")
                {
                    firstQuery = models.Where(md => md.LocAddress == queryValue).ToList();
                }
                else if (queryName == "PlateNum")
                {
                    firstQuery = models.Where(md => md.PlateNum.Contains(queryValue)).ToList();
                }
                #endregion
            }
            else
            {
                firstQuery.AddRange(models);
            }
            #region 排序 只允许几个字段可以排序
            List <CustomerModel> sortList = new List <CustomerModel>();
            if (!string.IsNullOrEmpty(sortName))
            {
                if (sortName == "ID")
                {
                    if (sortOrder.ToLower() == "asc")
                    {
                        var sort = from cu in firstQuery
                                   orderby cu.ID ascending
                                   select cu;
                        sortList.AddRange(sort);
                    }
                    else
                    {
                        var sort = from cu in firstQuery
                                   orderby cu.ID descending
                                   select cu;
                        sortList.AddRange(sort);
                    }
                }
                else if (sortName == "Type")
                {
                    if (sortOrder.ToLower() == "asc")
                    {
                        var sort = from cu in firstQuery
                                   orderby(int) cu.Type ascending
                                   select cu;

                        sortList.AddRange(sort);
                    }
                    else
                    {
                        var sort = from cu in firstQuery
                                   orderby(int) cu.Type descending
                                   select cu;

                        sortList.AddRange(sort);
                    }
                }
                else if (sortName == "LocAddress")
                {
                    if (sortOrder.ToLower() == "asc")
                    {
                        var sort = from cu in firstQuery
                                   orderby cu.LocAddress ascending
                                   select cu;
                        sortList.AddRange(sort);
                    }
                    else
                    {
                        var sort = from cu in firstQuery
                                   orderby cu.LocAddress descending
                                   select cu;
                        sortList.AddRange(sort);
                    }
                }
                else if (sortName == "UserCode")
                {
                    if (sortOrder.ToLower() == "asc")
                    {
                        var sort = from cu in firstQuery
                                   orderby cu.UserCode ascending
                                   select cu;
                        sortList.AddRange(sort);
                    }
                    else
                    {
                        var sort = from cu in firstQuery
                                   orderby cu.UserCode descending
                                   select cu;
                        sortList.AddRange(sort);
                    }
                }
                else
                {
                    sortList.AddRange(firstQuery);
                }
            }
            else
            {
                sortList.AddRange(firstQuery);
            }
            #endregion

            #endregion
            #region 分页
            int index = 1;
            int size  = 10;
            if (pageSize != null)
            {
                size = (int)pageSize;
            }
            if (pageIndex != null)
            {
                index = (int)pageIndex;
            }
            int total = firstQuery.Count;
            List <CustomerModel> last = sortList.Skip((index - 1) * size).Take(size).ToList();
            #endregion
            var value = new
            {
                total = total,
                rows  = last
            };

            Task.Factory.StartNew(() =>
            {
                #region  除没有绑定用户的指纹(垃圾指纹)
                CWFingerPrint cwfinger             = new CWFingerPrint();
                List <FingerPrint> noCustFPrintLst = cwfinger.FindList(fp => fp.CustID == 0);
                foreach (FingerPrint print in noCustFPrintLst)
                {
                    cwfinger.Delete(print.ID, false);
                }

                #endregion
            });

            return(Json(value));
        }
示例#15
0
        /// <summary>
        /// 推送车位信息
        /// </summary>
        /// <param name="loc"></param>
        private void FileWatch_LctnWatchEvent(int type, Location loca)
        {
            try
            {
                #region 更新车位状态
                if (loca != null)
                {
                    Customer cust     = new CWICCard().FindFixLocationByAddress(loca.Warehouse, loca.Address);
                    int      isfix    = 0;
                    string   custname = "";
                    string   deadline = "";
                    string   platenum = "";
                    if (cust != null)
                    {
                        isfix    = 1;
                        custname = cust.UserName;
                        deadline = cust.Deadline.ToString();
                        platenum = cust.PlateNum;
                    }

                    LocsMapping map = new LocsMapping
                    {
                        Warehouse = loca.Warehouse,
                        Address   = loca.Address,
                        LocSide   = loca.LocSide,
                        LocColumn = loca.LocColumn,
                        LocLayer  = loca.LocLayer,
                        Type      = loca.Type,
                        Status    = loca.Status,
                        LocSize   = loca.LocSize,
                        ICCode    = loca.ICCode,
                        WheelBase = loca.WheelBase,
                        CarWeight = loca.CarWeight,
                        CarSize   = loca.CarSize,
                        InDate    = loca.InDate.ToString(),
                        PlateNum  = loca.PlateNum,
                        IsFixLoc  = isfix,
                        CustName  = custname,
                        Deadline  = deadline,
                        RcdPlate  = platenum
                    };

                    Clients.All.feedbackLocInfo(map);
                }
                #endregion
                #region 更新统计信息
                Task.Factory.StartNew(() =>
                {
                    var info = new CWLocation().GetLocStatisInfo();
                    Clients.All.feedbackStatistInfo(info);

                    var data = new
                    {
                        small = info.SmallSpace,
                        big   = info.BigSpace
                    };
                    string json = JsonConvert.SerializeObject(data);
                    Clients.All.LocStateToLed(json);
                });
                #endregion
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
        }
示例#16
0
        public async Task <ActionResult> ChangeDeadline(ChangeDeadlineModel model)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "参数设置不正确");
                return(View(model));
            }
            Log log = LogFactory.GetLogger("ChangeDeadline");

            try
            {
                CWICCard cwiccd = new CWICCard();
                Customer cust   = await cwiccd.FindCustAsync(model.ID);

                if (cust != null)
                {
                    if ((int)cust.Type < 2)
                    {
                        ModelState.AddModelError("", "临时卡,无法设置使用期限");
                        return(View(model));
                    }
                    string olddeadline = cust.Deadline.ToString();

                    cust.Deadline = model.NewDeadline;
                    Response resp = cwiccd.UpdateCust(cust);
                    if (resp.Code == 1)
                    {
                        string oprtname = User.Identity.Name;
                        string utype    = "";
                        if (cust.Type == EnmICCardType.FixedLocation)
                        {
                            utype = "固定";
                        }
                        else if (cust.Type == EnmICCardType.Periodical)
                        {
                            utype = "定期";
                        }

                        FixUserChargeLog fixlog = new FixUserChargeLog
                        {
                            UserName     = cust.UserName,
                            PlateNum     = cust.PlateNum,
                            UserType     = utype,
                            Proof        = "手动",
                            LastDeadline = olddeadline,
                            CurrDeadline = cust.Deadline.ToString(),
                            FeeType      = "",
                            FeeUnit      = 0,
                            CurrFee      = 0,
                            RecordDTime  = DateTime.Now,
                            OprtCode     = oprtname
                        };
                        await new CWTariffLog().AddFixLogAsync(fixlog);
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());

                ModelState.AddModelError("", "系统异常,请联系厂家!");
                return(View(model));
            }
        }
示例#17
0
        public ActionResult Edit(CustomerModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            CWICCard cwiccd = new CWICCard();

            #region 验证用户名、车牌号
            //顾客姓名保证唯一的
            Customer other = cwiccd.FindCust(cu => cu.UserName == model.UserName && cu.ID != model.ID);
            if (other != null)
            {
                ModelState.AddModelError("", "当前顾客名-  " + model.UserName +
                                         " 已被占用,其车牌号- " + other.PlateNum + " ,请输入唯一的用户名!");
                return(View(model));
            }
            //车牌号码保证唯一的
            other = cwiccd.FindCust(cu => cu.PlateNum == model.PlateNum && cu.ID != model.ID);
            if (other != null)
            {
                ModelState.AddModelError("", "当前车牌号-  " + model.PlateNum +
                                         " 已被绑定,其顾客名- " + other.UserName + " ,请输入正确的车牌号!");
                return(View(model));
            }
            #endregion
            #region
            Customer cust    = cwiccd.FindCust(model.ID);
            Location origloc = null;
            //原来是否绑定
            if (cust.Type == EnmICCardType.FixedLocation)
            {
                origloc = new CWLocation().FindLocation(l => l.Warehouse == cust.Warehouse && l.Address == cust.LocAddress);
            }

            //是固定卡时
            if (model.Type == EnmICCardType.FixedLocation)
            {
                #region
                if (model.Warehouse == 0 || string.IsNullOrEmpty(model.LocAddress))
                {
                    ModelState.AddModelError("", "固定卡,请指定绑定的库区及车位号!");
                    return(View(model));
                }
                Location lctn = new CWLocation().FindLocation(lc => lc.Warehouse == model.Warehouse && lc.Address == model.LocAddress);
                if (lctn == null)
                {
                    ModelState.AddModelError("", "固定卡,请正确的库区及车位地址!");
                    return(View(model));
                }
                else
                {
                    //固定车位时,当前车位没有存车
                    if (lctn.Status != EnmLocationStatus.Space)
                    {
                        ModelState.AddModelError("", "当前车位:" + lctn.Address + " 已存车,卡号- " + lctn.ICCode + " ,请等待取车完成后再绑定!");
                        return(View(model));
                    }
                }

                Customer custo = cwiccd.FindCust(cc => cc.Warehouse == model.Warehouse && cc.LocAddress == model.LocAddress);
                if (custo != null)
                {
                    if (custo.ID != cust.ID)
                    {
                        ModelState.AddModelError("", "当前车位已被别的用户绑定");
                        return(View(model));
                    }
                }
                cust.Type       = model.Type;
                cust.Warehouse  = (int)model.Warehouse;
                cust.LocAddress = model.LocAddress;

                //释放原车位
                if (origloc != null)
                {
                    if (origloc.Address != lctn.Address)
                    {
                        SingleCallback.Instance().WatchFixLocation(origloc, 0, "", "", "");
                    }
                }
                //绑定当前车位
                SingleCallback.Instance().WatchFixLocation(lctn, 1, cust.UserName, cust.Deadline.ToString(), cust.PlateNum);
                #endregion
            }
            else
            {
                cust.Type       = model.Type;
                cust.Warehouse  = 0;
                cust.LocAddress = "";
                cust.StartDTime = DateTime.Parse("2017-1-1");
                cust.Deadline   = DateTime.Parse("2017-1-1");

                //释放原车位
                if (origloc != null)
                {
                    SingleCallback.Instance().WatchFixLocation(origloc, 0, "", "", "");
                }
            }

            ICCard oriIccd = cwiccd.Find(ic => ic.CustID == model.ID);
            ICCard newIccd = null;
            if (!string.IsNullOrEmpty(model.UserCode))
            {
                newIccd = cwiccd.Find(ic => ic.UserCode == model.UserCode);
                if (newIccd == null)
                {
                    ModelState.AddModelError("", "当前卡号没有注册!");
                    return(View(model));
                }
            }
            if (oriIccd == null)
            {
                //原先没有绑定的
                if (newIccd != null)
                {
                    newIccd.CustID = cust.ID;
                    cwiccd.Update(newIccd);
                }
            }
            else
            {
                if (newIccd == null)
                {
                    //释放原来卡号
                    //释放旧卡
                    oriIccd.CustID = 0;
                    cwiccd.Update(oriIccd);
                }
                else //两卡都存在
                {
                    //不是同一张卡
                    if (oriIccd.UserCode != newIccd.UserCode)
                    {
                        #region
                        if (newIccd.Status != EnmICCardStatus.Normal)
                        {
                            ModelState.AddModelError("", "卡已挂失或注销,无法绑定用户!");
                            return(View(model));
                        }
                        if (newIccd.CustID != 0)
                        {
                            Customer oricust = cwiccd.FindCust(newIccd.CustID);
                            if (oricust != null)
                            {
                                ModelState.AddModelError("", "该卡已被绑定,车主姓名:" + oricust.UserName);
                                return(View(model));
                            }
                        }
                        #endregion
                        //释放旧卡
                        oriIccd.CustID = 0;
                        cwiccd.Update(oriIccd);
                        //绑定新卡
                        newIccd.CustID = cust.ID;
                        cwiccd.Update(newIccd);
                    }
                }
            }

            //允许更新
            cust.PlateNum      = model.PlateNum;
            cust.MobilePhone   = model.MobilePhone;
            cust.UserName      = model.UserName;
            cust.FamilyAddress = model.FamilyAddress;

            cwiccd.UpdateCust(cust);


            #region 更新指纹
            CWFingerPrint cwfprint = new CWFingerPrint();
            if (model.FingerPrint1 != "")
            {
                int         fpvalue = Convert.ToInt32(model.FingerPrint1);
                FingerPrint fp      = cwfprint.Find(fi => fi.SN_Number == fpvalue);
                if (fp != null)
                {
                    if (fp.CustID == 0)
                    {
                        fp.CustID = cust.ID;
                        cwfprint.Update(fp);
                    }
                }
            }
            if (model.FingerPrint2 != "")
            {
                int         fpvalue = Convert.ToInt32(model.FingerPrint2);
                FingerPrint fp      = cwfprint.Find(fi => fi.SN_Number == fpvalue);
                if (fp != null)
                {
                    if (fp.CustID == 0)
                    {
                        fp.CustID = cust.ID;
                        cwfprint.Update(fp);
                    }
                }
            }
            if (model.FingerPrint3 != "")
            {
                int         fpvalue = Convert.ToInt32(model.FingerPrint3);
                FingerPrint fp      = cwfprint.Find(fi => fi.SN_Number == fpvalue);
                if (fp != null)
                {
                    if (fp.CustID == 0)
                    {
                        fp.CustID = cust.ID;
                        cwfprint.Update(fp);
                    }
                }
            }
            #endregion

            #endregion
            return(RedirectToAction("Index"));
        }
示例#18
0
        /// <summary>
        /// 固定用户收费界面出车
        /// </summary>
        /// <returns></returns>
        public ActionResult FixGUIOutCar(int type, string uiccd, int warehouse, int hallID)
        {
            Response resp = new Response();

            #region
            Log log = LogFactory.GetLogger("FixGUIOutCar");
            try
            {
                CWICCard   cwiccd = new CWICCard();
                CWLocation cwlctn = new CWLocation();
                Customer   cust   = null;
                #region
                Location loc = null;
                if (type == 1)
                {
                    #region
                    ////是卡号
                    //ICCard iccd = cwiccd.Find(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);
                    #endregion
                    loc = cwlctn.FindLocation(l => l.ICCode == uiccd);
                }
                else if (type == 2)
                {
                    loc = cwlctn.FindLocation(l => l.PlateNum == uiccd);
                }
                if (loc == null)
                {
                    resp.Message = "当前用户没有存车! Proof - " + uiccd;
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                int             sno   = Convert.ToInt32(loc.ICCode);
                SaveCertificate scert = new CWSaveProof().Find(s => s.SNO == sno);
                if (scert != null)
                {
                    cust = new CWICCard().FindCust(scert.CustID);
                }
                if (type == 3)
                {
                    //是车主姓名
                    cust = cwiccd.FindCust(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));
                }
                if (DateTime.Compare(DateTime.Now, cust.Deadline) > 0)
                {
                    resp.Message = "当前用户已欠费,请缴费后出车! iccode - " + uiccd + " ,Deadline- " + cust.Deadline.ToString();
                    return(Json(resp, JsonRequestBehavior.AllowGet));
                }
                ////如果是以车牌或用户名取车,
                //if (type > 1)
                //{
                //    loc = cwlctn.FindLocation(lc => lc.PlateNum == cust.PlateNum);
                //    //以车牌找不到存车车辆,则以卡号进行查询
                //    if (loc == null)
                //    {
                //        //以绑定的卡号查询
                //        ICCard iccd = cwiccd.Find(ic => ic.CustID == cust.ID);
                //        if (iccd != null)
                //        {
                //            loc = cwlctn.FindLocation(l => l.ICCode == iccd.UserCode);
                //        }
                //    }
                //}
                #endregion
                resp = new CWTaskTransfer(hallID, warehouse).FixGUIGetCar(loc);
            }
            catch (Exception ex)
            {
                log.Error(ex.ToString());
            }
            #endregion
            return(Json(resp, JsonRequestBehavior.AllowGet));
        }
示例#19
0
        /// <summary>
        /// APP,扫码或其它存车,
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveCarInterface()
        {
            Response resp = new Response();

            #region
            Log log = LogFactory.GetLogger("SaveCarInterface");
            try
            {
                byte[] bytes = new byte[Request.InputStream.Length];
                Request.InputStream.Read(bytes, 0, bytes.Length);
                string req = System.Text.Encoding.UTF8.GetString(bytes);
                //显示,记录
                log.Info(req);
                JObject jo = (JObject)JsonConvert.DeserializeObject(req);

                string warehouse = jo["warehouse"].ToString();
                string hallID    = jo["hallID"].ToString();
                string iccode    = jo["iccode"].ToString();
                string plate     = jo["plateNum"].ToString();

                if (string.IsNullOrEmpty(hallID))
                {
                    log.Error("APP存车,hallID为空!");
                    resp.Message = "参数错误,hallID为空!";
                    return(Json(resp));
                }
                if (string.IsNullOrEmpty(plate))
                {
                    log.Error("APP存车,车牌号为空!");
                    resp.Message = "参数错误,车牌号为空!";
                    return(Json(resp));
                }

                int wh   = 1;
                int code = Convert.ToInt32(hallID);

                CWDevice cwdevice = new CWDevice();
                CWTask   motsk    = new CWTask();

                Device moHall = cwdevice.Find(dev => dev.Warehouse == wh && dev.DeviceCode == code);
                if (moHall == null)
                {
                    log.Error("APP存车时, 找不到车厅设备. warehouse - " + warehouse + " ,hallID - " + hallID);
                    resp.Message = "找不到车厅";
                    return(Json(resp));
                }
                if (moHall.Mode != EnmModel.Automatic)
                {
                    log.Error("APP存车时, 车厅不是全自动. warehouse - " + warehouse + " ,hallID - " + hallID);
                    resp.Message = "车厅不是全自动";
                    return(Json(resp));
                }
                if (moHall.HallType == EnmHallType.Entrance ||
                    moHall.HallType == EnmHallType.EnterOrExit)
                {
                    if (moHall.TaskID == 0)
                    {
                        //车厅无车,不能存车
                        log.Error("APP存车时, 车厅无车,不能存车. ");
                        resp.Message = "车厅无车,不能存车";
                        return(Json(resp));
                    }
                    ImplementTask tsk = motsk.Find(moHall.TaskID);
                    if (tsk == null)
                    {
                        log.Error("APP存车时, 依车厅TaskID找不到作业信息,TaskID-" + moHall.TaskID + "  hallCode-" + moHall.DeviceCode);
                        //系统故障
                        resp.Message = "系统异常,找不到作业";
                        return(Json(resp));
                    }
                    if (tsk.Status != EnmTaskStatus.ICarInWaitFirstSwipeCard &&
                        tsk.Status != EnmTaskStatus.TempOCarOutWaitforDrive)
                    {
                        log.Error("APP存车时,不是处于刷卡阶段");
                        resp.Message = "不是处于刷卡阶段";
                        return(Json(resp));
                    }
                    if (tsk.PlateNum != plate)
                    {
                        log.Error("APP存车时,入库识别车牌与给定车牌不一致");
                        resp.Message = "APP绑定车牌与车辆车牌不一致";
                        return(Json(resp));
                    }

                    CWICCard cwiccd = new CWICCard();

                    if (tsk.Type == EnmTaskType.SaveCar)
                    {
                        string   physiccode = "1234567890";
                        Customer cust       = cwiccd.FindCust(cc => cc.PlateNum == plate);
                        if (cust != null)
                        {
                            ICCard iccd = cwiccd.Find(ic => ic.CustID == cust.ID);
                            if (iccd != null)
                            {
                                iccode     = iccd.UserCode;
                                physiccode = iccd.PhysicCode;
                            }
                        }
                        CWSaveProof cwsaveproof = new CWSaveProof();
                        if (string.IsNullOrEmpty(iccode))
                        {
                            iccode = cwsaveproof.GetMaxSNO().ToString();
                        }

                        SaveCertificate scert = new SaveCertificate();
                        scert.IsFingerPrint = 2;
                        scert.Proof         = physiccode;
                        scert.SNO           = Convert.ToInt32(iccode);
                        //添加凭证到存车库中
                        Response respe = cwsaveproof.Add(scert);

                        tsk.PlateNum = plate;
                        //更新作业状态为第二次刷卡,启动流程
                        motsk.DealISwipedSecondCard(tsk, iccode);

                        resp.Code    = 1;
                        resp.Message = "流程进行中";
                        return(Json(resp));
                    }
                    else if (tsk.Type == EnmTaskType.TempGet)
                    {
                        motsk.DealAPPSwipeThreeCard(tsk);
                    }
                }
                else
                {
                    log.Error("APP存车时,不是进(进出)车厅");
                    resp.Message = "不是进(进出)车厅";
                    return(Json(resp));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                resp.Message = "系统异常";
            }
            #endregion
            return(Json(resp));
        }
示例#20
0
        public ActionResult Add(CustomerModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            CWICCard cwiccd = new CWICCard();
            //顾客姓名保证唯一的
            Customer other = cwiccd.FindCust(cu => cu.UserName == model.UserName);

            if (other != null)
            {
                ModelState.AddModelError("", "当前顾客名-  " + model.UserName + " 已被占用,其车牌号- " + other.PlateNum + " ,请输入唯一的用户名!");
                return(View(model));
            }
            string plate = "";

            foreach (char vl in model.PlateNum)
            {
                if (Char.IsLetter(vl))
                {
                    plate += char.ToUpper(vl);
                }
                else
                {
                    plate += vl;
                }
            }

            model.PlateNum = plate;

            //车牌号码保证唯一的
            other = cwiccd.FindCust(cu => cu.PlateNum == model.PlateNum);
            if (other != null)
            {
                ModelState.AddModelError("", "当前车牌号-  " + model.PlateNum + " 已被绑定,其顾客名- " + other.UserName + " ,请输入正确的车牌号!");
                return(View(model));
            }
            Location lctn = null;

            #region
            if (model.Type == EnmICCardType.FixedLocation)
            {
                if (model.Warehouse == 0 || string.IsNullOrEmpty(model.LocAddress))
                {
                    ModelState.AddModelError("", "固定车位卡,请指定绑定车位!");
                    return(View(model));
                }
                lctn = new CWLocation().FindLocation(lc => lc.Warehouse == model.Warehouse && lc.Address == model.LocAddress);
                if (lctn == null)
                {
                    ModelState.AddModelError("", "绑定车位不存在,地址-" + model.LocAddress);
                    return(View(model));
                }
                else
                {
                    //固定车位时,当前车位没有存车
                    if (lctn.Status != EnmLocationStatus.Space)
                    {
                        ModelState.AddModelError("", "当前车位:" + lctn.Address + " 已存车,卡号- " + lctn.ICCode + " ,请等待取车完成后再绑定!");
                        return(View(model));
                    }
                }
            }

            ICCard iccd = null;
            if (!string.IsNullOrEmpty(model.UserCode))
            {
                #region
                iccd = cwiccd.Find(ic => ic.UserCode == model.UserCode);
                if (iccd == null)
                {
                    ModelState.AddModelError("", "当前用户卡号没有注册,请确保该卡已完成制卡!");
                    return(View(model));
                }
                if (iccd.Status != EnmICCardStatus.Normal)
                {
                    ModelState.AddModelError("", "该卡已挂失或注销,无法完成操作!");
                    return(View(model));
                }
                if (iccd.CustID != 0)
                {
                    Customer cust = cwiccd.FindCust(iccd.CustID);
                    if (cust != null)
                    {
                        ModelState.AddModelError("", "该卡已被绑定,车主姓名:" + cust.UserName);
                        return(View(model));
                    }
                }
                #endregion
            }

            Customer addcust = new Customer();
            if (model.Type == EnmICCardType.FixedLocation)
            {
                Customer cust = cwiccd.FindCust(cc => cc.Warehouse == model.Warehouse && cc.LocAddress == model.LocAddress);
                if (cust != null)
                {
                    ModelState.AddModelError("", "该车位已被其他卡绑定,无法使用该车位- " + model.LocAddress + " ,Warehouse- " + model.Warehouse);
                    return(View(model));
                }
                addcust.Warehouse  = (int)model.Warehouse;
                addcust.LocAddress = model.LocAddress;
            }

            addcust.UserName      = model.UserName;
            addcust.PlateNum      = model.PlateNum;
            addcust.FamilyAddress = model.FamilyAddress;
            addcust.MobilePhone   = model.MobilePhone;
            addcust.Type          = EnmICCardType.Temp;
            if ((int)model.Type > 0)
            {
                addcust.Type = model.Type;
            }
            addcust.StartDTime = DateTime.Parse("2017-1-1");
            addcust.Deadline   = DateTime.Parse("2017-1-1");

            Response resp = cwiccd.AddCust(addcust);
            if (resp.Code == 1)
            {
                //如果有卡号,则绑定顾客于卡号
                if (iccd != null)
                {
                    iccd.CustID = addcust.ID;
                    resp        = cwiccd.Update(iccd);
                }

                #region 绑定指纹,更新指纹信息
                CWFingerPrint fprint = new CWFingerPrint();
                if (!string.IsNullOrEmpty(model.FingerPrint1))
                {
                    Int32       sn     = Convert.ToInt32(model.FingerPrint1);
                    FingerPrint finger = fprint.Find(p => p.SN_Number == sn);
                    if (finger != null)
                    {
                        finger.CustID = addcust.ID;
                        fprint.Update(finger);
                    }
                }
                if (!string.IsNullOrEmpty(model.FingerPrint2))
                {
                    Int32       sn     = Convert.ToInt32(model.FingerPrint2);
                    FingerPrint finger = fprint.Find(p => p.SN_Number == sn);
                    if (finger != null)
                    {
                        finger.CustID = addcust.ID;
                        fprint.Update(finger);
                    }
                }
                if (!string.IsNullOrEmpty(model.FingerPrint3))
                {
                    Int32       sn     = Convert.ToInt32(model.FingerPrint3);
                    FingerPrint finger = fprint.Find(p => p.SN_Number == sn);
                    if (finger != null)
                    {
                        finger.CustID = addcust.ID;
                        fprint.Update(finger);
                    }
                }
                #endregion
            }

            if (addcust.Type == EnmICCardType.FixedLocation)
            {
                SingleCallback.Instance().WatchFixLocation(lctn, 1, addcust.UserName, addcust.Deadline.ToString(), addcust.PlateNum);
            }

            #endregion
            return(RedirectToAction("Index"));
        }