private void btnAdd_Click(object sender, EventArgs e)
        {
            MemberCTypeInfo mti = new MemberCTypeInfo()
            {
                MCType = txtMCType.Text,
                MCDay  = txtDay.Text,
                MCBZ   = txtBZ.Text
            };

            if (btnAdd.Text == "添加")
            {
                if (mtiBll.Add(mti))
                {
                    btnQuit_Click(null, null);
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
            else
            {
                mti.MCId = Convert.ToInt32(txtMCId.Text);
                if (mtiBll.Update(mti))
                {
                    btnQuit_Click(null, null);
                    LoadList();
                }
                else
                {
                    MessageBox.Show("添加失败");
                }
            }
        }
示例#2
0
        public int Insert(MemberCTypeInfo mti)
        {
            string sql = "insert into MemberCTypeInfo(mctype,mcday,mcbz,mcisdelete) values(@type,@day,@bz,0)";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@type", mti.MCType),
                new SQLiteParameter("@day",  mti.MCDay),
                new SQLiteParameter("@bz",   mti.MCBZ)
            };
            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
示例#3
0
        public int Update(MemberCTypeInfo mti)
        {
            string sql = "update MemberCTypeInfo set mctype=@type,mcday=@day,mcbz=@bz where mcid=@id";

            SQLiteParameter[] ps =
            {
                new SQLiteParameter("@type", mti.MCType),
                new SQLiteParameter("@day",  mti.MCDay),
                new SQLiteParameter("@bz",   mti.MCBZ),
                new SQLiteParameter("@id",   mti.MCId)
            };
            return(SqliteHelper.ExecuteNonQuery(sql, ps));
        }
示例#4
0
 public bool Update(MemberCTypeInfo mti)
 {
     return(mtiDal.Update(mti) > 0);
 }
示例#5
0
 public bool Add(MemberCTypeInfo mti)
 {
     return(mtiDal.Insert(mti) > 0);
 }