public void deleteEdit(SearchConditionView s)
        {
            int kpbh    = int.Parse(s.Condition1);
            var newUser = baseDAL.Get <yhxx>().FirstOrDefault(c => c.kpbh == kpbh);

            baseDAL.DeleteItem(newUser);
            baseDAL.SaveAllChanges();
        }
Exemple #2
0
        public ActionResult KHQuery(SearchConditionView searchCondition)
        {
            int         number   = int.Parse(searchCondition.Condition1);
            List <yhxx> yhxxlist = null;

            yhxxlist = baseDAL.Get <yhxx>().Where(c => c.kpbh == number).ToList();

            return(Json(yhxxlist));
        }
        public ActionResult UpdateNewUser(SearchConditionView a)
        {
            // yhxx newYhxx= null;
            // newYhxx.hm = a.Condition1;
            // newYhxx.tel=a.Condition2;
            //  newYhxx.kpbh=int.Parse(a.Condition3);
            int kpbh = int.Parse(a.Condition3);
            int ywbhNum;
            int total = baseDAL.Get <bhIndex>().ToList().Count;

            if (total == 0)
            {
                ywbhNum = 1;
            }
            else
            {
                ywbhNum = total + 1;
            }
            var bhIndex = new bhIndex
            {
                ywbh = ywbhNum,
            };

            baseDAL.AddItem <bhIndex>(bhIndex);
            if (a.Condition1 != null)
            {
                var newUser = baseDAL.Get <yhxx>().FirstOrDefault(c => c.kpbh == kpbh);
                //  newUser.hm = newYhxx.hm;
                //  newUser.tel = newYhxx.tel;
                //  newUser.ywbh = ywbhNum;
                newUser.hm      = a.Condition1;
                newUser.tel     = a.Condition2;
                newUser.ywbh    = ywbhNum;
                newUser.gqcs    = 1;
                Session["ywbh"] = newUser.ywbh;
                Session["hm"]   = newUser.hm;
                Session["zz"]   = newUser.zz;
                Session["yhlx"] = newUser.yhlx;
                Session["tel"]  = newUser.tel;
                Session["gqcs"] = newUser.gqcs;
                baseDAL.SaveAllChanges();
            }
            else
            {
                Session["ywbh"] = ywbhNum;
                Session["hm"]   = null;
                Session["zz"]   = null;
                Session["yhlx"] = 0;
                Session["tel"]  = null;
                Session["gqcs"] = 0;
            }

            return(Json(ywbhNum));
        }
Exemple #4
0
        public ActionResult FindNewUser(SearchConditionView searchCondition)
        {
            List <yhxx> yhxxlist = null;


            if (searchCondition.Condition1 != null)
            {
                yhxxlist = baseDAL.Get <yhxx>().Where(c => c.zz.Contains(searchCondition.Condition1) &&
                                                      c.zz.Contains(searchCondition.Condition2) && c.zz.Contains(searchCondition.Condition3)).ToList();
            }
            else
            {
                int number = int.Parse(searchCondition.Condition2);
                yhxxlist = baseDAL.Get <yhxx>().Where(c => c.kpbh == number).ToList();
            }

            //ViewBag.yhxxlist = yhxxlist;


            return(Json(yhxxlist));
        }
        public string VerifyData(SearchConditionView search)
        {
            byte[] key1   = new byte[20];
            byte[] key2   = new byte[20];
            byte[] ver    = new byte[30];
            byte[] status = new byte[5];
            int    i      = 0;

            st    = IC.lib_ver(ver);
            st    = IC.get_status(icdev, status);
            icdev = IC.ic_init(1, 9600);
            string lbResult;
            string skey = search.Condition1;

            if (skey == null)
            {
                lbResult = "请正确输入数据!";
                return(lbResult);
            }
            int keylen = skey.Length;

            if (keylen != 6)
            {
                lbResult = "请正确输入密码,密码长度不对!";
                return(lbResult);
            }

            for (i = 0; i < keylen; i++)
            {
                if (skey[i] >= '0' && skey[i] <= '9')
                {
                    continue;
                }
                if (skey[i] <= 'a' && skey[i] <= 'f')
                {
                    continue;
                }
                if (skey[i] <= 'A' && skey[i] <= 'F')
                {
                    continue;
                }
            }
            if (i != keylen)
            {
                lbResult = "密码必须为十六进制数!";
                return(lbResult);
            }

            key1 = System.Text.Encoding.ASCII.GetBytes(skey);
            IC.asc_hex(key1, key2, 6);
            st = IC4442.csc_4442(icdev, 3, key2);
            if (st == 0)
            {
                lbResult = "密码校验成功!";
            }
            else
            {
                lbResult = "密码校验失败!";
            }
            return(lbResult);
        }