Esempio n. 1
0
        //读取产品名称与型号列表
        public ActionResult GetChanPinList()
        {
            var tmc      = T_ChanPinNameService.LoadEntities(x => x.Del == 0);
            var tempName = from a in tmc
                           where a.MyColums == "CPname"
                           select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };
            var tempXingH = from a in tmc
                            where a.MyColums == "CPxinghao"
                            select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };
            var tempDengji = from a in tmc
                             where a.MyColums == "CPDengJi"
                             select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };

            tempName   = tempName.OrderBy(p => p.MyText);
            tempXingH  = tempXingH.OrderBy(p => p.MyText);
            tempDengji = tempDengji.OrderBy(p => p.MyText);
            return(Json(new { tempName = tempName, tempXingH = tempXingH, tempDengji = tempDengji, ret = "ok" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        //复杂查询
        //获取产品名称
        public ActionResult GetCPname()
        {
            int action   = int.Parse(Request["Action"]);
            var tmc      = T_ChanPinNameService.LoadEntities(x => x.Del == 0);
            var tempName = from a in tmc
                           where a.MyColums == "CPname"
                           select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };
            var tempXingH = from a in tmc
                            where a.MyColums == "CPxinghao"
                            select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };

            tempName  = tempName.OrderBy(p => p.MyText);
            tempXingH = tempXingH.OrderBy(p => p.MyText);
            return(Json(action == 1?tempName:tempXingH, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        //获取产品级别
        public ActionResult GetCPJBList()
        {
            var temp = T_ChanPinNameService.LoadEntities(x => x.MyColums == "CPDengJi").DefaultIfEmpty();
            var rtmp = from a in temp
                       select new
            {
                ID      = a.ID,
                MyTexts = a.MyTexts
            };

            return(Json(rtmp, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
        //获取产品型号
        public ActionResult GetBCPXHList()
        {
            long id   = Convert.ToInt64(Request["id"]);
            var  temp = T_ChanPinNameService.LoadEntities(x => x.ID == id).FirstOrDefault();
            var  tem  = from a in temp.YXB_WinCanPin.DefaultIfEmpty()
                        select new
            {
                ID      = a.T_ChanPinName1.ID,
                MyTexts = a.T_ChanPinName1.MyTexts
            };

            return(Json(tem, JsonRequestBehavior.AllowGet));
        }
        //删除产品 信息
        public ActionResult DelChanPin()
        {
            long delID      = Convert.ToInt64(Request["delID"]);
            var  NameOrType = Request["bol"];

            if (NameOrType == "true")
            {
                var deldata = T_ChanPinNameService.LoadEntities(x => x.ID == delID).FirstOrDefault();
                if (deldata.CreatePerson != LoginUser.ID)
                {
                    return(Json("noperson", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    deldata.Del = 1;
                    if (T_ChanPinNameService.EditEntity(deldata))
                    {
                        return(Json("ok", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json("no", JsonRequestBehavior.AllowGet));
                    }
                }
            }
            else if (NameOrType == "false")
            {
                var deldata = YXB_WinCanPinService.LoadEntities(x => x.ID == delID).FirstOrDefault();
                if (deldata.T_ChanPinName.CreatePerson != LoginUser.ID)
                {
                    return(Json("noperson", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    deldata.Del = 1;
                    if (YXB_WinCanPinService.EditEntity(deldata))
                    {
                        return(Json("ok", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json("no", JsonRequestBehavior.AllowGet));
                    }
                }
            }
            else
            {
                return(Json("no", JsonRequestBehavior.AllowGet));
            }
        }
        //获取产品列表
        public ActionResult GetHref()
        {
            int pageIndex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 10;

            string MyColums = Request["MyColums"];
            int    totalCount;

            var actioninfolist = T_ChanPinNameService.LoadPageEntities <long>(pageIndex, pageSize, out totalCount, a => a.MyColums == MyColums && a.Del != 1, a => a.ID, false);
            var temp           = from a in actioninfolist
                                 select new
            {
                ID      = a.ID,
                MyTexts = a.MyTexts
            };

            return(Json(new { rows = temp, total = totalCount }, JsonRequestBehavior.AllowGet));
        }
        //创建产品型号与名称
        public ActionResult ADDxinghaoName( )
        {
            string cpname = Request["Name"];
            var    Seltcp = T_ChanPinNameService.LoadEntities(x => x.MyTexts == cpname).FirstOrDefault();

            if (Seltcp == null)
            {
                T_ChanPinName Tcp = new T_ChanPinName();
                Tcp.MyColums     = Request["MyColums"];
                Tcp.MyTexts      = Request["Name"];
                Tcp.CreatePerson = LoginUser.ID;
                Tcp.CreateTime   = MvcApplication.GetT_time();
                Tcp.Del          = 0;
                T_ChanPinNameService.AddEntity(Tcp);
                return(Json("ok", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Isdistict", JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 8
0
        //读取产品名称与型号列表
        public ActionResult GetChanPinList()
        {
            #region MyRegion
            ////isSale==1是产品 0是运费
            //TModel.DAL.AA_InventoryDal Tda = new TModel.DAL.AA_InventoryDal();
            //var tempCp = Tda.LoadEntities(x => x.idwarehouse == 5 && x.isSale == 1).DefaultIfEmpty();

            //List<Inventory> Liy = new List<Inventory>();
            //foreach (var a in tempCp)
            //{
            //    Inventory ity = new Inventory();
            //    ity.ID = a.id;
            //    ity.code = a.code;
            //    ity.Name = a.name;
            //    ity.XingH = a.specification;
            //    ity.shorthand = a.shorthand;
            //    Liy.Add(ity);
            //}
            //var DitName = Liy.GroupBy(x => x.Name).Where(g => g.Count() > 1).ToList();
            //List<MoedName> lmn = new List<MoedName>();
            //foreach (var aa in DitName)
            //{
            //    MoedName mn = new MoedName();
            //    mn.MyColums = aa.Key;
            //    mn.MyText = aa.Key;
            //    lmn.Add(mn);

            //}
            //var tempName = lmn;
            #endregion
            var tmc      = T_ChanPinNameService.LoadEntities(x => x.Del == 0).DefaultIfEmpty();
            var tempName = from a in tmc
                           where a.MyColums == "CPname"
                           select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };
            var tempXingH = from a in tmc
                            where a.MyColums == "CPxinghao"
                            select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };

            var tempDengji = from a in tmc
                             where a.MyColums == "CPDengJi"
                             select new
            {
                ID       = a.ID,
                MyText   = a.MyTexts,
                MyColums = a.MyColums
            };
            tempXingH  = tempXingH.OrderBy(p => p.MyText);
            tempName   = tempName.OrderBy(p => p.MyText);
            tempDengji = tempDengji.OrderBy(p => p.MyText);
            return(Json(new { tempName = tempName, tempXingH = tempXingH, tempDengji = tempDengji, ret = "ok" }, JsonRequestBehavior.AllowGet));
        }