Exemplo n.º 1
0
        //查询客户地址
        public ActionResult SelectDiZhi()
        {
            KeHuBLL bll = new KeHuBLL();
            List <customerAddressInfo> list = bll.CustomerAddressInfo();
            var obj = from p in list where Nullable <int> .Equals(p.customerNum, null) && p.isDel == 1 select new { AddressNum = p.AddressNum, AddressXinxi = p.AddressXinxi, contacts = p.contacts, phone = p.phone };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        //查询一条地址数据
        public ActionResult SelectOneDiZhi(string AddressNum)
        {
            KeHuBLL bll = new KeHuBLL();
            List <customerAddressInfo> list = bll.CustomerAddressInfo();
            var obj = from p in list where p.AddressNum == AddressNum select new { AddressNum = p.AddressNum, AddressXinxi = p.AddressXinxi, contacts = p.contacts, phone = p.phone };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult SelectDiZhiUpdate(string bianhao)
        {
            KeHuBLL bll = new KeHuBLL();
            List <customerAddressInfo> list = bll.CustomerAddressInfo();
            var obj = from p in list where p.customerNum == bianhao && p.isDel == 1 select new { AddressNum = p.AddressNum, AddressXinxi = p.AddressXinxi, contacts = p.contacts, phone = p.phone };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        //修改客户
        public ActionResult UdpateKeHu(string bianhao, string customerName, string phone, string chuanzhen, string email, string contacts)
        {
            KeHuBLL  bll = new KeHuBLL();
            customer cu  = new customer();

            cu.customerNum = bianhao; cu.customerName = customerName; cu.phone = phone;
            cu.chuanzhen   = chuanzhen; cu.email = email; cu.contents = contacts;
            bll.Udpate(cu);
            return(Json("修改成功!", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        //修改地址
        public ActionResult UdpateDiZhi(string AddressNum, string AddressXinxi, string contacts, string phone)
        {
            KeHuBLL             bll  = new KeHuBLL();
            customerAddressInfo info = new customerAddressInfo();

            info.AddressNum = AddressNum; info.AddressXinxi = AddressXinxi;
            info.contacts   = contacts;
            info.phone      = phone;
            bll.UdpatecustomerAddressInfo(info);
            return(Json("修改地址成功!", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        //查询客户
        public ActionResult SelectKeHu(int pageIndex, int pageSize, string customerNum, string customerName)
        {
            KeHuBLL         bll  = new KeHuBLL();
            List <customer> list = bll.Customers();
            var             obj  = from p in list
                                   where p.isDel == 1 && p.customerNum.Contains(customerNum) && p.customerName.Contains(customerName)
                                   select new { customerNum = p.customerNum, customerName = p.customerName, phone = p.phone, chuanzhen = p.chuanzhen, createTime = p.createTime.ToString("yyyy年MM月dd日") };

            obj = obj.OrderBy(p => p.customerNum).Skip((pageIndex - 1) * pageSize).Take(pageSize);
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        //查询一条地址
        public ActionResult SelectOne(string customerNum)
        {
            KeHuBLL         bll  = new KeHuBLL();
            List <customer> list = bll.Customers();
            var             obj  = from p in list
                                   where p.customerNum == customerNum
                                   select new { customerNum = p.customerNum, customerName = p.customerName,
                                                phone       = p.phone,
                                                chuanzhen   = p.chuanzhen,
                                                email       = p.email,
                                                contents    = p.contents };

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 8
0
        //客户总条数
        public ActionResult SelectKeHus(string customerNum, string customerName)
        {
            KeHuBLL         bll  = new KeHuBLL();
            List <customer> list = bll.Customers();
            var             obj  = from p in list
                                   where p.isDel == 1
                                   select p;

            if (!string.IsNullOrEmpty(customerNum))
            {
                obj = obj.Where(p => p.customerNum.Contains(customerNum));
            }
            if (!string.IsNullOrEmpty(customerName))
            {
                obj = obj.Where(p => p.customerName.Contains(customerName));
            }
            return(Json(obj.Count(), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        //新增客户地址
        public ActionResult InsertDiZhi(string AddressXinxi, string phone, string contacts, string bianhao)
        {
            KeHuBLL bll        = new KeHuBLL();
            int     shu        = bll.CustomerAddressInfo().Count();
            string  zhang      = shu.ToString();
            string  AddressNum = null;

            if (zhang.Length == 1)
            {
                AddressNum = "XBLY00" + (shu + 1);
            }
            else if (zhang.Length == 2)
            {
                AddressNum = "XBLY0" + (shu + 1);
            }
            else if (zhang.Length == 3)
            {
                AddressNum = "XBLY" + (shu + 1);
            }
            if (bianhao == "")
            {
                customerAddressInfo info = new customerAddressInfo();
                info.AddressNum = AddressNum; info.AddressXinxi = AddressXinxi;
                info.contacts   = contacts;
                info.phone      = phone; info.isDel = 1;
                bll.AddcustomerAddressInfo(info);
            }
            else
            {
                customerAddressInfo info = new customerAddressInfo();
                info.AddressNum  = AddressNum; info.AddressXinxi = AddressXinxi;
                info.customerNum = bianhao; info.contacts = contacts;
                info.phone       = phone; info.isDel = 1;
                bll.AddcustomerAddressInfo(info);
            }

            return(Json("新增地址成功!", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        //新增客户
        public ActionResult InsertKeHu(string customerName, string phone, string chuanzhen, string email, string contacts)
        {
            KeHuBLL bll         = new KeHuBLL();
            int     shu         = bll.Customers().Count();
            string  zhang       = shu.ToString();
            string  customerNum = null;

            if (zhang.Length == 1)
            {
                customerNum = "00000" + (shu + 1);
            }
            else if (zhang.Length == 2)
            {
                customerNum = "0000" + (shu + 1);
            }
            else if (zhang.Length == 3)
            {
                customerNum = "000" + (shu + 1);
            }
            customer cu = new customer();

            cu.customerNum = customerNum; cu.customerName = customerName; cu.phone = phone;
            cu.chuanzhen   = chuanzhen; cu.email = email; cu.contents = contacts;
            cu.createTime  = DateTime.Now; cu.isDel = 1;
            bll.Add(cu);
            List <customerAddressInfo> list = bll.CustomerAddressInfo();

            var obj = from p in list where Nullable <int> .Equals(p.customerNum, null) && p.isDel == 1 select new { AddressNum = p.AddressNum, AddressXinxi = p.AddressXinxi, contacts = p.contacts, phone = p.phone };

            foreach (var item in obj)
            {
                bll.UdpateBianHao(item.AddressNum, customerNum);
            }

            return(Json("新增成功!", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 11
0
        //删除客户地址
        public ActionResult DeleteDiZhi(string AddressNum)
        {
            KeHuBLL bll = new KeHuBLL();

            return(Json(bll.deletecustomerAddressInfo(AddressNum), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 12
0
        //删除客户
        public ActionResult DeleteKeHu(string customerNum)
        {
            KeHuBLL bll = new KeHuBLL();

            return(Json(bll.delete(customerNum), JsonRequestBehavior.AllowGet));
        }