예제 #1
0
 public string GetTopNameByCid(string Name)
 {
     Maticsoft.Model.SNS.Categories model = new Maticsoft.Model.SNS.Categories();
     model = this.GetModel(Name);
     if ((model.ParentID == 0) || (model.Depth == 1))
     {
         if (model != null)
         {
             return model.Name;
         }
         return "暂无分类";
     }
     string[] strArray = model.Path.Split(new char[] { '|' });
     if (strArray.Length > 0)
     {
         model = this.GetModel(Globals.SafeInt(strArray[0], 0));
         if (model != null)
         {
             return model.Name;
         }
     }
     return "暂无分类";
 }
예제 #2
0
파일: Add.cs 프로젝트: huaminglee/myyyyshop
 protected void btnSave_Click(object sender, EventArgs e)
 {
     this.btnSave.Enabled = true;
     this.btnCancle.Enabled = true;
     if (string.IsNullOrWhiteSpace(this.txtName.Text.Trim()))
     {
         this.btnSave.Enabled = true;
         this.btnCancle.Enabled = true;
         MessageBox.ShowFailTip(this, "分类名称不能为空,在1至60个字符之间");
     }
     else
     {
         Maticsoft.Model.SNS.Categories model = new Maticsoft.Model.SNS.Categories {
             Name = this.txtName.Text,
             Description = this.txtDescription.Text
         };
         if (this.type == 1)
         {
             if (!string.IsNullOrWhiteSpace(this.PhotoCategory.SelectedValue.Trim()))
             {
                 model.ParentID = int.Parse(this.PhotoCategory.SelectedValue);
             }
             else
             {
                 model.ParentID = 0;
             }
         }
         else if (!string.IsNullOrWhiteSpace(this.SNSCategory.SelectedValue.Trim()))
         {
             model.ParentID = int.Parse(this.SNSCategory.SelectedValue);
         }
         else
         {
             model.ParentID = 0;
         }
         model.HasChildren = false;
         model.IsMenu = Globals.SafeBool(this.radlState.SelectedValue, false);
         model.CreatedUserID = base.CurrentUser.UserID;
         model.MenuIsShow = Globals.SafeBool(this.rbIsMenuShow.SelectedValue, false);
         model.MenuSequence = -1;
         model.Type = this.type;
         model.Status = Globals.SafeInt(this.rbIsused.SelectedValue, 0);
         model.FontColor = this.textFontColor.Text.Trim();
         model.Meta_Title = this.txtSeoTitle.Text;
         model.Meta_Keywords = this.txtSeoKeywords.Text;
         model.Meta_Description = this.txtSeoDescription.Text;
         if (this.bll.AddCategories(model))
         {
             this.btnSave.Enabled = false;
             this.btnCancle.Enabled = false;
             base.Cache.Remove("GetAllCateByCache-" + this.type);
             if ((this.Session["CategoryType"] != null) && (this.Session["CategoryType"].ToString() == "1"))
             {
                 MessageBox.ShowSuccessTip(this, "添加成功,正在跳转...!", "list.aspx?type=1");
             }
             else
             {
                 MessageBox.ShowSuccessTip(this, "添加成功,正在跳转...!", "list.aspx");
             }
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加商品类别成功!", this);
         }
         else
         {
             this.btnSave.Enabled = true;
             this.btnCancle.Enabled = true;
             MessageBox.ShowSuccessTip(this, "添加失败!");
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加商品类别失败!", this);
         }
     }
 }
예제 #3
0
 public int GetTopCidByChildCid(int Cid)
 {
     Maticsoft.Model.SNS.Categories model = new Maticsoft.Model.SNS.Categories();
     model = this.GetModel(Cid);
     if (((model == null) || (model.ParentID == 0)) || (model.Depth == 1))
     {
         return Cid;
     }
     string[] strArray = model.Path.Split(new char[] { '|' });
     if (strArray.Length > 0)
     {
         return Globals.SafeInt(strArray[0], 0);
     }
     return 0;
 }