private void btnSave_Click(object sender, System.EventArgs e) { string text = Sys_Para.GetBillPath(); if (text.Length == 0) { text = System.IO.Directory.GetCurrentDirectory() + "\\BillReportFile\\"; } System.DateTime now = System.DateTime.Now; int num = this.SaveToFile(text + now.ToString("yyyy-MM-dd HH-mm-ss"), this.m_pParaClass.Txttitle); if (num == -1) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rpt_saveErr1, new string[0])); return; } if (num == -2) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } string str = text + now.ToString("yyyy-MM-dd HH-mm-ss") + "\\" + this.m_pParaClass.Txttitle.Replace("'", "''"); if (ReportInfo.InsertBillReport(this.m_pParaClass.Txttitle, this.m_pParaClass.Txtwriter, now, str + ".html") == 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } this.m_isRPTSaved = true; EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
private void butSysparaSave_Click(object sender, System.EventArgs e) { if (!this.paraCheck()) { return; } if (this.rbBilling1rate.Checked) { float bill_1rate = System.Convert.ToSingle(this.tb1rate.Text); if (Sys_Para.SetBill_ratetype(0) < 0 || Sys_Para.SetBill_1rate(bill_1rate) < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } } else { float bill_2rate = System.Convert.ToSingle(this.tb2Rate1.Text); float bill_2rate2 = System.Convert.ToSingle(this.tb2Rate2.Text); string bill_2from = this.dtPicker2from1.Text + ":00:00"; int bill_2duration = System.Convert.ToInt32(this.tbduration.Text); if (Sys_Para.SetBill_ratetype(1) < 0 || Sys_Para.SetBill_2from1(bill_2from) < 0 || Sys_Para.SetBill_2duration1(bill_2duration) < 0 || Sys_Para.SetBill_2rate1(bill_2rate) < 0 || Sys_Para.SetBill_2rate2(bill_2rate2) < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
private void btnSave_Click(object sender, System.EventArgs e) { string text = this.txtpath.Text; if (text == "") { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbpath.Text })); return; } for (int i = 0; i < text.Length; i++) { char c = text.Substring(i, 1).ToCharArray()[0]; if (c > '~') { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.RptMng_pathErr1, new string[0])); return; } } int num = Sys_Para.UpdateDefinePath(this.txtpath.Text.Replace("'", "''")); if (num > 0) { EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); } }
public void pageInit() { this.m_pSyspara = new Sys_Para(); this.tbSysUserNm.Text = this.m_pSyspara.username; this.tbSysPort.Text = System.Convert.ToString(this.m_pSyspara.port); this.tbSysTimeOut.Text = System.Convert.ToString(this.m_pSyspara.timeout); this.tbSysRetry.Text = System.Convert.ToString(this.m_pSyspara.retry); switch (this.m_pSyspara.SnmpVersion) { case 1: this.cbSnmpV.SelectedItem = this.m_snmpV1Comb; this.showV3setting(false); this.cbSysPrivacy.SelectedItem = "None"; this.tbSysPrivacyPw.Text = string.Empty; this.cbSysAuthen.SelectedItem = "None"; this.tbSysAuthenPw.Text = string.Empty; return; case 2: this.cbSnmpV.SelectedItem = this.m_snmpV2Comb; this.showV3setting(false); this.cbSysPrivacy.SelectedItem = "None"; this.tbSysPrivacyPw.Text = string.Empty; this.cbSysAuthen.SelectedItem = "None"; this.tbSysAuthenPw.Text = string.Empty; return; case 3: this.cbSnmpV.SelectedItem = this.m_snmpV3Comb; this.showV3setting(true); this.cbSysPrivacy.SelectedItem = this.m_pSyspara.privacy; this.tbSysPrivacyPw.Text = this.m_pSyspara.privacypwd; this.cbSysAuthen.SelectedItem = this.m_pSyspara.authen; this.tbSysAuthenPw.Text = this.m_pSyspara.authenpwd; if (this.m_pSyspara.authen.Equals("None")) { this.tbSysAuthenPw.Enabled = false; this.cbSysPrivacy.SelectedItem = "None"; this.cbSysPrivacy.Enabled = false; this.tbSysPrivacyPw.Enabled = false; return; } this.tbSysAuthenPw.Enabled = true; if (this.m_pSyspara.privacy.Equals("None")) { this.tbSysPrivacyPw.Enabled = false; return; } this.tbSysPrivacyPw.Enabled = true; return; default: return; } }
public void pageInit() { this.panellist.Visible = true; this.dtpFrom.Text = System.DateTime.Now.AddDays((double)(1 - System.DateTime.Now.Day)).ToString("yyyy-MM-dd 00:00:00"); this.dtpTo.Text = System.DateTime.Now.AddDays((double)(1 - System.DateTime.Now.Day)).AddMonths(1).AddDays(-1.0).ToString("yyyy-MM-dd 23:59:59"); this.cboby.SelectedIndex = 0; this.txtpath.Text = Sys_Para.GetDefinePath(); if (this.txtpath.Text.Length == 0) { this.txtpath.Text = System.IO.Directory.GetCurrentDirectory() + "\\PWReportFile\\"; } this.DataBind(this.cboby.SelectedIndex.ToString()); }
public void pageInit_1(EnegAnalysis parent) { this.m_parent = parent; this.pbLoading.Visible = false; this.btndel.Enabled = true; this.btnAdd.Enabled = true; this.dtptime.Value = System.DateTime.Now; this.m_dtbeginlast = this.dtptime.Value; this.cboperiod.SelectedIndex = 0; this.m_oldcboperiodindex = this.cboperiod.SelectedIndex; float cO2KG = Sys_Para.GetCO2KG(); if (cO2KG < 0f) { this.txtco2_elec.Text = ""; } else { this.txtco2_elec.Text = cO2KG.ToString("F2"); } float eLECTRICITYCOST = Sys_Para.GetELECTRICITYCOST(); if (eLECTRICITYCOST < 0f) { this.txtprice_elec.Text = ""; } else { this.txtprice_elec.Text = eLECTRICITYCOST.ToString("F2"); } float cO2COST = Sys_Para.GetCO2COST(); if (eLECTRICITYCOST < 0f) { this.txtprice_co2.Text = ""; } else { this.txtprice_co2.Text = cO2COST.ToString("F2"); } this.label39.Text = EcoGlobalVar.CurCurrency + this.m_ElecUnit; this.label2.Text = EcoGlobalVar.CurCurrency + this.m_CO2Unit; this.FillgroupList(); if (!DBTools.DatabaseIsReady()) { EcoMessageBox.ShowInfo(this, EcoLanguage.getMsg(LangRes.DB_waitready, new string[0])); this.btnGen.Enabled = false; return; } this.btnGen.Enabled = true; }
public static Common.Business.Sys_Para Fetch(Sys_Para data) { Common.Business.Sys_Para item = (Common.Business.Sys_Para)Activator.CreateInstance(typeof(Common.Business.Sys_Para)); //using (ObjectFactory.BypassPropertyChecks(item)) { item.ParaName = data.ParaName; item.ParaValue = data.ParaValue; item.ParaExplain = data.ParaExplain; item.SubSystem = data.SubSystem; } ObjectFactory.MarkAsChild(item); ObjectFactory.MarkOld(item); return(item); }
public void pageInit() { this.tbIP.Text = "127.0.0.1"; if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL")) { this.textBoxMySQLPort.Text = DBUrl.CURRENT_PORT.ToString(); this.textBoxMySQLUsername.Text = DBUrl.CURRENT_USER_NAME; this.textBoxMySQLPassword.Text = DBUrl.CURRENT_PWD; this.checkBoxUseMySQL.Checked = true; this.textBoxMySQLPort.Enabled = false; this.textBoxMySQLUsername.Enabled = false; this.textBoxMySQLPassword.Enabled = false; } else { this.checkBoxUseMySQL.Checked = false; this.textBoxMySQLPort.Enabled = false; this.textBoxMySQLUsername.Enabled = false; this.textBoxMySQLPassword.Enabled = false; } this.btnsavedb.Enabled = false; if (Sys_Para.GetDBOpt_keepMMflag() == 1) { this.cbkeepdata.Checked = true; this.tbkeepmonths.Enabled = true; this.tbkeepmonths.Text = System.Convert.ToString(Sys_Para.GetDBOpt_keepMM()); } else { this.cbkeepdata.Checked = false; this.tbkeepmonths.Enabled = false; this.tbkeepmonths.Text = System.Convert.ToString(Sys_Para.GetDBOpt_keepMM()); } if (Sys_Para.GetDBOpt_deloldflag() == 1) { this.cbdelOlddata.Checked = true; } else { this.cbdelOlddata.Checked = false; } if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") && !DBMaintain.IsLocalIP(DBUrl.CURRENT_HOST_PATH)) { this.cbdelOlddata.Visible = false; return; } this.cbdelOlddata.Visible = true; }
public void pageInit() { this.lbCurrency1.Text = string.Format(this.m_lbCurrency1txt, EcoGlobalVar.CurCurrency); this.lbRCurrency2.Text = string.Format(this.m_lbRCurrencytxt, EcoGlobalVar.CurCurrency); if (Sys_Para.GetBill_ratetype() == 0) { this.rbBilling1rate.Checked = true; } else { this.rbBilling2rate.Checked = true; } float bill_1rate = Sys_Para.GetBill_1rate(); if (bill_1rate < 0f) { this.tb1rate.Text = ""; } else { this.tb1rate.Text = bill_1rate.ToString("F2"); } this.dtPicker2from1.Text = Sys_Para.GetBill_2from1(); this.tbduration.Text = Sys_Para.GetBill_2duration1().ToString(); float bill_2rate = Sys_Para.GetBill_2rate1(); if (bill_2rate < 0f) { this.tb2Rate1.Text = ""; } else { this.tb2Rate1.Text = bill_2rate.ToString("F2"); } float bill_2rate2 = Sys_Para.GetBill_2rate2(); if (bill_2rate2 < 0f) { this.tb2Rate2.Text = ""; return; } this.tb2Rate2.Text = bill_2rate2.ToString("F2"); }
private void btnsaveopt_Click(object sender, System.EventArgs e) { if (!this.paraoptCheck()) { return; } if (this.cbkeepdata.Checked) { Sys_Para.SetDBOpt_keepMMflag(1); int dBOpt_keepMM = System.Convert.ToInt32(this.tbkeepmonths.Text); Sys_Para.SetDBOpt_keepMM(dBOpt_keepMM); } else { Sys_Para.SetDBOpt_keepMMflag(0); } if (this.cbdelOlddata.Visible) { if (this.cbdelOlddata.Checked) { Sys_Para.SetDBOpt_deloldflag(1); } else { Sys_Para.SetDBOpt_deloldflag(0); } } string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0130020", new string[] { valuePair }); } else { LogAPI.writeEventLog("0130020", new string[0]); } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
public void pageInit() { if (Sys_Para.GetBPFlag() == 0) { this.cbEnableBP.Checked = false; this.tbBPlistenport.Enabled = false; this.tbBPlistenport.Text = System.Convert.ToString(Sys_Para.GetBPPort()); this.tbBPsecuritystr.Enabled = false; this.tbBPsecuritystr.Text = Sys_Para.GetBPSecurity(); } else { this.cbEnableBP.Checked = true; this.tbBPlistenport.Enabled = true; this.tbBPlistenport.Text = System.Convert.ToString(Sys_Para.GetBPPort()); this.tbBPsecuritystr.Enabled = true; this.tbBPsecuritystr.Text = Sys_Para.GetBPSecurity(); } this.lbManagerPort.Hide(); this.tbManagerPort.Hide(); }
public RackInfoDlg(ManRack parent, long rackID) { this.InitializeComponent(); this.tbRackNm.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbRow.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbColumn.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.m_Parent2 = parent; this.m_rackID = rackID; if (Sys_Para.GetRackFullNameflag() == 1) { this.lbRackFNm.Visible = true; this.tbRackFNm.Visible = true; } else { this.lbRackFNm.Visible = false; this.tbRackFNm.Visible = false; } if (rackID == -1L) { return; } this.initPage(rackID); }
public static void LoadPUEData(ref double[] ret_v, ref int[] DB_Flg, ref string[] strTimePrompt) { try { int iSGFlag = Sys_Para.GetISGFlag(); int iTPowerFlag = Sys_Para.GetITPowerFlag(); DB_Flg[0] = iSGFlag; DB_Flg[1] = iTPowerFlag; if (iSGFlag != 0) { DateTime now = DateTime.Now; double num = 0.0; double num2 = 0.0; List <InSnergyGateway> allGateWay = InSnergyGateway.GetAllGateWay(); foreach (InSnergyGateway current in allGateWay) { if (InSnergyService.IsGatewayOnlineEx(current.GatewayID)) { foreach (Branch current2 in current.BranchList) { if (InSnergyService.IsBranchOnlineEx(current2.GatewayID, current2.BranchID)) { Dictionary <string, IMeter> branchEx = InSnergyService.GetBranchEx(current.GatewayID, current2.BranchID); foreach (SubMeter current3 in current2.SubMeterList) { if (branchEx.ContainsKey(current3.SubmeterID) && current3.ElectricityUsage != 0) { IMeter meter = branchEx[current3.SubmeterID]; switch (current3.ElectricityUsage) { case 1: if (meter.listParam.ContainsKey(5)) { double dvalue = meter.listParam[5].dvalue; num += dvalue; } break; case 2: if (meter.listParam.ContainsKey(5)) { double dvalue = meter.listParam[5].dvalue; num2 += dvalue; } break; } } } } } } } double num3; if (iTPowerFlag == 1) { num3 = num; } else { num3 = num; } double num4 = num3 + num2; ret_v[0] = num3; ret_v[1] = num4; strTimePrompt[0] = ""; strTimePrompt[1] = ""; if (InSnergyGateway.Need_Calculate_PUE) { DebugCenter.GetInstance().appendToFile("^^^ Begin to update PUE data "); DateTime now2 = DateTime.Now; num = InSnergyGateway.GetPUE(0); num2 = InSnergyGateway.GetPUE(1); num3 = num; if (iTPowerFlag == 1) { double dataCenterPDSum = DBTools.GetDataCenterPDSum(0); num3 = dataCenterPDSum + num; } num4 = num3 + num2; ret_v[2] = num3; ret_v[3] = num4; strTimePrompt[2] = now.ToString("yyyy/MM/dd HH", DateTimeFormatInfo.InvariantInfo); strTimePrompt[3] = now.ToString("yyyy/MM/dd HH", DateTimeFormatInfo.InvariantInfo); InSnergyGateway.Last_IT_HOUR = num3; InSnergyGateway.Last_TT_HOUR = num4; num = InSnergyGateway.GetPUE(2); num2 = InSnergyGateway.GetPUE(3); num3 = num; if (iTPowerFlag == 1) { double dataCenterPDSum = DBTools.GetDataCenterPDSum(1); num3 = dataCenterPDSum + num; } num4 = num3 + num2; ret_v[4] = num3; ret_v[5] = num4; strTimePrompt[4] = now.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); strTimePrompt[5] = now.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); InSnergyGateway.Last_IT_DAY = num3; InSnergyGateway.Last_TT_DAY = num4; num = InSnergyGateway.GetPUE(4); num2 = InSnergyGateway.GetPUE(5); num3 = num; if (iTPowerFlag == 1) { double dataCenterPDSum = DBTools.GetDataCenterPDSum(2); num3 = dataCenterPDSum + num; } num4 = num3 + num2; ret_v[6] = num3; ret_v[7] = num4; DateTime dateTime = now.AddDays((double)(1 - Convert.ToInt32(now.DayOfWeek.ToString("d")))); if (now.DayOfWeek == DayOfWeek.Sunday) { dateTime = dateTime.AddDays(-7.0); } DateTime dateTime2 = dateTime.AddDays(6.0); strTimePrompt[6] = dateTime.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo) + " -- " + dateTime2.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); strTimePrompt[7] = now.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); InSnergyGateway.Last_IT_WEEK = num3; InSnergyGateway.Last_TT_WEEK = num4; InSnergyGateway.Need_Calculate_PUE = false; DebugCenter.GetInstance().appendToFile("^^^^ Finish to update PUE data " + (DateTime.Now - now2).TotalSeconds + " sec"); } else { ret_v[2] = InSnergyGateway.Last_IT_HOUR; ret_v[3] = InSnergyGateway.Last_TT_HOUR; ret_v[4] = InSnergyGateway.Last_IT_DAY; ret_v[5] = InSnergyGateway.Last_TT_DAY; ret_v[6] = InSnergyGateway.Last_IT_WEEK; ret_v[7] = InSnergyGateway.Last_TT_WEEK; strTimePrompt[2] = now.ToString("yyyy/MM/dd HH", DateTimeFormatInfo.InvariantInfo); strTimePrompt[4] = now.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); DateTime dateTime3 = now.AddDays((double)(1 - Convert.ToInt32(now.DayOfWeek.ToString("d")))); if (now.DayOfWeek == DayOfWeek.Sunday) { dateTime3 = dateTime3.AddDays(-7.0); } DateTime dateTime4 = dateTime3.AddDays(6.0); strTimePrompt[6] = dateTime3.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo) + " -- " + dateTime4.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); strTimePrompt[3] = now.ToString("yyyy/MM/dd HH", DateTimeFormatInfo.InvariantInfo); strTimePrompt[5] = now.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); strTimePrompt[7] = now.ToString("yyyy/MM/dd", DateTimeFormatInfo.InvariantInfo); } } } catch (Exception ex) { string str = CommonAPI.ReportException(0, ex, true, " "); Common.WriteLine("LoadPUEData: " + ex.Message + "\r\n" + str, new string[0]); } }
private void butSaveISGSetting_Click(object sender, System.EventArgs e) { int iSGFlag = Sys_Para.GetISGFlag(); int num = 0; int iSGPort = Sys_Para.GetISGPort(); int num2 = iSGPort; int iTPowerFlag = Sys_Para.GetITPowerFlag(); int num3 = iTPowerFlag; bool flag = false; if (this.cbEnableISGateway.Checked) { num = 1; Ecovalidate.checkTextIsNull(this.tbISGServicePort, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbServicePort.Text })); return; } if (!Ecovalidate.Rangeint(this.tbISGServicePort, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbServicePort.Text, "1", "65535" })); return; } num2 = System.Convert.ToInt32(this.tbISGServicePort.Text); if (iSGPort != num2) { bool flag2 = NetworkShareAccesser.TcpPortInUse(num2); if (flag2) { this.tbISGServicePort.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[] { this.tbISGServicePort.Text })); return; } } if (!this.cbAtenPDU.Checked) { num3 = 0; } else { num3 = 1; } } Sys_Para.SetISGFlag(num); Sys_Para.SetISGPort(num2); Sys_Para.SetITPowerFlag(num3); if (iSGFlag != num || iSGPort != num2) { if (num == 0) { InSnergyService.Restart(false, num2); } else { InSnergyService.Restart(true, num2); } } string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0432000", new string[] { valuePair }); } else { LogAPI.writeEventLog("0432000", new string[0]); } if (iSGFlag != num || iTPowerFlag != num3) { EcoGlobalVar.setDashBoardFlg(32uL, "", 32); } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
private void btnsavePort_Click(object sender, System.EventArgs e) { if (!this.tbManagerPort.Visible) { int num = 0; int num2 = 0; int num3 = 0; if (this.tbTrapPort.Visible) { if (!this.portparacheck(this.lbTrapPort, this.tbTrapPort, 1)) { return; } num = System.Convert.ToInt32(this.tbTrapPort.Text); } if (this.tbBillingPort.Visible) { if (!this.portparacheck(this.lbBillingPort, this.tbBillingPort, 3)) { return; } num2 = System.Convert.ToInt32(this.tbBillingPort.Text); if (num2 == num) { this.tbBillingPort.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[] { this.tbBillingPort.Text })); return; } } if (this.tbGatewayPort.Visible) { if (!this.portparacheck(this.lbGatewayPort, this.tbGatewayPort, 2)) { return; } num3 = System.Convert.ToInt32(this.tbGatewayPort.Text); if (num3 == num || num3 == num2) { this.tbGatewayPort.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[] { this.tbGatewayPort.Text })); return; } } if (this.tbTrapPort.Visible) { new Sys_Para { TrapPort = num }.update(); string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0130022", new string[] { valuePair }); } else { LogAPI.writeEventLog("0130022", new string[0]); } } if (this.tbBillingPort.Visible) { Sys_Para.SetBPPort(num2); InSnergyService.RestartBillingProtocol(Sys_Para.GetBPFlag() == 1, num2, Sys_Para.GetBPSecurity()); } if (this.tbGatewayPort.Visible) { Sys_Para.SetISGPort(num3); if (Sys_Para.GetISGFlag() == 0) { InSnergyService.Restart(false, num3); } else { InSnergyService.Restart(true, num3); } } base.DialogResult = DialogResult.OK; return; } if (!this.portparacheck(this.lbManagerPort, this.tbManagerPort, 0)) { return; } int value = System.Convert.ToInt32(this.tbManagerPort.Text); ValuePairs.setValuePair("ServicePort", System.Convert.ToString(value)); ValuePairs.SaveValueKeyToRegistry(true); base.DialogResult = DialogResult.OK; }
public registrySettings(int SrvStCode) { this.InitializeComponent(); this.m_oldSrvStCode = SrvStCode; this.tbDBIP.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbDBPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbDBUsrnm.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbDBPsw.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbManagerPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbTrapPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbBillingPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tbGatewayPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip; this.tcLoginSettings.Controls.Clear(); if ((SrvStCode & DebugCenter.ST_fatalMask) != 0) { string text = ""; if (SrvStCode == DebugCenter.ST_SevsPortNA) { this.tcLoginSettings.Controls.Add(this.tpPortsetting); this.lbManagerPort.Visible = true; this.tbManagerPort.Visible = true; this.lbTrapPort.Visible = false; this.tbTrapPort.Visible = false; this.lbBillingPort.Visible = false; this.tbBillingPort.Visible = false; this.lbGatewayPort.Visible = false; this.tbGatewayPort.Visible = false; this.tbManagerPort.Text = ValuePairs.getValuePair("ServicePort"); } DBUrl.initconfig(); if (SrvStCode == DebugCenter.ST_MYSQLCONNECT_ERROR) { text = "MySQL database connection failure (error code: " + SrvStCode.ToString("X4") + "). Please check your settings and try again."; } if (SrvStCode == DebugCenter.ST_MYSQLAUTH_ERROR) { text = "MySQL database authentication failure (error code: " + SrvStCode.ToString("X4") + "). Please check your settings and try again."; } if (SrvStCode == DebugCenter.ST_MYSQLNotExist || SrvStCode == DebugCenter.ST_MYSQLSIDNotMatch || SrvStCode == DebugCenter.ST_MYSQLREPAIR_ERROR) { text = "MySQL database fatal error (error code: " + SrvStCode.ToString("X4") + "). Please try either restore database, or use Access (by uncheck \"Use MySQL database\") instead."; } if (text.Length > 0) { this.tcLoginSettings.Controls.Add(this.tpdatabase); this.lbDBMsg.Text = text; this.checkBoxUseMySQL.Checked = true; this.tbDBIP.Text = "127.0.0.1"; this.tbDBPort.Text = DBUrl.CURRENT_PORT.ToString(); this.tbDBUsrnm.Text = DBUrl.CURRENT_USER_NAME; this.tbDBPsw.Text = DBUrl.CURRENT_PWD; } return; } this.tcLoginSettings.Controls.Add(this.tpPortsetting); this.lbManagerPort.Visible = false; this.tbManagerPort.Visible = false; this.m_pSyspara = new Sys_Para(); if ((SrvStCode & DebugCenter.ST_TrapPortNA) != 0) { this.lbTrapPort.Visible = true; this.tbTrapPort.Visible = true; this.tbTrapPort.Text = System.Convert.ToString(this.m_pSyspara.TrapPort); } else { this.lbTrapPort.Visible = false; this.tbTrapPort.Visible = false; } if ((SrvStCode & DebugCenter.ST_BillingPortNA) != 0) { this.lbBillingPort.Visible = true; this.tbBillingPort.Visible = true; this.tbBillingPort.Text = System.Convert.ToString(Sys_Para.GetBPPort()); } else { this.lbBillingPort.Visible = false; this.tbBillingPort.Visible = false; } if ((SrvStCode & DebugCenter.ST_GateWayPortNA) != 0) { this.lbGatewayPort.Visible = true; this.tbGatewayPort.Visible = true; this.tbGatewayPort.Text = System.Convert.ToString(Sys_Para.GetISGPort()); return; } this.lbGatewayPort.Visible = false; this.tbGatewayPort.Visible = false; }
public void pageInit(OtherDevices pParent, TreeNode rootNode) { this.m_pParent = pParent; if (Sys_Para.GetISGFlag() == 0) { this.cbEnableISGateway.Checked = false; this.tbISGServicePort.Enabled = false; this.cbAtenPDU.Enabled = false; } else { this.cbEnableISGateway.Checked = true; this.tbISGServicePort.Enabled = true; this.cbAtenPDU.Enabled = true; } this.tbISGServicePort.Text = System.Convert.ToString(Sys_Para.GetISGPort()); if (Sys_Para.GetITPowerFlag() == 0) { this.cbAtenPDU.Checked = false; } else { this.cbAtenPDU.Checked = true; } this.dgvAllOtherDevices.Rows.Clear(); System.Collections.Generic.List <InSnergyGateway> allGateWay = InSnergyGateway.GetAllGateWay(); foreach (TreeNode treeNode in rootNode.Nodes) { string text = treeNode.Text; string name = treeNode.Name; bool flag = false; InSnergyGateway inSnergyGateway = null; for (int i = 0; i < allGateWay.Count; i++) { inSnergyGateway = allGateWay[i]; if (inSnergyGateway.GatewayID == name) { flag = true; break; } } if (flag) { string gatewayIP = InSnergyService.getGatewayIP(inSnergyGateway.GatewayID); string msg = EcoLanguage.getMsg(LangRes.ISGST_offline, new string[0]); if (InSnergyService.IsGatewayOnline(name)) { msg = EcoLanguage.getMsg(LangRes.ISGST_online, new string[0]); } string[] values = new string[] { text, inSnergyGateway.GatewayType, gatewayIP, msg, inSnergyGateway.GatewayID }; this.dgvAllOtherDevices.Rows.Add(values); } } if (this.dgvAllOtherDevices.Rows.Count == 0) { this.butOthDevicesDel.Enabled = false; this.butOthDeviceSetup.Enabled = false; return; } this.butOthDevicesDel.Enabled = true; this.butOthDeviceSetup.Enabled = true; }
public void pageInit() { System.DateTime dateTime = default(System.DateTime); System.DateTime dateTime2 = default(System.DateTime); string strBegin = ""; string strEnd = ""; dateTime = System.Convert.ToDateTime(this.m_BeginText); dateTime2 = dateTime.AddMonths(this.m_Cboduration); strBegin = dateTime.ToString("yyyy-MM-dd"); strEnd = dateTime2.ToString("yyyy-MM-dd"); this.dataTableRst = new DataTable(); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_GroupName, new string[0]), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_Month, new string[0]), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_AvgAmp, new string[0]), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_Voltage, new string[0]), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_AvgKW, new string[0]), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_KWH, new string[0]), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_Rate, new string[] { EcoGlobalVar.CurCurrency }), typeof(string)); this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_Fee, new string[] { EcoGlobalVar.CurCurrency }), typeof(string)); if (this.m_RptType == 1) { if (Sys_Para.GetBill_ratetype() != 0) { this.m_tableType_index = 1; DataColumn dataColumn = this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_Period, new string[0]), typeof(string)); dataColumn.SetOrdinal(2); } } else { if (this.m_RptType == 2) { if (Sys_Para.GetBill_ratetype() == 0) { this.m_tableType_index = 2; DataColumn dataColumn2 = this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_RackName, new string[0]), typeof(string)); dataColumn2.SetOrdinal(1); } else { this.m_tableType_index = 3; DataColumn dataColumn3 = this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_RackName, new string[0]), typeof(string)); dataColumn3.SetOrdinal(1); dataColumn3 = this.dataTableRst.Columns.Add(EcoLanguage.getMsg(LangRes.BILLTB_Period, new string[0]), typeof(string)); dataColumn3.SetOrdinal(3); } } } for (int i = 0; i < this.m_ret_list.Count; i++) { string[] array = this.m_ret_list[i].ToString().Split(new char[] { '|' }); string text = array[BillingRptShow.AnalysisIndex_devIDs]; string value = array[BillingRptShow.AnalysisIndex_gpID]; long l_gid = System.Convert.ToInt64(value); string text2 = array[BillingRptShow.AnalysisIndex_gpNM]; string text3 = dateTime.ToString("MMM yyyy"); string text4 = array[BillingRptShow.AnalysisIndex_gpTP]; string text5 = array[BillingRptShow.AnalysisIndex_portIDs]; int bill_ratetype = Sys_Para.GetBill_ratetype(); float bill_1rate = Sys_Para.GetBill_1rate(); float bill_2rate = Sys_Para.GetBill_2rate1(); float bill_2rate2 = Sys_Para.GetBill_2rate2(); if (text5.Equals("0")) { text5 = ""; } if (text.Equals("0")) { text = ""; } double num = 0.0; double num2 = 0.0; if (this.m_RptType == 1) { this.filldata(this.dataTableRst, text2, -1L, text3, strBegin, strEnd, text, text5, bill_ratetype, bill_1rate, bill_2rate, bill_2rate2, ref num, ref num2); } else { if (this.m_RptType == 2) { num = 0.0; num2 = 0.0; System.Collections.Generic.Dictionary <long, string> rackDeviceMapByGroupID = DBTools.GetRackDeviceMapByGroupID(l_gid, text4); foreach (System.Collections.Generic.KeyValuePair <long, string> current in rackDeviceMapByGroupID) { text = ""; text5 = ""; if (text4 == "alloutlet" || text4 == "outlet") { text5 = current.Value; } else { text = current.Value; } if (this.filldata(this.dataTableRst, text2, current.Key, text3, strBegin, strEnd, text, text5, bill_ratetype, bill_1rate, bill_2rate, bill_2rate2, ref num, ref num2) > 0) { text2 = ""; } } if (rackDeviceMapByGroupID.Count <= 0) { if (bill_ratetype == 0) { this.dataTableRst.Rows.Add(new object[] { text2, "", text3, "N/A", "N/A", "0", "0", bill_1rate.ToString("F2"), "0" }); } else { this.dataTableRst.Rows.Add(new object[] { text2, "", text3, EcoLanguage.getMsg(LangRes.Rpt_BillPEAK, new string[0]), "N/A", "N/A", "0", "0", bill_2rate.ToString("F2"), "0" }); this.dataTableRst.Rows.Add(new object[] { "", "", text3, EcoLanguage.getMsg(LangRes.Rpt_BillnonPEAK, new string[0]), "N/A", "N/A", "0", "0", bill_2rate2.ToString("F2"), "0" }); } } if (bill_ratetype == 0) { this.dataTableRst.Rows.Add(new object[] { EcoLanguage.getMsg(LangRes.BILLTB_Subtotal, new string[0]), EcoLanguage.getMsg(LangRes.Rpt_BillALL, new string[0]), "", "", "", "", num.ToString("F4"), "", num2.ToString("F2") }); } else { this.dataTableRst.Rows.Add(new object[] { EcoLanguage.getMsg(LangRes.BILLTB_Subtotal, new string[0]), EcoLanguage.getMsg(LangRes.Rpt_BillALL, new string[0]), "", "", "", "", "", num.ToString("F4"), "", num2.ToString("F2") }); } } } } }
private void butSysparaSave_Click(object sender, System.EventArgs e) { if (!this.sysparaCheck()) { return; } int num = System.Convert.ToInt32(this.tbSysTrapPort.Text); if (num != this.m_pSyspara.TrapPort) { bool flag = NetworkShareAccesser.UDPPortInUse(num); if (flag) { this.tbSysTrapPort.Focus(); EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[] { this.tbSysTrapPort.Text })); return; } } this.m_pSyspara.username = this.tbSysUserNm.Text; this.m_pSyspara.timeout = System.Convert.ToInt32(this.tbSysTimeOut.Text); this.m_pSyspara.port = System.Convert.ToInt32(this.tbSysPort.Text); this.m_pSyspara.retry = System.Convert.ToInt32(this.tbSysRetry.Text); int num2 = System.Convert.ToInt32(((Combobox_item)this.cbSnmpV.SelectedItem).getKey()); this.m_pSyspara.SnmpVersion = num2; this.m_pSyspara.authen = "None"; this.m_pSyspara.authenpwd = string.Empty; this.m_pSyspara.privacy = "None"; this.m_pSyspara.privacypwd = string.Empty; if (num2 == 3) { this.m_pSyspara.authen = this.cbSysAuthen.SelectedItem.ToString(); if (!this.m_pSyspara.authen.Equals("None")) { this.m_pSyspara.authenpwd = this.tbSysAuthenPw.Text; this.m_pSyspara.privacy = this.cbSysPrivacy.SelectedItem.ToString(); this.m_pSyspara.privacypwd = this.tbSysPrivacyPw.Text; } } Sys_Para sys_Para = new Sys_Para(); bool flag2 = false; sys_Para.TrapUserName = this.tbSysTrapUserNm.Text; sys_Para.TrapPort = System.Convert.ToInt32(this.tbSysTrapPort.Text); num2 = System.Convert.ToInt32(((Combobox_item)this.cbTrapSnmpV.SelectedItem).getKey()); sys_Para.TrapSnmpVersion = num2; sys_Para.TrapAuthen = "None"; sys_Para.TrapAuthenPwd = string.Empty; sys_Para.TrapPrivacy = "None"; sys_Para.TrapPrivacyPwd = string.Empty; if (num2 == 2) { sys_Para.TrapAuthen = this.cbSysTrapAuthen.SelectedItem.ToString(); if (!sys_Para.TrapAuthen.Equals("None")) { sys_Para.TrapAuthenPwd = this.tbSysTrapAuthenPw.Text; sys_Para.TrapPrivacy = this.cbSysTrapPrivacy.SelectedItem.ToString(); sys_Para.TrapPrivacyPwd = this.tbSysTrapPrivacyPw.Text; } } if (!this.m_pSyspara.TrapUserName.Equals(sys_Para.TrapUserName) || this.m_pSyspara.TrapPort != sys_Para.TrapPort || this.m_pSyspara.TrapSnmpVersion != sys_Para.TrapSnmpVersion || !this.m_pSyspara.TrapAuthen.Equals(sys_Para.TrapAuthen) || !this.m_pSyspara.TrapAuthenPwd.Equals(sys_Para.TrapAuthenPwd) || !this.m_pSyspara.TrapPrivacy.Equals(sys_Para.TrapPrivacy) || !this.m_pSyspara.TrapPrivacyPwd.Equals(sys_Para.TrapPrivacyPwd)) { this.m_pSyspara.TrapUserName = sys_Para.TrapUserName; this.m_pSyspara.TrapPort = sys_Para.TrapPort; this.m_pSyspara.TrapSnmpVersion = sys_Para.TrapSnmpVersion; this.m_pSyspara.TrapAuthen = sys_Para.TrapAuthen; this.m_pSyspara.TrapAuthenPwd = sys_Para.TrapAuthenPwd; this.m_pSyspara.TrapPrivacy = sys_Para.TrapPrivacy; this.m_pSyspara.TrapPrivacyPwd = sys_Para.TrapPrivacyPwd; flag2 = true; } this.m_pSyspara.update(); string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0130022", new string[] { valuePair }); } else { LogAPI.writeEventLog("0130022", new string[0]); } if (flag2) { System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice(); System.Collections.Generic.List <DevSnmpConfig> list = new System.Collections.Generic.List <DevSnmpConfig>(); foreach (DeviceInfo current in allDevice) { if (ClientAPI.IsDeviceOnline(current.DeviceID)) { DevSnmpConfig sNMPpara = commUtil.getSNMPpara(current); list.Add(sNMPpara); } } try { DevMonitorAPI devMonitorAPI = new DevMonitorAPI(); devMonitorAPI.SetTrapReceiver(list, this.m_pSyspara); } catch (System.Exception) { } } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
public void UpdateTrapReceiver(Sys_Para pSys, TrapEnabled open) { if (pSys.TrapPort <= 0 || pSys.TrapPort > 65535) { return; } DebugCenter debug = DebugCenter.GetInstance(); debug.appendToFile("*****=====***** Begin to send trap receiver config to device *****=====*****"); SystemThreadPool <SnmpConfiger, bool> systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, bool>(this.snmpConfigs); systemThreadPool.GetResults(delegate(System.Collections.ICollection coll, object obj) { System.Collections.Generic.List <System.Net.IPAddress> managerLocalIpAddress = this.getManagerLocalIpAddress(); System.Net.IPAddress iPAddress = managerLocalIpAddress[0]; SnmpConfiger snmpConfiger = (SnmpConfiger)obj; SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger); if (snmpConfiger.DevModelConfig.commonThresholdFlag != Constant.EatonPDU_M2 && snmpConfiger.DevModelConfig.commonThresholdFlag != Constant.APC_PDU && !snmpConfiger.SnmpConfig.AgentIp.Equals("127.0.0.1")) { try { if (managerLocalIpAddress.Count > 1) { iPAddress = this.getLocalSameNetworkIP(snmpConfiger.SnmpConfig.AgentIp); if (iPAddress.ToString().Equals("127.0.0.1")) { int deviceHttpPort = snmpExecutor.DeviceHttpPort; if (deviceHttpPort > 0) { iPAddress = this.getLocalConnectibleIP(snmpConfiger.SnmpConfig.AgentIp, deviceHttpPort); if (iPAddress.ToString().Equals("127.0.0.1")) { debug.appendToFile("Failed to get connectiable IP, Device IP: " + snmpConfiger.SnmpConfig.AgentIp); if (iPAddress.ToString().Equals("127.0.0.1")) { iPAddress = managerLocalIpAddress[0]; } } } else { debug.appendToFile(string.Concat(new object[] { "Failed to get device http port: ", deviceHttpPort, ", Device IP: ", snmpConfiger.SnmpConfig.AgentIp })); iPAddress = managerLocalIpAddress[0]; } } } TrapReceiverConfiguration trapReceiverConfig = snmpExecutor.GetTrapReceiverConfig(1); if (trapReceiverConfig != null && (trapReceiverConfig.Enabled != open || trapReceiverConfig.TrapVersion != pSys.TrapSnmpVersion || trapReceiverConfig.TrapPort != pSys.TrapPort || trapReceiverConfig.ReceiverIp.ToString() != iPAddress.ToString())) { snmpExecutor.ConfigTrapReceiver(new TrapReceiverConfiguration(1) { AgentVersion = (int)snmpConfiger.SnmpConfig.Version, Enabled = open, ReceiverIp = iPAddress, TrapPort = pSys.TrapPort, TrapVersion = pSys.TrapSnmpVersion, Community = pSys.TrapUserName, Username = pSys.TrapUserName, AuthPassword = pSys.TrapAuthenPwd, PrivPassword = pSys.TrapPrivacyPwd }); } } catch (System.Exception) { } } }); }
private void butSysparaSave_Click(object sender, System.EventArgs e) { if (!this.sysparaCheck()) { return; } int selectedIndex = this.cbReadDelay.SelectedIndex; int serviceDelay = 60; if (selectedIndex == 0) { serviceDelay = 30; } else { if (selectedIndex == 1) { serviceDelay = 60; } else { if (selectedIndex == 2) { serviceDelay = 180; } else { if (selectedIndex == 3) { serviceDelay = 300; } else { if (selectedIndex == 4) { serviceDelay = 600; } else { if (selectedIndex == 5) { serviceDelay = 900; } } } } } } float cO2KG = -5f; float cO2KG2 = Sys_Para.GetCO2KG(); int temperatureUnit = Sys_Para.GetTemperatureUnit(); string currency = Sys_Para.GetCurrency(); int rackFullNameflag = Sys_Para.GetRackFullNameflag(); bool enablePowerControlFlag = Sys_Para.GetEnablePowerControlFlag(); if (this.txtco2_elec.Text.Length > 0) { cO2KG = System.Convert.ToSingle(this.txtco2_elec.Text); } float eLECTRICITYCOST = -5f; if (this.txtprice_elec.Text.Length > 0) { eLECTRICITYCOST = System.Convert.ToSingle(this.txtprice_elec.Text); } float cO2COST = -5f; if (this.txtprice_co2.Text.Length > 0) { cO2COST = System.Convert.ToSingle(this.txtprice_co2.Text); } if (Sys_Para.SetServiceDelay(serviceDelay) < 0 || Sys_Para.SetCO2KG(cO2KG) < 0 || Sys_Para.SetELECTRICITYCOST(eLECTRICITYCOST) < 0 || Sys_Para.SetCO2COST(cO2COST) < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); EcoGlobalVar.co2kg = Sys_Para.GetCO2KG(); return; } bool flag = false; ulong num = 0uL; int num2 = 0; EcoGlobalVar.co2kg = Sys_Para.GetCO2KG(); if (cO2KG2 != EcoGlobalVar.co2kg) { flag = true; } if (this.rbEC1.Checked) { int energyType = 0; float energyValue = System.Convert.ToSingle(this.tbECVoltage.Text); if (Sys_Para.SetEnergyType(energyType) < 0 || Sys_Para.SetEnergyValue(energyValue) < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } } else { if (this.rbEC2.Checked) { int energyType = 1; int referenceDevice = System.Convert.ToInt32(this.lbECDevNm.Tag.ToString()); if (Sys_Para.SetEnergyType(energyType) < 0 || Sys_Para.SetReferenceDevice(referenceDevice) < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } } else { if (this.rbEC3.Checked) { int energyType = 2; if (Sys_Para.SetEnergyType(energyType) < 0) { EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } } } } if (this.TempUnitC.Checked) { EcoGlobalVar.TempUnit = 0; } else { EcoGlobalVar.TempUnit = 1; } Sys_Para.SetTemperatureUnit(EcoGlobalVar.TempUnit); if (temperatureUnit != EcoGlobalVar.TempUnit) { flag = true; } EcoGlobalVar.CurCurrency = this.cbCurrency.SelectedItem.ToString(); Sys_Para.SetCurrency(EcoGlobalVar.CurCurrency); if (!currency.Equals(EcoGlobalVar.CurCurrency)) { flag = true; } int selectedIndex2 = this.cbDClayout.SelectedIndex; if (selectedIndex2 != EcoGlobalVar.DCLayoutType) { Sys_Para.SetResolution(selectedIndex2); EcoGlobalVar.DCLayoutType = selectedIndex2; num |= 4uL; num2 |= 1; } if (this.cbERackFNm.Checked) { Sys_Para.SetRackFullNameflag(1); if (rackFullNameflag != 1) { flag = true; } } else { Sys_Para.SetRackFullNameflag(0); if (rackFullNameflag != 0) { flag = true; } } Sys_Para.SetEnablePowerControlFlag(this.cbERPower.Checked); if (enablePowerControlFlag != this.cbERPower.Checked) { flag = true; } if (flag) { num |= 32uL; num2 |= 32; } EcoGlobalVar.setDashBoardFlg(num, "", num2); string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0130023", new string[] { valuePair }); } else { LogAPI.writeEventLog("0130023", new string[0]); } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); }
public void SetTrapReceiver(System.Collections.Generic.List <DevSnmpConfig> configs, Sys_Para pSys) { DevAccessCfg instance = DevAccessCfg.GetInstance(); System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>(); foreach (DevSnmpConfig current in configs) { DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer); SnmpConfiger item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID); list.Add(item); } DefaultSnmpExecutors defaultSnmpExecutors = new DefaultSnmpExecutors(list); defaultSnmpExecutors.UpdateTrapReceiver(pSys, TrapEnabled.Yes); }
public void SetTrapReceiver(System.Collections.Generic.List <SnmpConfiger> snmpConfigs, Sys_Para pSys) { DefaultSnmpExecutors defaultSnmpExecutors = new DefaultSnmpExecutors(snmpConfigs); defaultSnmpExecutors.UpdateTrapReceiver(pSys, TrapEnabled.Yes); }
public void pageInit(int devID, bool onlinest) { this.butSave.Enabled = onlinest; DeviceInfo deviceByID = DeviceOperation.getDeviceByID(devID); this.labDevNm.Text = deviceByID.DeviceName; this.labDevModel.Text = deviceByID.ModelNm; this.labDevModel.Tag = devID.ToString(); string text = deviceByID.ModelNm; if (DevAccessCfg.GetInstance().isAutodectDev(deviceByID.ModelNm, deviceByID.FWVersion)) { text = text + " (F/W: " + deviceByID.FWVersion + ")"; } this.toolTip1.SetToolTip(this.labDevModel, text); this.labDevIp.Text = deviceByID.DeviceIP; this.labDevIp.Tag = deviceByID.FWVersion; this.labDevNm.Text = deviceByID.DeviceName; RackInfo rackByID = RackInfo.getRackByID(deviceByID.RackID); this.labDevRackNm.Text = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion); if (deviceByID.ModelNm.Equals("EC1000")) { this.lbRefVoltage.Visible = true; this.tbRefVoltage.Visible = true; this.lbRefVoltageUnit.Visible = true; if (DevAccessCfg.GetInstance().isAutodectDev(deviceByID.ModelNm, deviceByID.FWVersion)) { this.tbRefVoltage.Enabled = true; if (deviceByID.ReferenceVoltage == -500f || deviceByID.ReferenceVoltage == -300f) { this.tbRefVoltage.Text = ""; } else { this.tbRefVoltage.Text = System.Convert.ToString(deviceByID.ReferenceVoltage); } } else { this.tbRefVoltage.Enabled = false; this.tbRefVoltage.Text = System.Convert.ToString(Sys_Para.GetEnergyValue()); } } else { this.lbRefVoltage.Visible = false; this.tbRefVoltage.Visible = false; this.lbRefVoltageUnit.Visible = false; } int num = devcfgUtil.UIThresholdEditFlg(deviceModelConfig, "dev"); ThresholdUtil.SetUIEdit(this.tbMinVoltage, (num & 4) == 0, deviceByID.Min_voltage, 0, "F1"); ThresholdUtil.SetUIEdit(this.tbMaxVoltage, (num & 8) == 0, deviceByID.Max_voltage, 0, "F1"); this.labMaxVoltageBound.Text = ((!this.tbMinVoltage.ReadOnly || !this.tbMaxVoltage.ReadOnly) ? devcfgUtil.RangeVoltage(deviceModelConfig, "dev", 0) : ""); if (deviceModelConfig.commonThresholdFlag == Constant.APC_PDU) { ThresholdUtil.SetUIEdit(this.tbMinCurrent, (num & 1) == 0, deviceByID.Min_current, 0, "F0"); ThresholdUtil.SetUIEdit(this.tbMaxCurrent, (num & 2) == 0, deviceByID.Max_current, 0, "F0"); this.labMaxCurrentBound.Text = ((!this.tbMinCurrent.ReadOnly || !this.tbMaxCurrent.ReadOnly) ? devcfgUtil.RangeCurrent(deviceModelConfig, "dev", 0, "F0") : ""); this.lbunitPower.Text = "kW"; ThresholdUtil.SetUIEdit(this.tbMinPower, (num & 16) == 0, deviceByID.Min_power / 1000f, 0, "F1"); ThresholdUtil.SetUIEdit(this.tbMaxPower, (num & 32) == 0, deviceByID.Max_power / 1000f, 0, "F1"); this.labMaxPowerBound.Text = ((!this.tbMinPower.ReadOnly || !this.tbMaxPower.ReadOnly) ? devcfgUtil.RangePower(deviceModelConfig, "dev", 0, 1000.0) : ""); } else { ThresholdUtil.SetUIEdit(this.tbMinCurrent, (num & 1) == 0, deviceByID.Min_current, 0, "F1"); ThresholdUtil.SetUIEdit(this.tbMaxCurrent, (num & 2) == 0, deviceByID.Max_current, 0, "F1"); this.labMaxCurrentBound.Text = ((!this.tbMinCurrent.ReadOnly || !this.tbMaxCurrent.ReadOnly) ? devcfgUtil.RangeCurrent(deviceModelConfig, "dev", 0, "F1") : ""); this.lbunitPower.Text = "W"; ThresholdUtil.SetUIEdit(this.tbMinPower, (num & 16) == 0, deviceByID.Min_power, 0, "F1"); ThresholdUtil.SetUIEdit(this.tbMaxPower, (num & 32) == 0, deviceByID.Max_power, 0, "F1"); this.labMaxPowerBound.Text = ((!this.tbMinPower.ReadOnly || !this.tbMaxPower.ReadOnly) ? devcfgUtil.RangePower(deviceModelConfig, "dev", 0, 1.0) : ""); } ThresholdUtil.SetUIEdit(this.tbMinPowerDiss, (num & 64) == 0, deviceByID.Min_power_diss, 0, "F1"); ThresholdUtil.SetUIEdit(this.tbMaxPowerDiss, (num & 128) == 0, deviceByID.Max_power_diss, 0, "F1"); this.labMaxPowerDisBound.Text = ((!this.tbMinPowerDiss.ReadOnly || !this.tbMaxPowerDiss.ReadOnly) ? devcfgUtil.RangePowerDiss(deviceModelConfig, "dev", 0) : ""); if (deviceModelConfig.doorReading != 2) { this.gbDoorSS.Hide(); return; } this.gbDoorSS.Show(); switch (deviceByID.DoorSensor) { case 0: this.rbNoInstall_0.Checked = true; return; case 1: this.rbPhoto_1.Checked = true; return; case 2: this.rbInductive_2.Checked = true; return; case 3: this.rbReed_3.Checked = true; return; default: return; } }
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])); }
public void pageInit() { int serviceDelay = Sys_Para.GetServiceDelay(); if (serviceDelay == 30) { this.cbReadDelay.SelectedIndex = 0; } else { if (serviceDelay == 60) { this.cbReadDelay.SelectedIndex = 1; } else { if (serviceDelay == 180) { this.cbReadDelay.SelectedIndex = 2; } else { if (serviceDelay == 300) { this.cbReadDelay.SelectedIndex = 3; } else { if (serviceDelay == 600) { this.cbReadDelay.SelectedIndex = 4; } else { if (serviceDelay == 900) { this.cbReadDelay.SelectedIndex = 5; } else { this.cbReadDelay.SelectedIndex = 1; } } } } } } this.cbDClayout.SelectedIndex = Sys_Para.GetResolution(); EcoGlobalVar.TempUnit = Sys_Para.GetTemperatureUnit(); EcoGlobalVar.CurCurrency = Sys_Para.GetCurrency(); EcoGlobalVar.co2kg = Sys_Para.GetCO2KG(); switch (Sys_Para.GetEnergyType()) { case 0: this.rbEC1.Checked = true; this.tbECVoltage.Text = Sys_Para.GetEnergyValue().ToString("F0"); this.lbECDevNm.Text = "N/A"; this.lbECDevNm.Tag = -1; break; case 1: { this.rbEC2.Checked = true; int referenceDevice = Sys_Para.GetReferenceDevice(); DeviceInfo deviceByID = DeviceOperation.getDeviceByID(referenceDevice); if (deviceByID == null) { this.lbECDevNm.Text = "N/A"; this.lbECDevNm.Tag = -1; } else { this.lbECDevNm.Text = deviceByID.DeviceName + " (IP:" + deviceByID.DeviceIP + ")"; this.lbECDevNm.Tag = deviceByID.DeviceID; } break; } case 2: this.rbEC3.Checked = true; this.lbECDevNm.Text = "N/A"; this.lbECDevNm.Tag = -1; break; } float cO2KG = Sys_Para.GetCO2KG(); if (cO2KG < 0f) { this.txtco2_elec.Text = ""; } else { this.txtco2_elec.Text = cO2KG.ToString("F2"); } float eLECTRICITYCOST = Sys_Para.GetELECTRICITYCOST(); if (eLECTRICITYCOST < 0f) { this.txtprice_elec.Text = ""; } else { this.txtprice_elec.Text = eLECTRICITYCOST.ToString("F2"); } float cO2COST = Sys_Para.GetCO2COST(); if (eLECTRICITYCOST < 0f) { this.txtprice_co2.Text = ""; } else { this.txtprice_co2.Text = cO2COST.ToString("F2"); } if (EcoGlobalVar.TempUnit == 0) { this.TempUnitC.Checked = true; } else { this.TempUnitF.Checked = true; } this.cbCurrency.SelectedItem = EcoGlobalVar.CurCurrency; this.lbElec_unit.Text = EcoGlobalVar.CurCurrency + this.m_ElecUnit; this.lbCO2_unit.Text = EcoGlobalVar.CurCurrency + this.m_CO2Unit; if (Sys_Para.GetRackFullNameflag() == 1) { this.cbERackFNm.Checked = true; } else { this.cbERackFNm.Checked = false; } this.cbERPower.Checked = Sys_Para.GetEnablePowerControlFlag(); }