Пример #1
0
        //编辑
        private void ToolEdit_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要先选择优惠券所在行!");
                return;
            }

            WxCoupon wxCoupon = new WxCoupon();

            wxCoupon.id = MConvert <int> .ToTypeOrDefault(dgv.CurrentRow.Cells[0].Value, 0);

            wxCoupon.title = dgv.CurrentRow.Cells[1].Value.ToString();
            wxCoupon.value = MConvert <double> .ToTypeOrDefault(dgv.CurrentRow.Cells[2].Value, 0);

            wxCoupon.descp = dgv.CurrentRow.Cells[3].Value.ToString();
            var form = new CouponForm(wxCoupon, this);

            if (form.ShowDialog() == DialogResult.OK)
            {
                dgv_show();
            }
        }
 //新增
 private void ToolAdd_Click(object sender, EventArgs e)
 {
     var form = new CouponForm(null, this);
     form.ShowDialog();
 }
Пример #3
0
        //新增
        private void ToolAdd_Click(object sender, EventArgs e)
        {
            var form = new CouponForm(null, this);

            form.ShowDialog();
        }
        //编辑
        private void ToolEdit_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                BathClass.printErrorMsg("需要先选择优惠券所在行!");
                return;
            }

            WxCoupon wxCoupon = new WxCoupon();
            wxCoupon.id = MConvert<int>.ToTypeOrDefault(dgv.CurrentRow.Cells[0].Value, 0);
            wxCoupon.title = dgv.CurrentRow.Cells[1].Value.ToString();
            wxCoupon.value = MConvert<double>.ToTypeOrDefault(dgv.CurrentRow.Cells[2].Value, 0);
            wxCoupon.descp = dgv.CurrentRow.Cells[3].Value.ToString();
            var form = new CouponForm(wxCoupon, this);
            if (form.ShowDialog() == DialogResult.OK)
            {
                dgv_show();
            }
        }