Ejemplo n.º 1
0
        public String CheckEmbassyInfo(EmbassyViewPage CheckEmbassyInfo)
        {
            var Embassy = db.Embassy.ToList();

            if (String.IsNullOrEmpty(CheckEmbassyInfo.CompanyName))
            {
                return("企业名称不为空");
            }
            string name   = "^[a-zA-Z0-9\u4e00-\u9fa5]{1,}$";//字母数字汉字
            Regex  rxname = new Regex(name);

            if (!rxname.IsMatch(CheckEmbassyInfo.CompanyName))
            {
                return("请输入正确格式");
            }

            Embassy = Embassy.Where(s => s.CompanyName.Contains(CheckEmbassyInfo.CompanyName)).ToList();

            if (Embassy.Count > 0)
            {
                return("该企业已认证");
            }

            return("添加成功!");
        }
Ejemplo n.º 2
0
        public void Add(EmbassyViewPage EmbassyAdd)
        {
            Embassy EmbassyInfo = new Embassy();

            EmbassyInfo.EmbassyID   = DateTime.Now.ToString("yyyyMMddHHmmss");
            EmbassyInfo.CompanyName = EmbassyAdd.CompanyName;
            EmbassyInfo.EmbassyType = EmbassyState1.EmbassyAccept;
            EmbassyInfo.EmbassyTime = DateTime.Now;
            db.Embassy.Add(EmbassyInfo);
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        public ActionResult Add(EmbassyViewPage EmbassyAdd)
        {
            IEmbassy IE      = new EmbassyMethod();
            string   message = IE.CheckEmbassyInfo(EmbassyAdd);

            if (message != "添加成功!")
            {
                return(Json(message));
            }
            IE.Add(EmbassyAdd);
            return(Json("添加成功!"));
        }
Ejemplo n.º 4
0
        public EmbassyViewPage Index(string searchString, EmbassyState1 State, int?page)
        {
            EmbassyViewPage xx      = new EmbassyViewPage();
            var             Embassy = db.Embassy.ToList();
            int             pageNumber;
            int             pageSizeNum;
            int             ItemNum;
            int             pageNum;

            if (State == EmbassyState1.All)
            {
                Embassy = Embassy.Where(s => s.CompanyName.Contains(searchString)).ToList();
            }
            else
            {
                if (!String.IsNullOrEmpty(searchString))
                {
                    Embassy = Embassy.Where(s => s.CompanyName.Contains(searchString)).ToList();
                }
                Embassy = Embassy.Where(s => s.EmbassyType == State).ToList();
            }

            pageSizeNum = 5;                                                                                    //每页显示多少条
            ItemNum     = Embassy.Count();                                                                      //数据总数
            pageNum     = (ItemNum % pageSizeNum) == 0 ? (ItemNum / pageSizeNum) : (ItemNum / pageSizeNum) + 1; //总页数
            if (page == 4)
            {
                pageNumber = pageNum;
            }
            else
            {
                pageNumber = page ?? 1;
            }
            Embassy         = Embassy.OrderBy(x => x.EmbassyID).Skip((pageNumber - 1) * pageSizeNum).Take(pageSizeNum).ToList();
            xx.aa           = Embassy;
            xx.pageNumber   = pageNumber;
            xx.pageNumx     = pageNum;
            xx.ItemNum      = ItemNum.ToString();
            xx.searchstring = searchString;
            xx.State        = State;
            return(xx);
        }