Пример #1
0
        //供应商分页
        public ActionResult SelectGongYing(int pageIndex, int pageSize, string Id, string name)
        {
            GongYingBLL     bll  = new GongYingBLL();
            List <supplier> list = bll.Suppliers();

            var obj = from a in list
                      where a.isDel == 1
                      select new
            {
                supplierNum  = a.supplierNum,
                supplierName = a.supplierName,
                phone        = a.phone,
                chuanzhen    = a.chuanzhen,
                email        = a.email,
                contacts     = a.contacts,
                address      = a.address,
                contents     = a.contents,
                supplierLeix = a.supplierLeix1.supplierLeixName
            };

            if (!string.IsNullOrEmpty(Id))
            {
                obj = obj.Where(p => p.supplierNum.Contains(Id));
            }
            if (!string.IsNullOrEmpty(name))
            {
                obj = obj.Where(p => p.supplierName.Contains(name));
            }
            obj = obj.OrderBy(p => p.supplierNum).Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        //新增供应商
        public ActionResult AddGongYing(string supplierLeix, string supplierName, string phone, string chuanzhen, string email, string contacts, string address, string contents)
        {
            GongYingBLL     bll = new GongYingBLL();
            List <supplier> list = bll.Suppliers();
            int             shu = list.Count(); string zhang = shu.ToString();
            string          supplierNum = null;

            if (zhang.Length == 1)
            {
                supplierNum = "00000" + (shu + 1);
            }
            else if (zhang.Length == 2)
            {
                supplierNum = "0000" + (shu + 1);
            }
            else if (zhang.Length == 3)
            {
                supplierNum = "000" + (shu + 1);
            }
            supplier a = new supplier();

            a.supplierNum = supplierNum; a.supplierLeix = supplierLeix; a.supplierName = supplierName; a.phone = phone; a.chuanzhen = chuanzhen;
            a.email       = email; a.contacts = contacts; a.address = address; a.contents = contents; a.isDel = 1;
            bll.Add(a);

            return(Json("新增成功!", JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        //供应商页面
        public ActionResult GongYing()
        {
            GongYingBLL bll = new GongYingBLL();

            ViewBag.gg = bll.SupplierLeixes();
            return(View());
        }
Пример #4
0
        //删除供应商
        public ActionResult DeleteGongYing(string supplierNum)
        {
            GongYingBLL bll = new GongYingBLL();

            bll.delete(supplierNum);
            return(Json("删除成功!", JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        //修改供应商
        public ActionResult UdpateGongYing(string supplierLeix, string supplierName, string phone, string chuanzhen, string email, string contacts, string address, string contents, string supplierNum)
        {
            GongYingBLL     bll  = new GongYingBLL();
            List <supplier> list = bll.Suppliers();
            supplier        a    = new supplier();

            a.supplierNum = supplierNum; a.supplierLeix = supplierLeix; a.supplierName = supplierName; a.phone = phone; a.chuanzhen = chuanzhen;
            a.email       = email; a.contacts = contacts; a.address = address; a.contents = contents; a.isDel = 1;
            bll.Udpate(a);

            return(Json("修改成功!", JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        //供应商表的总条数
        public ActionResult SelectGongYings(string Id, string name)
        {
            GongYingBLL     bll  = new GongYingBLL();
            List <supplier> list = bll.Suppliers();
            var             obj  = from a in list where a.isDel == 1 select a;

            if (!string.IsNullOrEmpty(Id))
            {
                obj = obj.Where(p => p.supplierNum.Contains(Id));
            }
            if (!string.IsNullOrEmpty(name))
            {
                obj = obj.Where(p => p.supplierName.Contains(name));
            }
            return(Json(obj.Count(), JsonRequestBehavior.AllowGet));
        }
Пример #7
0
        //查询一个供应商
        public ActionResult SelectOneGongYing(string supplierNum)
        {
            GongYingBLL     bll  = new GongYingBLL();
            List <supplier> list = bll.Suppliers();
            var             su   = from a in list
                                   where  a.supplierNum == supplierNum
                                   select new
            {
                supplierNum  = a.supplierNum,
                supplierName = a.supplierName,
                phone        = a.phone,
                chuanzhen    = a.chuanzhen,
                email        = a.email,
                contacts     = a.contacts,
                address      = a.address,
                contents     = a.contents,
                supplierLeix = a.supplierLeix
            };

            return(Json(su, JsonRequestBehavior.AllowGet));
        }