Example #1
0
        private void FrmZSTSetting_Load(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            LR280Setting LR280 = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetSetting <LR280Setting>();

            if (LR280 != null)
            {
                dataGridView1.Rows.Clear();
                if (LR280.Items != null && LR280.Items.Count > 0)
                {
                    foreach (LR280Item item in LR280.Items)
                    {
                        int row = dataGridView1.Rows.Add();
                        ShowItemOnRow(dataGridView1.Rows[row], item);
                    }
                }
            }
            chkEnable.Checked = GlobalSettings.Current.Get <OpenCardMessageHandler>().ContainService <LR280Setting>();
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!CheckInput())
            {
                return;
            }
            LR280Setting lr280 = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetOrCreateSetting <LR280Setting>();

            lr280.Items.Clear();
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                lr280.Items.Add(row.Tag as LR280Item);
            }
            CommandResult ret = (new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect)).SaveSetting <LR280Setting>(lr280);

            if (CustomCardTypeSetting.Current.GetCardType(LR280Setting.CardTyte) == null) //增加自定义卡片类型
            {
                CustomCardTypeSetting.Current.AddCardType(LR280Setting.CardTyte, (byte)Ralid.Park.BusinessModel.Enum.CardType.MonthRentCard);
                new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect).SaveSetting <CustomCardTypeSetting>(CustomCardTypeSetting.Current);
            }
            if (ret.Result == ResultCode.Successful)
            {
                AppSettings.CurrentSetting.SaveConfig("EnableLR280", chkEnable.Checked.ToString());
                OpenCardMessageHandler handler = GlobalSettings.Current.Get <OpenCardMessageHandler>();
                if (chkEnable.Checked)
                {
                    handler.InitService(lr280);
                }
                else
                {
                    handler.CloseService <LR280Setting>();
                }
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(ret.Message);
            }
        }