Example #1
0
        protected void btnAddNode_Click(object sender, EventArgs e)
        {
            TreeView tr = this.trvBrand;
            if (!string.IsNullOrEmpty(txtName.Text.Trim()) && !string.IsNullOrEmpty(tr.SelectedValue))
            {
                int rid = int.Parse(tr.SelectedValue);
                var cs = logic.GetChildren(rid);
                if (cs.Count() != 0)
                {
                    Brand br = new Brand();
                    br.BrandName = txtName.Text.Trim();
                    br.UserKey = this.ContextUserKey;
                    cs.First().ChildBrandSet.Add(br);
                    logic.AddBrand(br);

                }
                else
                {
                    Brand br = new Brand();
                    br.BrandName = txtName.Text.Trim();
                    br.UserKey = this.ContextUserKey;
                    logic.AddBrand(br);
                }
                ExplandTreeNode(tr);
            }
        }
Example #2
0
 private void InsertDropListItem(Brand bc, ref int l, List<ListItem> lst)
 {
     foreach (Brand bd in bc.ChildBrandSet)
     {
         ListItem lt = new ListItem();
         string tmpStr = perfix.PadLeft(perfix.Length + l, nbsp);
         lt.Text = tmpStr + bd.BrandName;
         lt.Value = bd.ID.ToString();
         lst.Add(lt);
         if (bd.ChildBrandSet.Count != 0)
         {
             l += 1;
             InsertDropListItem(bd, ref l, lst);
             l -= 1;
         }
     }
 }
Example #3
0
 /// <summary>
 /// 创建新的 Brand 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="userKey">UserKey 属性的初始值。</param>
 /// <param name="modified">Modified 属性的初始值。</param>
 /// <param name="brandName">BrandName 属性的初始值。</param>
 public static Brand CreateBrand(global::System.Int32 id, global::System.String userKey, global::System.DateTime modified, global::System.String brandName)
 {
     Brand brand = new Brand();
     brand.ID = id;
     brand.UserKey = userKey;
     brand.Modified = modified;
     brand.BrandName = brandName;
     return brand;
 }