private void ClearSetting() { this.ucipHost.IP = "0.0.0.0"; this.ucipStandby.IP = "0.0.0.0"; this.gvSMSList.Rows.Clear(); _Current = null; }
private HostStandbySetting GetSettingFromInput(HostStandbySetting setting) { if (setting == null) { setting = new HostStandbySetting(); } setting.ParkID = this.comPark.SelectedParkID; setting.HostIP = this.ucipHost.IP; setting.StandbyIP = this.ucipStandby.IP; setting.SendSMS = this.chkSendSMS.Checked; setting.SMSItems = new List <SMSItem>(); foreach (DataGridViewRow row in this.gvSMSList.Rows) { if (!row.IsNewRow) { SMSItem item = new SMSItem(); item.Name = Convert.ToString(row.Cells["colName"].Value).Trim(); item.Telephone = Convert.ToString(row.Cells["colTelephone"].Value).Trim(); setting.SMSItems.Add(item); } } return(setting); }
/// <summary> /// 保存双机热备设置 /// </summary> /// <param name="setting"></param> /// <returns></returns> public bool Save(HostStandbySetting setting) { SysParaSettingsBll bll = new SysParaSettingsBll(_RepoUri); CommandResult ret = bll.SaveSetting <HostStandbySetting>(setting, "HostStandbySetting_Park" + setting.ParkID.ToString()); return(ret.Result == ResultCode.Successful); }
/// <summary> /// 根据parkID获取双机热备设置 /// </summary> /// <returns></returns> public HostStandbySetting Get(int parkID) { SysParaSettingsBll bll = new SysParaSettingsBll(_RepoUri); HostStandbySetting setting = bll.GetSetting <HostStandbySetting>("HostStandbySetting_Park" + parkID.ToString()); return(setting); }
private void ShowSetting(HostStandbySetting setting) { if (setting != null) { this.ucipHost.IP = setting.HostIP; this.ucipStandby.IP = setting.StandbyIP; this.chkSendSMS.Checked = setting.SendSMS; ShowSMSListOnGrid(setting.SMSItems); } else { ClearSetting(); } }
private void comPark_SelectedIndexChanged(object sender, EventArgs e) { int parkID = this.comPark.SelectedParkID; if (parkID > 0) { HostStandbySettingBll bll = new HostStandbySettingBll(AppSettings.CurrentSetting.ParkConnect); _Current = bll.Get(parkID); } else { _Current = null; } ShowSetting(_Current); }
private void btnSave_Click(object sender, EventArgs e) { if (CheckInput()) { HostStandbySettingBll bll = new HostStandbySettingBll(AppSettings.CurrentSetting.ParkConnect); _Current = GetSettingFromInput(_Current); if (bll.Save(_Current)) { MessageBox.Show("保存成功"); } else { MessageBox.Show("保存失败"); } } }