Beispiel #1
0
        public ActionResult UpdateCate(CompanyCate model)
        {
            if (ModelState.IsValid)
            {
                var obj = ServiceFactory.CompanyCateManager.Get(new CompanyCate {
                    CompanyCateId = model.CompanyCateId
                });
                if (obj != null)
                {
                    try
                    {
                        model.CompanyCateShortName = model.CompanyCateName.ToUrlSegment(250).ToLower();
                        ServiceFactory.CompanyCateManager.Update(model, obj);

                        return(RedirectToAction("SearchCate", "Company"));
                    }
                    catch (Exception)
                    {
                        //throw;
                    }
                }
            }
            ViewBag.IsEdit = true;
            return(View(model));
        }
Beispiel #2
0
        public void Remove(CompanyCate item)
        {
            var comm = this.GetCommand("sp_CompanyCateDelete");

            if (comm == null)
            {
                return;
            }
            comm.AddParameter <int>(this.Factory, "CompanyCateId", item.CompanyCateId);
            comm.SafeExecuteNonQuery();
            //throw new NotImplementedException();
        }
Beispiel #3
0
 public void Add(CompanyCate item)
 {
     //var comm = this.GetCommand("sp_CompanyCate_Insert");
     //if (comm == null) return;
     //comm.AddParameter<string>(this.Factory, "Url", item.Url);
     //comm.AddParameter<bool>(this.Factory, "IsActive", item.IsActive);
     ////comm.AddParameter<DateTime>(this.Factory, "CreateDate", item.CreateDate);
     ////comm.AddParameter<DateTime>(this.Factory, "EditDate", item.EditDate);
     //comm.AddParameter<string>(this.Factory, "CreateBy", item.CreateBy);
     //comm.AddParameter<string>(this.Factory, "Image", item.Image);
     //comm.AddParameter<int>(this.Factory, "OrderNo", item.OrderNo);
     //comm.SafeExecuteNonQuery();
     throw new NotImplementedException();
 }
Beispiel #4
0
        public CompanyCate Get(CompanyCate dummy)
        {
            var comm = this.GetCommand("sp_CompanyCateGet");

            if (comm == null)
            {
                return(null);
            }
            comm.AddParameter <int>(this.Factory, "CompanyCateId", dummy.CompanyCateId);
            var dt           = this.GetTable(comm);
            var sliderBanner = EntityBase.ParseListFromTable <CompanyCate>(dt).FirstOrDefault();

            return(sliderBanner ?? null);
            //throw new NotImplementedException();
        }
Beispiel #5
0
 public ActionResult CreateCate(CompanyCate model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             model.CreateBy             = UserState.SysUser.Fullname;
             model.CompanyCateShortName = model.CompanyCateName.ToUrlSegment(250).ToLower();
             ServiceFactory.CompanyCateManager.Add(model, Culture);
             return(RedirectToAction("SearchCate", "Company"));
         }
         catch (Exception)
         {
             //throw;
         }
     }
     return(View("UpdateCate", model));
 }
Beispiel #6
0
        public void Add(CompanyCate item, string culture)
        {
            var comm = this.GetCommand("sp_CompanyCateInsert");

            if (comm == null)
            {
                return;
            }
            comm.AddParameter <int>(this.Factory, "ParentId", item.ParentId);
            comm.AddParameter <string>(this.Factory, "CompanyCateName", item.CompanyCateName);
            comm.AddParameter <string>(this.Factory, "CompanyCateShortName", item.CompanyCateShortName);
            comm.AddParameter <string>(this.Factory, "CompanyCateImage", item.CompanyCateImage);
            comm.AddParameter <string>(this.Factory, "CompanyCateIcon", item.CompanyCateImage);
            comm.AddParameter <int>(this.Factory, "OrderNo", item.OrderNo);
            comm.AddParameter <bool>(this.Factory, "IsHotCompanyCate", item.IsHotCompanyCate);
            comm.AddParameter <bool>(this.Factory, "IsActive", item.IsActive);
            comm.AddParameter <string>(this.Factory, "Culture", culture);
            comm.AddParameter <string>(this.Factory, "CreateBy", item.CreateBy);
            comm.SafeExecuteNonQuery();
            //throw new NotImplementedException();
        }
Beispiel #7
0
        public void Update(CompanyCate @new, CompanyCate old)
        {
            var item = @new;

            item.CompanyCateId = old.CompanyCateId;
            var comm = this.GetCommand("sp_CompanyCateUpdate");

            if (comm == null)
            {
                return;
            }
            comm.AddParameter <int>(this.Factory, "CompanyCateId", item.CompanyCateId);
            comm.AddParameter <int>(this.Factory, "ParentId", item.ParentId);
            comm.AddParameter <string>(this.Factory, "CompanyCateName", item.CompanyCateName);
            comm.AddParameter <string>(this.Factory, "CompanyCateShortName", item.CompanyCateShortName);
            comm.AddParameter <string>(this.Factory, "CompanyCateImage", item.CompanyCateImage);
            comm.AddParameter <string>(this.Factory, "CompanyCateIcon", item.CompanyCateIcon);
            comm.AddParameter <bool>(this.Factory, "IsHotCompanyCate", item.IsHotCompanyCate);
            comm.AddParameter <bool>(this.Factory, "IsActive", item.IsActive);
            comm.AddParameter <int>(this.Factory, "OrderNo", item.OrderNo);

            comm.SafeExecuteNonQuery();
            //throw new NotImplementedException();
        }
Beispiel #8
0
        public ActionResult CreateCate()
        {
            CompanyCate data = new CompanyCate();

            return(View("UpdateCate", data));
        }