Пример #1
0
        private void Btn_Enter_Click(object sender, EventArgs e)
        {
            try
            {
                int    chargemode  = cb_ChargeMode.SelectedIndex;
                int    openmode    = cb_OpenMode.SelectedIndex;
                int    freeminutes = (int)ud_FreeMinutes.Value;
                double dailylimit  = (double)ud_DailyLimit.Value;
                int    firstcharge = (int)ud_FirstCharge.Value;
                double firstmoney  = (double)ud_FirstMoney.Value;
                int    twocharge   = (int)ud_TwoCharge.Value;
                double twomoney    = (double)ud_TwoMoney.Value;
                int    threecharge = (int)ud_ThreeCharge.Value;
                double threemoney  = (double)ud_ThreeMoney.Value;
                int    fourcharge  = (int)ud_FourCharge.Value;
                double fourmoney   = (double)ud_FourMoney.Value;
                int    fivecharge  = (int)ud_FiveCharge.Value;
                double fivemoney   = (double)ud_FiveMoney.Value;
                int    sixcharge   = (int)ud_SixCharge.Value;
                double sixmoney    = (double)ud_SixMoney.Value;

                _mChargeParam.ChargeMode  = chargemode;
                _mChargeParam.GateMode    = openmode;
                _mChargeParam.FreeMinutes = freeminutes;
                _mChargeParam.DailyLimit  = dailylimit;
                _mChargeParam.FirstCharge = firstcharge;
                _mChargeParam.FirstMoney  = firstmoney;
                _mChargeParam.TwoCharge   = twocharge;
                _mChargeParam.TwoMoney    = twomoney;
                _mChargeParam.ThreeCharge = threecharge;
                _mChargeParam.ThreeMoney  = threemoney;
                _mChargeParam.FourCharge  = fourcharge;
                _mChargeParam.FourMoney   = fourmoney;
                _mChargeParam.FiveCharge  = fivecharge;
                _mChargeParam.FiveMoney   = fivemoney;
                _mChargeParam.SixCharge   = sixcharge;
                _mChargeParam.SixMoney    = sixmoney;

                if (_mChargeParam.ID == 0)
                {
                    _mChargeParam.ID = Dbhelper.Db.Insert <CbChargeParameter>(_mChargeParam);
                }
                else
                {
                    Dbhelper.Db.Update <CbChargeParameter>(_mChargeParam);
                }
                Dal_ChargeParameter.ChargeParam = _mChargeParam;
                _mChargeParam = null;
                MessageBox.Show("收费标准保存成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
            }
            catch (Exception ex)
            {
                CustomExceptionHandler.GetExceptionMessage(ex);
                MessageBox.Show(ex.Message, @"提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
 private void ChargeStandardForm_Load(object sender, EventArgs e)
 {
     try
     {
         _mChargeParam = Dbhelper.Db.FirstDefault <CbChargeParameter>();
         if (_mChargeParam == null)
         {
             _mChargeParam = new CbChargeParameter();
             cb_ChargeMode.SelectedIndex = 1;
             cb_OpenMode.SelectedIndex   = 1;
         }
         else
         {
             cb_ChargeMode.SelectedIndex = _mChargeParam.ChargeMode;
             cb_OpenMode.SelectedIndex   = _mChargeParam.GateMode;
             ud_FreeMinutes.Value        = _mChargeParam.FreeMinutes;
             ud_DailyLimit.Value         = (decimal)_mChargeParam.DailyLimit;
             ud_FirstCharge.Value        = _mChargeParam.FirstCharge;
             ud_FirstMoney.Value         = (decimal)_mChargeParam.FirstMoney;
             ud_TwoCharge.Value          = _mChargeParam.TwoCharge;
             ud_TwoMoney.Value           = (decimal)_mChargeParam.TwoMoney;
             ud_ThreeCharge.Value        = _mChargeParam.ThreeCharge;
             ud_ThreeMoney.Value         = (decimal)_mChargeParam.ThreeMoney;
             ud_FourCharge.Value         = _mChargeParam.FourCharge;
             ud_FourMoney.Value          = (decimal)_mChargeParam.FourMoney;
             ud_FiveCharge.Value         = _mChargeParam.FirstCharge;
             ud_FiveMoney.Value          = (decimal)_mChargeParam.FiveMoney;
             ud_SixCharge.Value          = _mChargeParam.SixCharge;
             ud_SixMoney.Value           = (decimal)_mChargeParam.SixMoney;
         }
     }
     catch (Exception ex)
     {
         CustomExceptionHandler.GetExceptionMessage(ex);
         MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }