コード例 #1
0
        public IActionResult PutGoodsGroup(long id, GoodsGroup GoodsGroup)
        {
            if (id != GoodsGroup.id)
            {
                return(BadRequest());
            }

            _context.Entry(GoodsGroup).State = EntityState.Modified;

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GoodsGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #2
0
ファイル: GoodsGroupController.cs プロジェクト: xingdd/myjobs
        public ActionResult Delete(int id, int count)
        {
            ReturnData <string>      ret    = new ReturnData <string>();
            ReturnData <string>      check  = new ReturnData <string>();
            IList <ChannelJoinGoods> cModel = cbll.GetCGListByGId(id, LoginUser.UserBasic.EnterpriseID);

            if (cModel.Count != 0)
            {
                return(Content("存在关联!不能删除!请先取消关联!"));
            }

            GoodsGroup model = bll.GetModelById(id);

            if (count == 0)
            {
                ret = bll.DeleteGoodsGroup(model);
            }
            else
            {
                return(Content("当前分组下存在商品,请先移除商品!"));
            }
            if (ret.Status == true && check.Status == true)
            {
                return(Content(ret.Message));
            }
            return(Content(ret.Message));
        }
コード例 #3
0
 public FormHistoryCallOrder(string telephone, Action <object, EventArgs> orderAction, ref GoodsGroup currentGoodsGroup)
 {
     m_Telephone   = telephone;
     m_OrderAction = orderAction;
     m_GoodsGroup  = currentGoodsGroup;
     InitializeComponent();
 }
コード例 #4
0
        public ActionResult <GoodsGroup> PostGoodsGroup(GoodsGroup GoodsGroup)
        {
            _context.GoodsGroup.Add(GoodsGroup);
            _context.SaveChanges();

            return(GoodsGroup);
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "GroupID,Title,Description,CreateDate")] GoodsGroup goodsGroup)
 {
     if (ModelState.IsValid)
     {
         goodsGroupRepository.UpdateGoodsGroup(goodsGroup);
         goodsGroupRepository.Save();
         return(RedirectToAction("Index"));
     }
     return(View(goodsGroup));
 }
コード例 #6
0
 public ActionResult Add(GoodsGroup model)
 {
     model.EnterpriseID = LoginUser.UserBasic.EnterpriseID;
     ReturnData<string> ret = new ReturnData<string>();
     ret = bll.AddGoodsGroup(model);
     if (ret.Status == true)
     {
         return Content(ret.Message);
     }
     return Content(ret.Message);
 }
コード例 #7
0
ファイル: GoodsGroupController.cs プロジェクト: xingdd/myjobs
        public ActionResult Add(GoodsGroup model)
        {
            model.EnterpriseID = LoginUser.UserBasic.EnterpriseID;
            ReturnData <string> ret = new ReturnData <string>();

            ret = bll.AddGoodsGroup(model);
            if (ret.Status == true)
            {
                return(Content(ret.Message));
            }
            return(Content(ret.Message));
        }
コード例 #8
0
        private void SaveImplementation(object obj)
        {
            GoodsGroup goodGroup = db.GoodsGroup.SingleOrDefault(g => g.GoodsGroupId == GoodsGroupId);

            if (goodGroup != null)
            {
                goodGroup.Description = Characteristics;
                goodGroup.Name        = Name;
                db.SaveChanges();
            }

            Thiswindow.Close();
        }
コード例 #9
0
        private async void SaveImplementation(object obj)
        {
            GoodsGroup goodGroup = new GoodsGroup();

            goodGroup.GoodsGroupId = 0;
            goodGroup.Description  = Characteristics;
            goodGroup.Name         = Name;

            db.GoodsGroup.Add(goodGroup);
            await db.SaveChangesAsync();

            Thiswindow.Close();
        }
コード例 #10
0
        // GET: GoodsGroups/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GoodsGroup goodsGroup = goodsGroupRepository.GetGoodsGroupByID(id.Value);

            if (goodsGroup == null)
            {
                return(HttpNotFound());
            }
            return(View(goodsGroup));
        }
コード例 #11
0
ファイル: GoodsGroupController.cs プロジェクト: xingdd/myjobs
        public ActionResult Edit(GoodsGroup model)
        {
            ReturnData <string> ret   = new ReturnData <string>();
            GoodsGroup          check = bll.GetModelById(model.ID);

            check.GroupName = model.GroupName;
            check.Remarks   = model.Remarks;

            ret = bll.UpdateGoodsGroup(check);
            if (ret.Status == true)
            {
                return(Content(ret.Message));
            }
            return(Content(ret.Message));
        }
コード例 #12
0
ファイル: GoodsGroupController.cs プロジェクト: xingdd/myjobs
        public ActionResult DeleteList(string ids, string counts)
        {
            string[]                 id    = ids.Substring(0, ids.Length - 1).Split(',');
            string[]                 count = counts.Substring(0, counts.Length - 1).Split(',');
            ReturnData <string>      ret   = new ReturnData <string>();
            ReturnData <string>      ret1  = new ReturnData <string>();
            IList <ChannelJoinGoods> list  = new List <ChannelJoinGoods>();

            for (int j = 0; j < count.Length; j++)
            {
                if (Convert.ToInt32(count[j]) != 0)
                {
                    return(Content("分组下存在商品,请先移除商品!"));
                }
            }



            for (int i = 0; i < id.Length; i++)
            {
                IList <ChannelJoinGoods> cModel = cbll.GetCGListByGId(Convert.ToInt32(id[i]), LoginUser.UserBasic.EnterpriseID);

                if (cModel.Count != 0)
                {
                    return(Content("存在关联!不能删除!请先取消关联!"));
                }

                GoodsGroup model = bll.GetModelById(Convert.ToInt32(id[i]));

                ret = bll.DeleteGoodsGroup(model);



                ret  = bll.DeleteById(Convert.ToInt32(id[i]));
                list = cbll.GetCGListByGId(Convert.ToInt32(id[i]), LoginUser.UserBasic.EnterpriseID);
                if (list.Count != 0)
                {
                    ret1 = cbll.DeleteByGId(Convert.ToInt32(id[i]));
                }
            }
            if (ret.Status == true && ret1.Status == true)
            {
                return(Content(ret.Message));
            }
            return(Content(ret.Message));
        }
コード例 #13
0
        public void GetGoodGroupsByIds_ShouldReturnNeededGoodGroups_WhenEnumerableOfGoodGroupIdsSend()
        {
            int?testId1 = 1;
            int?testId2 = 2;
            int?testId3 = 3;

            List <int?> goodGroupIds = new List <int?>()
            {
                testId1, testId2, testId3
            };

            GoodsGroup testGoodGroup1 = new GoodsGroup()
            {
                ID = 1, Name = "nordglass"
            };
            GoodsGroup testGoodGroup2 = new GoodsGroup()
            {
                ID = 2, Name = "AGC"
            };
            GoodsGroup testGoodGroup3 = new GoodsGroup()
            {
                ID = 3, Name = "Lamex"
            };

            var repositoryMock = new Mock <IExternalDbRepository <GoodsGroup> >();

            repositoryMock.Setup(x => x.GetById(testId1)).Returns(() => testGoodGroup1);
            repositoryMock.Setup(x => x.GetById(testId2)).Returns(() => testGoodGroup2);
            repositoryMock.Setup(x => x.GetById(testId3)).Returns(() => testGoodGroup3);

            GoodGroupsService service = new GoodGroupsService(repositoryMock.Object);

            List <GoodsGroup> response = service.GetGoodGroupsByIds(goodGroupIds).ToList();

            Assert.AreEqual(response.Count, 3);
            Assert.AreEqual(response[0], testGoodGroup1);
            Assert.AreEqual(response[1], testGoodGroup2);
            Assert.AreEqual(response[2], testGoodGroup3);

            repositoryMock.VerifyAll();
        }
コード例 #14
0
 public void Update(GoodsGroup aggregate)
 {
     _session.Update(aggregate);
 }
コード例 #15
0
 public void Delete(GoodsGroup aggregate)
 {
     _session.Delete(aggregate);
 }
コード例 #16
0
 public long Create(GoodsGroup aggregate)
 {
     return((long)_session.Save(aggregate));
 }
コード例 #17
0
        public ActionResult Edit(GoodsGroup model)
        {
            ReturnData<string> ret = new ReturnData<string>();
            GoodsGroup check = bll.GetModelById(model.ID);
            check.GroupName = model.GroupName;
            check.Remarks = model.Remarks;

            ret = bll.UpdateGoodsGroup(check);
            if (ret.Status == true)
            {
                return Content(ret.Message);
            }
            return Content(ret.Message);
        }
コード例 #18
0
 public void Create(GoodsGroup goodsgroup)
 {
     _biContext.SaveChanges();
 }
コード例 #19
0
        public GoodsGroupEditing(GoodsGroup gg)
        {
            InitializeComponent();

            DataContext = new GoodsGroupEditingViewModel(this, gg);
        }