Example #1
0
        private void btndel_Click(object sender, EventArgs e)
        {
            var row = dataGridView1.SelectedRows;

            if (row.Count > 0)
            {
                DialogResult result = MessageBox.Show("确定要删除吗?", "删除提示", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int            id = Convert.ToInt32(row[0].Cells[0].Value.ToString());
                    Membertypeinfo mi = new Membertypeinfo
                    {
                        Mid = id
                    };
                    if (mb.DeleteList(mi))
                    {
                        LoadDate();
                        btnmiss_Click(null, null);
                    }
                    else
                    {
                        MessageBox.Show("失败");
                    }
                }
            }
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Membertypeinfo mi = new Membertypeinfo()
            {
                Mtitle    = txtname.Text.Trim(),
                Mdiscount = Convert.ToDecimal(txtpwd.Text.Trim())
            };

            if (btnSave.Text.Equals("添加"))
            {
                if (mb.AddList(mi))
                {
                    LoadDate();
                    btnmiss_Click(null, null);
                }
                else
                {
                    MessageBox.Show("失败");
                }
            }
            else
            {
                mi.Mid = Convert.ToInt32(textBox1.Text.Trim());
                if (mb.UpdateList(mi))
                {
                    LoadDate();
                    btnmiss_Click(null, null);
                }
                else
                {
                    MessageBox.Show("失败");
                }
            }
        }
Example #3
0
        public int Deletelist(Membertypeinfo mi)
        {
            string sql = "update membertypeinfo set misdelete=1 where mid=@id";

            SqlParameter[] pms = new SqlParameter[]
            {
                new SqlParameter("@id", mi.Mid)
            };
            return(SqlHelper.updatelist(sql, pms));
        }
Example #4
0
        public int AddList(Membertypeinfo mi)
        {
            string sql = "insert into membertypeinfo(mtitle,mdiscount,misdelete) values (@title,@discount,0)";

            SqlParameter[] pms =
            {
                new SqlParameter("@title",    mi.Mtitle),
                new SqlParameter("@discount", mi.Mdiscount)
            };
            return(SqlHelper.AddList(sql, pms));
        }
Example #5
0
        public int UpdateList(Membertypeinfo mi)
        {
            string sql = "update membertypeinfo set mtitle=@title,mdiscount=@discount where mid=@id";

            SqlParameter[] pms =
            {
                new SqlParameter("@id",       mi.Mid),
                new SqlParameter("@title",    mi.Mtitle),
                new SqlParameter(@"discount", mi.Mdiscount)
            };
            return(SqlHelper.updatelist(sql, pms));
        }
Example #6
0
        public bool AddList(Membertypeinfo mi)
        {
            int s = md.AddList(mi);

            if (s > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #7
0
 public bool DeleteList(Membertypeinfo mi)
 {
     return(md.Deletelist(mi) > 0);
 }
Example #8
0
 public bool UpdateList(Membertypeinfo mi)
 {
     return(md.UpdateList(mi) > 0);
 }