示例#1
0
        public bool Delete()
        {
            if (this.lvType.SelectedItems == null || this.lvType.SelectedItems.Count < 1)
            {
                return(false);
            }

            GoodsType u = new GoodsType();

            u.TypeNO = Convert.ToInt32(this.lvType.SelectedItems[0].Tag.ToString());
            if (u.Delete())
            {
                this.lvType.Items.Remove(this.lvType.SelectedItems[0]);
                this.txtType.Text = string.Empty;
                return(true);
            }
            return(false);
        }
示例#2
0
        public bool Modify()
        {
            if (this.lvType.SelectedItems == null || this.lvType.SelectedItems.Count < 1 ||
                this.txtType.Text.Trim().Length == 0)
            {
                return(false);
            }

            GoodsType u = new GoodsType();

            u.TypeNO   = Convert.ToInt32(this.lvType.SelectedItems[0].Tag.ToString());
            u.TypeName = this.txtType.Text.Trim();
            if (u.Update())
            {
                this.lvType.SelectedItems[0].SubItems[1].Text = u.TypeName;
                return(true);
            }
            return(false);
        }
示例#3
0
        public bool Save()
        {
            if (this.txtType.Text.Trim().Length == 0)
            {
                return(false);
            }

            GoodsType u = new GoodsType();

            u.TypeName = this.txtType.Text.Trim();
            if (u.Save())
            {
                this.lvType.Items.Add(new ListViewItem(new string[] { Convert.ToString(this.lvType.Items.Count + 1).PadLeft(3, ' '), u.TypeName })
                {
                    Tag = u.TypeNO
                });
                this.txtType.Text = string.Empty;
                return(true);
            }
            return(false);
        }
示例#4
0
 public void LoadGoodsType()
 {
     GoodsType.ListType(this.GoodsTypeTree);
 }