private bool paraCheck() { bool flag = false; Ecovalidate.checkTextIsNull(this.textBoxMySQLPort, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.label1.Text })); return(false); } if (!Ecovalidate.Rangeint(this.textBoxMySQLPort, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.label1.Text, "1", "65535" })); return(false); } Ecovalidate.checkTextIsNull(this.textBoxMySQLUsername, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.label2.Text })); return(false); } return(true); }
private void btCfgBackup_Click(object sender, System.EventArgs e) { if (!DBMaintain.ConvertOldDataFinish) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0])); return; } bool flag = false; Ecovalidate.checkTextIsNull(this.tbBackupPath, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbBackupPath.Text })); return; } Program.IdleTimer_Pause(1); progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_saving, new string[0]), null, new progressPopup.ProcessInThread(this.backupcfgPro), this.tbBackupPath.Text, 0); progressPopup.ShowDialog(); object return_V = progressPopup.Return_V; Program.IdleTimer_Run(1); int?num = return_V as int?; if (!num.HasValue || num < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
private bool paraoptCheck() { bool flag = false; if (this.cbkeepdata.Checked) { Ecovalidate.checkTextIsNull(this.tbkeepmonths, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbMonths.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbkeepmonths, 6, 60)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbMonths.Text, "6", "60" })); return(false); } } return(true); }
private void butSave_Click(object sender, System.EventArgs e) { bool flag = false; Ecovalidate.checkTextIsNull(this.tbIdleTimeOut, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbidletimeout.Text })); return; } if (!Ecovalidate.Rangeint(this.tbIdleTimeOut, 0, 30)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbidletimeout.Text, "0", "30" })); return; } int num = System.Convert.ToInt32(this.tbIdleTimeOut.Text); ValuePairs.setIdleTimeout(num, true); Program.m_IdleTimeSet = num * Program.m_IdleTimeFact; EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); base.DialogResult = DialogResult.OK; base.Close(); }
private bool DBparaCheck() { if (!this.checkBoxUseMySQL.Checked) { return(true); } bool flag = false; Ecovalidate.checkTextIsNull(this.tbDBIP, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbDBIP.Text })); return(false); } try { string text = IPAddress.Parse(this.tbDBIP.Text).ToString(); this.tbDBIP.Text = text; } catch (System.Exception) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.IPFORMAT, new string[0])); this.tbDBIP.Focus(); bool result = false; return(result); } Ecovalidate.checkTextIsNull(this.tbDBPort, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbDBPort.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbDBPort, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbDBPort.Text, "1", "65535" })); return(false); } Ecovalidate.checkTextIsNull(this.tbDBUsrnm, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbDBUsrnm.Text })); return(false); } return(true); }
private bool devConfigCheck() { string value = this.labDevModel.Tag.ToString(); string fmwareVer = this.labDevIp.Tag.ToString(); System.Convert.ToInt32(value); DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(this.labDevModel.Text, fmwareVer); bool flag = false; if (this.tbRefVoltage.Visible) { Ecovalidate.checkTextIsNull(this.tbRefVoltage, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbRefVoltage.Text })); return(false); } if (!Ecovalidate.RangeDouble(this.tbRefVoltage, 90.0, 260.0)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbRefVoltage.Text, "90", "260" })); return(false); } } flag = true; int num = devcfgUtil.UIThresholdEditFlg(deviceModelConfig, "dev"); Ecovalidate.checkThresholdValue(this.tbMinCurrent, this.labMaxCurrentBound, (num & 256) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMaxCurrent, this.labMaxCurrentBound, (num & 512) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMinVoltage, this.labMaxVoltageBound, (num & 1024) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMaxVoltage, this.labMaxVoltageBound, (num & 2048) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMinPower, this.labMaxPowerBound, (num & 4096) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMaxPower, this.labMaxPowerBound, (num & 8192) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMinPowerDiss, this.labMaxPowerDisBound, (num & 16384) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbMaxPowerDiss, this.labMaxPowerDisBound, (num & 32768) == 0, ref flag); if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_Thresholdinvalid, new string[0])); return(false); } Ecovalidate.checkThresholdMaxMixValue(this.tbMaxCurrent, this.tbMinCurrent, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbMaxVoltage, this.tbMinVoltage, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbMaxPower, this.tbMinPower, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbMaxPowerDiss, this.tbMinPowerDiss, ref flag); if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdMinMax, new string[0])); return(false); } return(true); }
private void num_KeyPress(object sender, KeyPressEventArgs e) { TextBox tb = (TextBox)sender; bool flag = Ecovalidate.inputCheck_float(tb, e.KeyChar, 2); if (flag) { return; } e.Handled = true; }
private void threshold_KeyPress(object sender, KeyPressEventArgs e) { TextBox textBox = (TextBox)sender; string arg_0D_0 = textBox.Text; bool flag = Ecovalidate.inputCheck_float(textBox, e.KeyChar, 1); if (flag) { return; } e.Handled = true; }
private bool bankCheck(DevModelConfig devcfg) { string text = this.tbBankNm.Text.Trim(); this.tbBankNm.Text = text; string text2 = this.labBankNo.Text; int num = System.Convert.ToInt32(text2); bool flag = false; if (((ulong)devcfg.bankOpt_nameempty & (ulong)(1L << (num - 1 & 31))) != 0uL) { Ecovalidate.checkTextIsNull(this.tbBankNm, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbBankNm.Text })); this.tbBankNm.BackColor = Color.Red; return(false); } this.tbBankNm.BackColor = Color.White; } if (this.gbThreshold.Visible) { flag = true; int num2 = devcfgUtil.UIThresholdEditFlg(devcfg, "bank"); Ecovalidate.checkThresholdValue(this.tbOMinCurrent, this.labMaxPortCurrentBound, (num2 & 256) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMaxCurrent, this.labMaxPortCurrentBound, (num2 & 512) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMinVoltage, this.labMaxVoltageBound, (num2 & 1024) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMaxVoltage, this.labMaxVoltageBound, (num2 & 2048) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMinPower, this.labMaxPowerBound, (num2 & 4096) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMaxPower, this.labMaxPowerBound, (num2 & 8192) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMinPowerDiss, this.labMaxPowerDisBound, (num2 & 16384) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbOMaxPowerDiss, this.labMaxPowerDisBound, (num2 & 32768) == 0, ref flag); if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_Thresholdinvalid, new string[0])); return(false); } Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxCurrent, this.tbOMinCurrent, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxVoltage, this.tbOMinVoltage, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxPower, this.tbOMinPower, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxPowerDiss, this.tbOMinPowerDiss, ref flag); if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdMinMax, new string[0])); return(false); } } return(true); }
private bool devConfigCheck() { string value = this.labDevModel.Tag.ToString(); string fmwareVer = this.labDevIp.Tag.ToString(); System.Convert.ToInt32(value); DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(this.labDevModel.Text, fmwareVer); bool flag = true; if (this.gbPop.Visible && this.cbPopEnable.Checked && this.rbPopUsrdef.Checked) { flag = false; Ecovalidate.checkTextIsNull(this.tbPopThreshold, ref flag); if (flag) { this.tbPopThreshold.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.rbPopUsrdef.Text })); return(false); } float num = 0f; try { num = System.Convert.ToSingle(this.tbPopThreshold.Text); } catch (System.Exception) { this.tbPopThreshold.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); bool result = false; return(result); } if (num > (float)deviceModelConfig.popUdefmax) { this.tbPopThreshold.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.rbPopUsrdef.Text, "0", deviceModelConfig.popUdefmax.ToString() })); return(false); } return(true); } return(true); }
private bool portparacheck(Label lb, TextBox tb, int Portindex) { bool flag = false; Ecovalidate.checkTextIsNull(tb, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { lb.Text })); return(false); } if (!Ecovalidate.Rangeint(tb, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { lb.Text, "1", "65535" })); return(false); } int port = System.Convert.ToInt32(tb.Text); bool flag2 = false; switch (Portindex) { case 0: case 2: case 3: flag2 = NetworkShareAccesser.TcpPortInUse(port); break; case 1: flag2 = NetworkShareAccesser.UDPPortInUse(port); break; } if (flag2) { tb.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[] { tb.Text })); return(false); } return(true); }
private void btCfgRestore_Click(object sender, System.EventArgs e) { if (!DBMaintain.ConvertOldDataFinish) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0])); return; } bool flag = false; Ecovalidate.checkTextIsNull(this.tbRestoreFile, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbRestoreFile.Text })); return; } if (!System.IO.File.Exists(this.tbRestoreFile.Text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.File_unexist, new string[0])); this.tbRestoreFile.Focus(); return; } DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DB_ConfigRestoreCrm, new string[0]), MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.Cancel) { return; } Program.IdleTimer_Pause(1); progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Restorecfg, new string[0]), null, new progressPopup.ProcessInThread(this.RestorecfgPro), this.tbRestoreFile.Text, 0); progressPopup.ShowDialog(); object return_V = progressPopup.Return_V; Program.IdleTimer_Run(1); int?num = return_V as int?; if (!num.HasValue || num < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.quitEcoFailed, new string[0])); Program.ExitApp(); return; } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.quitEcoSucc, new string[0])); Program.ExitApp(); }
private void btnDbExport_Click(object sender, System.EventArgs e) { if (!DBMaintain.ConvertOldDataFinish) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0])); return; } if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") && !DBMaintain.IsLocalIP(DBUrl.CURRENT_HOST_PATH)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBExportFail1, new string[0])); return; } bool flag = false; Ecovalidate.checkTextIsNull(this.tbExportPath, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbExportPath.Text })); return; } if (!DBTools.CheckFreeSpaceSize4ExportDB(this.tbExportPath.Text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBExportFail2, new string[0])); return; } Program.IdleTimer_Pause(1); progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_ExportDB, new string[0]), null, new progressPopup.ProcessInThread(this.dbExportPro), null, 0); progressPopup.ShowDialog(); object return_V = progressPopup.Return_V; Program.IdleTimer_Run(1); int?num = return_V as int?; if (!num.HasValue || num < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.quitEcoFailed, new string[0])); Program.ExitApp(); return; } EcoMessageBox.ShowInfo(this, EcoLanguage.getMsg(LangRes.quitEcoSucc, new string[0])); Program.ExitApp(); }
private void butSave_Click(object sender, System.EventArgs e) { bool flag = false; Ecovalidate.checkTextIsNull(this.tbZoneNm, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbZoneNm.Text })); return; } if (this.zoneNmExisted()) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Zone_nmdup, new string[] { this.tbZoneNm.Text })); this.tbZoneNm.Focus(); return; } if (this.colorExisted()) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Zone_colordup, new string[] { this.tbZoneNm.Text })); return; } int num; if (this.m_zoneID == -1L) { num = this.m_parent2.addZone(this.tbZoneNm.Text, this.labColor.BackColor); } else { num = this.m_parent2.modifyZone(this.m_zoneID, this.tbZoneNm.Text, this.labColor.BackColor); } if (num == 1) { base.Close(); } }
private void btnSMBBrowse_Click(object sender, System.EventArgs e) { string text = this.tbSMBUsername.Text; string text2 = this.tbSMBPsw.Text; if (text.Length > 0) { string arg_31_0 = this.tbSMBDir.Text; bool flag = false; Ecovalidate.checkTextIsNull(this.tbSMBDir, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbSMBDir.Text })); return; } string text3 = this.tbSMBDir.Text; string text4 = text3; while (text4.StartsWith("\\")) { text4 = text4.Substring(1); } int num = text4.IndexOf('\\'); if (num > 0) { text4 = text4.Substring(0, num); } NetworkShareAccesser networkShareAccesser = NetworkShareAccesser.Access(text4, text, text2); if (networkShareAccesser.Result.Length > 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Task_Connectfailed, new string[0])); return; } } FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); folderBrowserDialog.SelectedPath = this.tbSMBDir.Text; if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { this.tbSMBDir.Text = folderBrowserDialog.SelectedPath; } }
private void threshold_KeyPress(object sender, KeyPressEventArgs e) { TextBox textBox = (TextBox)sender; bool flag = Ecovalidate.inputCheck_float(textBox, e.KeyChar, 1); if (flag) { char keyChar = e.KeyChar; if ((keyChar == '.' || keyChar == ',') && (textBox.Name.Equals(this.tbOMinCurrent.Name) || textBox.Name.Equals(this.tbOMaxCurrent.Name))) { string text = this.labDevModel.Text; string fmwareVer = this.labDevIp.Tag.ToString(); if (DevAccessCfg.GetInstance().getDeviceModelConfig(text, fmwareVer).commonThresholdFlag == Constant.APC_PDU) { e.Handled = true; } } return; } e.Handled = true; }
private void btnGen_Click(object sender, System.EventArgs e) { if (!DBMaintain.ConvertOldDataFinish) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0])); return; } bool flag = false; Ecovalidate.checkTextIsNull(this.txttitle, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbtitle.Text })); this.txttitle.Focus(); return; } Ecovalidate.checkTextIsNull(this.txtwrite, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbwriter.Text })); this.txtwrite.Focus(); return; } if (this.grouplist.Items.Count == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_needadd, new string[0])); return; } DebugCenter.GetInstance().appendToFile("BillingAnalysis Start."); this.m_parent.showRpt(2, 0); }
private bool devConfigCheck() { string text = this.tbDevName.Text.Trim(); this.tbDevName.Text = text; bool flag = false; Ecovalidate.checkTextIsNull(this.tbDevName, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbName.Text })); this.tbDevName.BackColor = Color.Red; return(false); } InSnergyGateway gateWaybyGID = InSnergyGateway.GetGateWaybyGID(this.m_gatewayID); if (text.Equals(gateWaybyGID.GatewayName)) { this.tbDevName.BackColor = Color.White; return(true); } if (!InSnergyGateway.CheckGatewayName(text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_nmdup, new string[] { this.tbDevName.Text })); this.tbDevName.Focus(); this.tbDevName.BackColor = Color.Red; return(false); } this.tbDevName.BackColor = Color.White; return(true); }
private bool lineCheck(DevModelConfig devcfg) { string text = this.labLineNo.Text; System.Convert.ToInt32(text); bool flag = false; if (this.gbThreshold.Visible) { flag = true; int num = devcfgUtil.UIThresholdEditFlg(devcfg, "line"); Ecovalidate.checkThresholdValue(this.tbLMinCurrent, this.labMaxCurrentBound, (num & 256) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMaxCurrent, this.labMaxCurrentBound, (num & 512) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMinVoltage, this.labMaxVoltageBound, (num & 1024) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMaxVoltage, this.labMaxVoltageBound, (num & 2048) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMinPower, this.labMaxPowerBound, (num & 4096) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMaxPower, this.labMaxPowerBound, (num & 8192) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMinPowerDiss, this.labMaxPowerDisBound, (num & 16384) == 0, ref flag); Ecovalidate.checkThresholdValue(this.tbLMaxPowerDiss, this.labMaxPowerDisBound, (num & 32768) == 0, ref flag); if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_Thresholdinvalid, new string[0])); return(false); } Ecovalidate.checkThresholdMaxMixValue(this.tbLMaxCurrent, this.tbLMinCurrent, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbLMaxVoltage, this.tbLMinVoltage, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbLMaxPower, this.tbLMinPower, ref flag); Ecovalidate.checkThresholdMaxMixValue(this.tbLMaxPowerDiss, this.tbLMinPowerDiss, ref flag); if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdMinMax, new string[0])); return(false); } } return(true); }
private void butAdd_Click(object sender, System.EventArgs e) { if (this.dgvAutoDevice.Rows.Count == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_needselect, new string[0])); return; } bool flag = true; bool flag2 = false; for (int i = 0; i < this.dgvAutoDevice.Rows.Count; i++) { DataGridViewRow dataGridViewRow = this.dgvAutoDevice.Rows[i]; DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle(); if (System.Convert.ToBoolean(dataGridViewRow.Cells["datasel"].Value)) { if (System.Convert.ToString(dataGridViewRow.Cells["dgvtbOtherDevName"].Value).Equals(string.Empty)) { dataGridViewCellStyle.BackColor = Color.Red; dataGridViewRow.Cells["dgvtbOtherDevName"].Style = dataGridViewCellStyle; this.dgvAutoDevice.CurrentCell = dataGridViewRow.Cells["dgvtbOtherDevName"]; this.dgvAutoDevice.BeginEdit(true); flag = false; } else { string text = dataGridViewRow.Cells["dgvtbOtherDevName"].Value.ToString(); text = text.Trim(); dataGridViewRow.Cells["dgvtbOtherDevName"].Value = text; if (!Ecovalidate.ValidDevName(text) || !this.pduNmCheckAtDb(text) || !this.pduNmCheckAtControl(text, i, this.dgvAutoDevice.Rows)) { dataGridViewCellStyle.BackColor = Color.Red; dataGridViewRow.Cells["dgvtbOtherDevName"].Style = dataGridViewCellStyle; this.dgvAutoDevice.CurrentCell = dataGridViewRow.Cells["dgvtbOtherDevName"]; this.dgvAutoDevice.BeginEdit(true); flag = false; } } flag2 = true; } } if (!flag2) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_needselect, new string[0])); return; } if (!flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_nameErr, new string[0])); return; } int arg_1EE_0 = this.cbISGMeterType.SelectedIndex; System.Collections.Generic.List <System.Collections.Hashtable> list = new System.Collections.Generic.List <System.Collections.Hashtable>(); for (int j = 0; j < this.dgvAutoDevice.Rows.Count; j++) { DataGridViewRow dataGridViewRow2 = this.dgvAutoDevice.Rows[j]; if (System.Convert.ToBoolean(dataGridViewRow2.Cells["datasel"].Value)) { string value = dataGridViewRow2.Cells["dgvtbOtherDevName"].Value.ToString(); string value2 = dataGridViewRow2.Cells["dgvtbOtherDevType"].Value.ToString(); string value3 = dataGridViewRow2.Cells["dgvtbOtherDevIP"].Value.ToString(); string value4 = dataGridViewRow2.Cells["dgvtbOtherDevID"].Value.ToString(); System.Collections.Hashtable hashtable = new System.Collections.Hashtable(); hashtable["ip"] = value3; hashtable["devNm"] = value; hashtable["type"] = value2; hashtable["devID"] = value4; list.Add(hashtable); } } this.butAdd.Enabled = false; this.butCancel.Enabled = false; System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.addDeviceProc), list); }
private void buttonOK_Click(object sender, System.EventArgs e) { bool flag = false; if (this.textBoxTP1.Visible) { Ecovalidate.checkTextIsNull(this.textBoxTP1, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.labelGN1.Text })); this.textBoxTP1.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.textBoxTP1)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } if (this.textBoxTP2.Visible) { Ecovalidate.checkTextIsNull(this.textBoxTP2, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.labelGN2.Text })); this.textBoxTP2.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.textBoxTP2)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } if (this.textBoxTP3.Visible) { Ecovalidate.checkTextIsNull(this.textBoxTP3, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.labelGN3.Text })); this.textBoxTP3.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.textBoxTP3)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } if (this.textBoxTP4.Visible) { Ecovalidate.checkTextIsNull(this.textBoxTP4, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.labelGN4.Text })); this.textBoxTP4.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.textBoxTP4)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } for (int i = 0; i < this.m_Grouplist.Count; i++) { ListViewItem listViewItem = this.m_Grouplist[i]; switch (i) { case 0: { string text = listViewItem.Tag.ToString(); string[] array = text.Split(new char[] { '|' }); string tag = string.Concat(new string[] { array[0], "|", array[1], "|", array[2], "|", this.textBoxTP1.Text }); listViewItem.Tag = tag; break; } case 1: { string text = listViewItem.Tag.ToString(); string[] array = text.Split(new char[] { '|' }); string tag = string.Concat(new string[] { array[0], "|", array[1], "|", array[2], "|", this.textBoxTP2.Text }); listViewItem.Tag = tag; break; } case 2: { string text = listViewItem.Tag.ToString(); string[] array = text.Split(new char[] { '|' }); string tag = string.Concat(new string[] { array[0], "|", array[1], "|", array[2], "|", this.textBoxTP3.Text }); listViewItem.Tag = tag; break; } case 3: { string text = listViewItem.Tag.ToString(); string[] array = text.Split(new char[] { '|' }); string tag = string.Concat(new string[] { array[0], "|", array[1], "|", array[2], "|", this.textBoxTP4.Text }); listViewItem.Tag = tag; break; } } } base.DialogResult = DialogResult.OK; base.Close(); base.Dispose(); }
private void btnGen_Click(object sender, System.EventArgs e) { if (!DBMaintain.ConvertOldDataFinish) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0])); return; } bool flag = false; Ecovalidate.checkTextIsNull(this.txttitle, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbtitle.Text })); this.txttitle.Focus(); return; } Ecovalidate.checkTextIsNull(this.txtwrite, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbwriter.Text })); this.txtwrite.Focus(); return; } if (this.grouplist.Items.Count == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_needadd, new string[0])); return; } if (this.cboperiod.SelectedIndex == 1) { Ecovalidate.checkTextIsNull(this.tbduration, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.label15.Text })); this.txtwrite.Focus(); return; } if (!Ecovalidate.Rangeint(this.tbduration, 1, 31)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.label15.Text, "1", "31" })); return; } } if (!this.chkchart1.Checked && !this.chkchart2.Checked && !this.chkchart3.Checked && !this.chkchart4.Checked && !this.chkchart5.Checked && !this.chkchart6.Checked && !this.chkchart7.Checked && !this.chkchart8.Checked && !this.chkchart9.Checked) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rpt_selchart, new string[0])); return; } if (this.chkchart3.Checked || this.chkchart5.Checked || this.chkchart8.Checked) { if (this.txtco2_elec.Text.Length == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rpt_needCo2, new string[0])); this.txtco2_elec.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.txtco2_elec)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } if (this.chkchart4.Checked || this.chkchart8.Checked) { if (this.txtprice_elec.Text.Length == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rpt_needEctCost, new string[0])); this.txtprice_elec.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.txtprice_elec)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } if (this.chkchart5.Checked || this.chkchart8.Checked) { if (this.txtprice_co2.Text.Length == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rpt_needCo2Cost, new string[0])); this.txtprice_co2.Focus(); return; } if (!Ecovalidate.NumberFormat_double(this.txtprice_co2)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return; } } if (this.chkchart9.Checked) { EGenRptSetPUE eGenRptSetPUE = new EGenRptSetPUE(this.grouplist.Items); DialogResult dialogResult = eGenRptSetPUE.ShowDialog(); if (dialogResult == DialogResult.Cancel) { return; } } string text = ""; switch (this.cboperiod.SelectedIndex) { case 0: text += "Report Type: Hour"; break; case 1: text += "Report Type: Day"; break; case 2: text += "Report Type: Month"; break; case 3: text += "Report Type: Quarter"; break; } object obj = text; text = string.Concat(new object[] { obj, " | Start: ", this.BeginText, " | Duration: ", this.Cboduration }); DebugCenter.GetInstance().appendToFile("PowerAnalysis Begin. | " + text); this.m_parent.showRpt(2, 0); }
private bool paraCheck() { bool flag = false; if (this.rbBilling1rate.Checked) { Ecovalidate.checkTextIsNull(this.tb1rate, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.rbBilling1rate.Text })); return(false); } if (!Ecovalidate.NumberFormat_double(this.tb1rate)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return(false); } } else { Ecovalidate.checkTextIsNull(this.tbduration, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbDuration.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbduration, 1, 23)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbDuration.Text, "1", "23" })); return(false); } Ecovalidate.checkTextIsNull(this.tb2Rate1, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbPeak.Text })); return(false); } if (!Ecovalidate.NumberFormat_double(this.tb2Rate1)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return(false); } Ecovalidate.checkTextIsNull(this.tb2Rate2, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbnonPeak.Text })); return(false); } if (!Ecovalidate.NumberFormat_double(this.tb2Rate2)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0])); return(false); } } return(true); }
private void butSysparaSave_Click(object sender, System.EventArgs e) { int bPFlag = Sys_Para.GetBPFlag(); int num = 0; int bPPort = Sys_Para.GetBPPort(); int num2 = bPPort; string bPSecurity = Sys_Para.GetBPSecurity(); string text = Sys_Para.GetBPSecurity(); bool flag = false; if (this.cbEnableBP.Checked) { num = 1; Ecovalidate.checkTextIsNull(this.tbBPlistenport, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbBPlistenPort.Text })); return; } if (!Ecovalidate.Rangeint(this.tbBPlistenport, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbBPlistenPort.Text, "1", "65535" })); return; } num2 = System.Convert.ToInt32(this.tbBPlistenport.Text); if (bPPort != num2) { bool flag2 = NetworkShareAccesser.TcpPortInUse(num2); if (flag2) { this.tbBPlistenport.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[] { this.tbBPlistenport.Text })); return; } } Ecovalidate.checkTextIsNull(this.tbBPsecuritystr, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbBPsecuritystr.Text })); return; } text = this.tbBPsecuritystr.Text; } if (bPFlag != num || bPPort != num2 || !bPSecurity.Equals(text)) { Sys_Para.SetBPFlag(num); Sys_Para.SetBPPort(num2); Sys_Para.SetBPSecurity(text); InSnergyService.RestartBillingProtocol(num == 1, num2, text); } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
private void btnSave_Click(object sender, System.EventArgs e) { string str_type = "zone"; switch (this.cboType.SelectedIndex) { case 0: str_type = "zone"; break; case 1: str_type = "rack"; break; case 2: str_type = "dev"; break; case 3: str_type = "outlet"; break; } bool flag = false; Ecovalidate.checkTextIsNull(this.tbname, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbname.Text })); this.tbname.Focus(); return; } string text = this.tbname.Text; System.Collections.Generic.List <long> list = new System.Collections.Generic.List <long>(); for (int i = 0; i < this.dgvGpmember.Rows.Count; i++) { if (this.dgvGpmember.Rows[i].Selected) { string value = this.dgvGpmember.Rows[i].Cells[0].Value.ToString(); list.Add((long)System.Convert.ToInt32(value)); } } if (list.Count == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0])); this.dgvGpmember.Focus(); return; } int num = GroupInfo.CreateNewGroup(text, str_type, "", list); if (num == -2) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_nmdup, new string[] { text })); return; } if (num < 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } EcoGlobalVar.setDashBoardFlg(512uL, "", 64); EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); base.Close(); }
private bool checkValue() { string text = this.tbRow.Text; string text2 = this.tbColumn.Text; string text3 = this.rbH.Checked ? "H" : "V"; bool flag = false; Ecovalidate.checkTextIsNull(this.tbRackNm, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbRackNm.Text })); return(false); } string text4 = this.tbRackNm.Text; Ecovalidate.checkTextIsNull(this.tbRow, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbRow.Text })); return(false); } int cur_DCRows = DevManFloorGrids.Cur_DCRows; int cur_DCColumns = DevManFloorGrids.Cur_DCColumns; if (!Ecovalidate.Rangeint(this.tbRow, 1, cur_DCRows)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbRow.Text, "1", cur_DCRows.ToString() })); return(false); } Ecovalidate.checkTextIsNull(this.tbColumn, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbColumn.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbColumn, 1, cur_DCColumns)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbColumn.Text, "1", cur_DCColumns.ToString() })); return(false); } if ((int)System.Convert.ToInt16(text) == cur_DCRows && text3.Equals("V")) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail1, new string[0])); this.tbRow.Focus(); return(false); } if ((int)System.Convert.ToInt16(text2) == cur_DCColumns && text3.Equals("H")) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail1, new string[0])); this.tbColumn.Focus(); return(false); } if (!RackInfo.CheckOriginalName(this.m_rackID, text4)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_nmdup, new string[] { text4 })); this.tbRackNm.Focus(); return(false); } return(true); }
private bool sysparaCheck() { bool flag = false; Ecovalidate.checkTextIsNull(this.tbSysUserNm, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbUsername.Text })); return(false); } Ecovalidate.checkTextIsNull(this.tbSysTimeOut, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbtimeout.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbSysTimeOut, 100, 5000)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbtimeout.Text, "100", "5000" })); return(false); } Ecovalidate.checkTextIsNull(this.tbSysPort, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbSysPort.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbSysTimeOut, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbSysPort.Text, "1", "65535" })); return(false); } Ecovalidate.checkTextIsNull(this.tbSysRetry, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbSysRetry.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbSysRetry, 1, 5)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbSysRetry.Text, "1", "5" })); return(false); } if (System.Convert.ToInt16(((Combobox_item)this.cbSnmpV.SelectedItem).getKey()) == 3 && !this.cbSysAuthen.SelectedItem.ToString().Equals("None")) { Ecovalidate.checkTextIsNull(this.tbSysAuthenPw, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbSysAuthenPw.Text })); return(false); } if (!Ecovalidate.minlength(this.tbSysAuthenPw, 8)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.minlength, new string[] { this.lbSysAuthenPw.Text, "8" })); return(false); } if (!this.cbSysPrivacy.SelectedItem.ToString().Equals("None")) { Ecovalidate.checkTextIsNull(this.tbSysPrivacyPw, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbSysPrivacyPw.Text })); return(false); } if (!Ecovalidate.minlength(this.tbSysPrivacyPw, 8)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.minlength, new string[] { this.lbSysPrivacyPw.Text, "8" })); return(false); } } } return(true); }
private void btnSave_Click(object sender, System.EventArgs e) { bool flag = false; Ecovalidate.checkTextIsNull(this.tbname, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbname.Text })); this.tbname.Focus(); return; } string text = this.tbname.Text; if (!GroupInfo.CheckGroupName(this.m_groupID, text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_nmdup, new string[] { text })); this.tbname.Focus(); return; } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); System.Collections.Generic.List <long> list = new System.Collections.Generic.List <long>(); string text2; foreach (DataRow dataRow in this.member_tb.Rows) { text2 = (string)dataRow[0]; stringBuilder.Append(text2 + ","); list.Add((long)System.Convert.ToInt32(text2)); } text2 = stringBuilder.ToString(); if (text2.Length == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0])); return; } if (this.m_groupID >= 0L) { GroupInfo groupByID = GroupInfo.GetGroupByID(this.m_groupID); groupByID.GroupName = text; groupByID.Members = text2; switch (groupByID.Update()) { case -2: case -1: EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; case 0: break; case 1: LogAPI.writeEventLog("0430032", new string[] { groupByID.GroupName, groupByID.GroupType, EcoGlobalVar.gl_LoginUser.UserName }); EcoGlobalVar.setDashBoardFlg(520uL, "", 64); EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); base.DialogResult = DialogResult.OK; base.Close(); return; default: return; } } else { int num = GroupInfo.CreateNewGroup(text, this.m_groupType, "", list); if (num == -2) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_nmdup, new string[] { text })); return; } if (num < 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } LogAPI.writeEventLog("0430030", new string[] { text, this.m_groupType, EcoGlobalVar.gl_LoginUser.UserName }); EcoGlobalVar.setDashBoardFlg(512uL, "", 64); EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); base.DialogResult = DialogResult.OK; base.Close(); } }
private void btnsave_Click(object sender, System.EventArgs e) { int status = 0; string eVENT = ""; int authenticationFlag = 0; string text = this.txtto.Text.Replace("'", "''"); if (this.cboevent.SelectedIndex == 0) { eVENT = "All"; } else { if (this.cboevent.SelectedIndex == 1) { eVENT = "Event"; } else { if (this.cboevent.SelectedIndex == 2) { eVENT = "Severity"; } } } bool flag = false; if (this.chkenablesmtp.Checked) { status = 1; Ecovalidate.checkTextIsNull(this.txtserver, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbserver.Text })); return; } Ecovalidate.checkTextIsNull(this.txtport, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbport.Text })); return; } if (!Ecovalidate.Rangeint(this.txtport, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbport.Text, "1", "65535" })); return; } Ecovalidate.checkTextIsNull(this.txtfrom, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbfrom.Text })); return; } Ecovalidate.checkTextIsNull(this.txtto, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbto.Text })); return; } if (!Ecovalidate.validEmail(this.txtfrom.Text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.validEmail, new string[0])); this.txtfrom.Focus(); return; } if (text.Length < 5) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.validEmail, new string[0])); this.txtto.Focus(); return; } while (text.Substring(text.Length - 2) == "\r\n") { text = text.Substring(0, text.Length - 2); } string[] array = text.Split(new string[] { "\r\n", ";", ",", " " }, System.StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; if (text2 != "" && !Ecovalidate.validEmail(text2)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.validEmail, new string[0])); this.txtto.Focus(); return; } } } if (this.chkauth.Checked) { authenticationFlag = 1; Ecovalidate.checkTextIsNull(this.txtaccount, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbaccount.Text })); return; } Ecovalidate.checkTextIsNull(this.txtpwd, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbpwd.Text })); return; } } this.m_pSMTPpara.Status = status; this.m_pSMTPpara.ServerIP = this.txtserver.Text; this.m_pSMTPpara.Port = System.Convert.ToInt32(this.txtport.Text); this.m_pSMTPpara.Sender = this.txtfrom.Text; this.m_pSMTPpara.Receiver = this.txtto.Text; this.m_pSMTPpara.EVENT = eVENT; this.m_pSMTPpara.AuthenticationFlag = authenticationFlag; this.m_pSMTPpara.AccountName = this.txtaccount.Text; this.m_pSMTPpara.AccountPwd = this.txtpwd.Text; int num = this.m_pSMTPpara.UpdateSetting(); if (num < 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0130021", new string[] { valuePair }); } else { LogAPI.writeEventLog("0130021", new string[0]); } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
private void btnDbImport_Click(object sender, System.EventArgs e) { bool flag = false; Ecovalidate.checkTextIsNull(this.tbImportFile, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbImportFile.Text })); return; } if (!System.IO.File.Exists(this.tbImportFile.Text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.File_unexist, new string[0])); this.tbImportFile.Focus(); return; } DBTools.ProgramBar_Percent = 1; progressPopup progressPopup = new progressPopup("Information", 2, EcoLanguage.getMsg(LangRes.PopProgressMsg_Checkfile, new string[0]), null, new progressPopup.ProcessInThread(this.dbCheckImportFile), this.tbImportFile.Text, new progressPopup.ProgramBarThread(this.dbCheckImportFileBar), 0); progressPopup.ShowDialog(); object return_V = progressPopup.Return_V; string text = return_V as string; if (text == null || text.Length == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.File_illegal, new string[0])); this.tbImportFile.Focus(); return; } if (text.StartsWith("DISKSIZELOW")) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBImportFail2, new string[0])); this.tbImportFile.Focus(); return; } if (text.StartsWith("UNZIP_ERROR")) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBunziperror, new string[0])); return; } string text2 = "MYSQLVERSIONERROR;"; if (text.StartsWith(text2)) { string text3 = text.Substring(text2.Length); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.needHighVerMySQL, new string[] { text3 })); return; } if (text.StartsWith("DBVERSION_ERROR")) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBImportLowVerError, new string[0])); return; } if (text.StartsWith("MYSQL_CONNECT_ERROR")) { mysqlsetting mysqlsetting = new mysqlsetting(text); DialogResult dialogResult = mysqlsetting.ShowDialog(); if (dialogResult != DialogResult.OK) { return; } string text4 = DBUtil.CheckMySQLVersion("127.0.0.1", mysqlsetting.DBPort, mysqlsetting.DBusrnm, mysqlsetting.DBPsw, mysqlsetting.mySQLVer); if (text4.Length > 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.needHighVerMySQL, new string[] { text4 })); return; } string[] array = text.Split(new string[] { "," }, System.StringSplitOptions.RemoveEmptyEntries); string text5 = array[5]; text = string.Concat(new object[] { "127.0.0.1,", mysqlsetting.DBPort, ",", mysqlsetting.DBusrnm, ",", mysqlsetting.DBPsw, ",", text5, ",RESET" }); } DialogResult dialogResult2 = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DB_ChangeCrm, new string[0]), MessageBoxButtons.OKCancel); if (dialogResult2 == DialogResult.Cancel) { return; } DBTools.ProgramBar_Percent = 1; progressPopup = new progressPopup("Information", 2, EcoLanguage.getMsg(LangRes.PopProgressMsg_ImportDB, new string[0]), null, new progressPopup.ProcessInThread(this.dbImportPro), text, new progressPopup.ProgramBarThread(this.dbImportProBar), 0); progressPopup.ShowDialog(); return_V = progressPopup.Return_V; int?num = return_V as int?; if (!num.HasValue || num < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } base.DialogResult = DialogResult.OK; }