Пример #1
0
        private void BindList()
        {
            VipSoft.BLL.MoneyRule mrBll = new BLL.MoneyRule();
            DataSet ds = mrBll.GetList(pageSize, currentPage, out resCount, condition);
            this.dataGridView1.DataSource = ds.Tables[0];

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = false;
            }

            BindPage();
        }
Пример #2
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     String id = this.dataGridView1.Rows[this.dataGridView1.CurrentRow.Index].Cells["id"].Value.ToString();
     if (id != null && id != "")
     {
         int cid = int.Parse(id);
         VipSoft.BLL.MoneyRule mrBll = new BLL.MoneyRule();
         MoneyRule mrModel = mrBll.GetModel(cid);
         this.f_2hour.Text = mrModel.SecondHourMoney.ToString();
         this.f_1hour.Text = mrModel.OneHourMoney.ToString();
         this.f_3hour.Text = mrModel.ThirdHourMoney.ToString();
         this.f_name.Text = mrModel.Name.ToString();
         this.f_thantime.Text = mrModel.ThanTime.ToString();
         this.currentId = cid;
     }
 }
Пример #3
0
 private void delBtn_Click(object sender, EventArgs e)
 {
     if (this.currentId > 0)
     {
         VipSoft.BLL.MoneyRule mrBll = new BLL.MoneyRule();
         bool flag = mrBll.Delete(this.currentId);
         if (flag)
         {
             MessageBox.Show("删除记录成功!");
             BindList();
         }
         else
         {
             MessageBox.Show("删除记录失败!");
         }
     }
     else
     {
         MessageBox.Show("请选择一条记录!");
     }
 }
Пример #4
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            VipSoft.BLL.MoneyRule mrBll = new BLL.MoneyRule();

            MoneyRule mrModel = new MoneyRule();
            mrModel.Name = this.f_name.Text.ToString();
            mrModel.OneHourMoney = decimal.Parse(this.f_1hour.Text);
            mrModel.SecondHourMoney = decimal.Parse(this.f_2hour.Text);
            mrModel.ThirdHourMoney = decimal.Parse(this.f_3hour.Text);
            mrModel.ThanTime = int.Parse(this.f_thantime.Text);

            if (this.currentId == 0)
            {
                mrBll.Add(mrModel);
                MessageBox.Show("新增消费规则成功!");
                BindList();
            }
            else
            {
                mrModel.ID = this.currentId;
                mrBll.Update(mrModel);
                MessageBox.Show("修改消费规则成功!");
                BindList();
            }
        }