Exemplo n.º 1
0
        public ActionResult AddGuan(int gid, string id)
        {
            string[] ids = id.Substring(0, id.Length - 1).Split(',');

            ReturnData <string>      ret   = new ReturnData <string>();
            IList <ChannelJoinGoods> list  = cbll.GetCGListByGId(gid, LoginUser.UserBasic.EnterpriseID);
            ChannelJoinGoods         model = new ChannelJoinGoods();

            if (list.Count != 0)
            {
                cbll.Delete(gid);
                for (int i = 0; i < ids.Length; i++)
                {
                    model.AddTime        = DateTime.Now;
                    model.ChannelGroupID = Convert.ToInt32(ids[i]);
                    model.GoodsGroupID   = gid;
                    ret = cbll.Add(model);
                }
            }
            else
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    model.AddTime        = DateTime.Now;
                    model.ChannelGroupID = Convert.ToInt32(ids[i]);
                    model.GoodsGroupID   = gid;
                    ret = cbll.Add(model);
                }
            }
            if (ret.Status == true)
            {
                return(Content(ret.Message));
            }

            return(Content(ret.Message));
        }
Exemplo n.º 2
0
        public ActionResult AddGuan(int gid, string id)
        {
            string[] ids = id.Substring(0, id.Length - 1).Split(',');

            ReturnData<string> ret = new ReturnData<string>();
            IList<ChannelJoinGoods> list = cbll.GetCGListByGId(gid, LoginUser.UserBasic.EnterpriseID);
            ChannelJoinGoods model = new ChannelJoinGoods();
            if (list.Count != 0)
            {
                cbll.Delete(gid);
                for (int i = 0; i < ids.Length; i++)
                {
                    model.AddTime = DateTime.Now;
                    model.ChannelGroupID = Convert.ToInt32(ids[i]);
                    model.GoodsGroupID = gid;
                    ret = cbll.Add(model);
                }

            }
            else
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    model.AddTime = DateTime.Now;
                    model.ChannelGroupID = Convert.ToInt32(ids[i]);
                    model.GoodsGroupID = gid;
                    ret = cbll.Add(model);
                }

            }
            if (ret.Status == true)
            {
                return Content(ret.Message);
            }

            return Content(ret.Message);
        }