private void btnSave_Click(object sender, EventArgs e) { _ETC.ReadSameCardInterval = txtReadSameCardInterval.IntergerValue; CommandResult ret = (new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect)).SaveSetting <ETCSetting>(_ETC); if (CustomCardTypeSetting.Current.GetCardType(ETCSetting.CardTyte) == null) //增加自定义卡片类型 { CustomCardTypeSetting.Current.AddCardType(ETCSetting.CardTyte, (byte)Ralid.Park.BusinessModel.Enum.CardType.MonthRentCard); ret = new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect).SaveSetting <CustomCardTypeSetting>(CustomCardTypeSetting.Current); } if (ret.Result == ResultCode.Successful) { AppSettings.CurrentSetting.SaveConfig("EnableETC", chkEnable.Checked.ToString()); OpenCardMessageHandler handler = GlobalSettings.Current.Get <OpenCardMessageHandler>(); if (chkEnable.Checked) { handler.InitService(_ETC); } else { handler.CloseService <ETCSetting>(); } this.DialogResult = DialogResult.OK; } else { MessageBox.Show(ret.Message); } }
private void btnSave_Click(object sender, EventArgs e) { YiTingShanFuSetting yt = new YiTingShanFuSetting(); yt.IP = txtIP.IP; yt.Port = txtPort.IntergerValue; AppSettings.CurrentSetting.SaveYiTingConfig(yt); foreach (DataGridViewRow row in dataGridView1.Rows) { if (!string.IsNullOrEmpty(row.Cells["colEntrance"].Value.ToString())) { YiTingPOS item = new YiTingPOS() { ID = (string)row.Cells["colReaderIP"].Value, EntranceID = (int)row.Cells["colEntrance"].Tag, Memo = (string)row.Cells["colMemo"].Value }; yt.Items.Add(item); } else { YiTingPOS item = new YiTingPOS() { ID = (string)row.Cells["colReaderIP"].Value, EntranceID = 0, Memo = (string)row.Cells["colMemo"].Value }; yt.Items.Add(item); } } CommandResult ret = (new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect)).SaveSetting <YiTingShanFuSetting>(yt); if (CustomCardTypeSetting.Current.GetCardType(YiTingShanFuSetting.CardType) == null) //增加自定义卡片类型 { CustomCardTypeSetting.Current.AddCardType(YiTingShanFuSetting.CardType, (byte)Ralid.Park.BusinessModel.Enum.CardType.MonthRentCard); new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect).SaveSetting <CustomCardTypeSetting>(CustomCardTypeSetting.Current); } if (ret.Result == ResultCode.Successful) { AppSettings.CurrentSetting.SaveConfig("EnableYiTingShanFu", chkEnable.Checked.ToString()); OpenCardMessageHandler handler = GlobalSettings.Current.Get <OpenCardMessageHandler>(); if (chkEnable.Checked) { handler.InitService(yt); } else { handler.CloseService <YiTingShanFuSetting>(); } this.DialogResult = DialogResult.OK; } else { MessageBox.Show(ret.Message); } }
private void btnSave_Click(object sender, EventArgs e) { if (!CheckInput()) { return; } YCTSetting yct = (new SysParaSettingsBll(AppSettings.CurrentSetting.ParkConnect)).GetOrCreateSetting <YCTSetting>(); yct.Items.Clear(); yct.ServiceCode = txtServiceCode.IntergerValue; yct.ReaderCode = txtReaderCode.IntergerValue; yct.MaxOfflineMonth = txtMaxofflineMonth.IntergerValue; foreach (DataGridViewRow row in dataGridView1.Rows) { yct.Items.Add(row.Tag as YCTItem); } CommandResult ret = (new SysParaSettingsBll(AppSettings.CurrentSetting.MasterParkConnect)).SaveSetting <YCTSetting>(yct); if (CustomCardTypeSetting.Current.GetCardType(YCTSetting.CardTyte) == null) //增加自定义卡片类型 { CustomCardTypeSetting.Current.AddCardType(YCTSetting.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("EnableYCT", chkEnable.Checked.ToString()); OpenCardMessageHandler handler = GlobalSettings.Current.Get <OpenCardMessageHandler>(); if (chkEnable.Checked) { handler.InitService(yct); } else { handler.CloseService <YCTSetting>(); } this.DialogResult = DialogResult.OK; } else { MessageBox.Show(ret.Message); } }
private void InitOpenCardServices(object obj) { OpenCardMessageHandler handler = new OpenCardMessageHandler(); GlobalSettings.Current.Set <OpenCardMessageHandler>(handler); GlobalSettings.Current.Set <Dictionary <int, CardEventReport> >(new Dictionary <int, CardEventReport>()); handler.Debug = this.chkDebug.Checked; handler.OnReadCard += new EventHandler <OpenCardEventArgs>(handler_OnReadCard); handler.OnPaying += new EventHandler <OpenCardEventArgs>(handler_OnPaying); handler.OnPaidOk += new EventHandler <OpenCardEventArgs>(handler_OnPaidOk); handler.OnPaidFail += new EventHandler <OpenCardEventArgs>(handler_OnPaidFail); handler.OnError += new EventHandler <OpenCardEventArgs>(handler_OnError); SysParaSettingsBll ssb = new SysParaSettingsBll(AppSettings.CurrentSetting.AvailableParkConnect); string temp = AppSettings.CurrentSetting.GetConfigContent("EnableZST"); bool enabled = false; if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled) { ZSTSettings zst = ssb.GetSetting <ZSTSettings>(); if (zst != null) { handler.InitService(zst); } } temp = AppSettings.CurrentSetting.GetConfigContent("EnableYiTingShanFu"); if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled) { YiTingShanFuSetting yt = ssb.GetSetting <YiTingShanFuSetting>(); if (yt != null) { AppSettings.CurrentSetting.GetYiTingConfig(yt); handler.InitService(yt); } } temp = AppSettings.CurrentSetting.GetConfigContent("EnableYCT"); if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled) { YCTSetting yct = ssb.GetSetting <YCTSetting>(); if (yct != null) { handler.InitService(yct); } } temp = AppSettings.CurrentSetting.GetConfigContent("EnableETC"); if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled) { ETCSetting etc = ETCSetting.GetSetting(); if (etc != null) { handler.InitService(etc); } } temp = AppSettings.CurrentSetting.GetConfigContent("EnableLR280"); if (!string.IsNullOrEmpty(temp) && bool.TryParse(temp, out enabled) && enabled) { Ralid.OpenCard.OpenCardService.LR280.LR280Setting lr280 = ssb.GetSetting <OpenCardService.LR280.LR280Setting>(); if (lr280 != null) { handler.InitService(lr280); } } this.Invoke((Action)(() => { ShowServiceState(); })); }