private int boardDataInit() { bool flag = false; switch (this.FreshFlg_DashBoard) { case 1: commUtil.ShowInfo_DEBUG("boardDataInit ---FLGAppAct_DrawRack Begin " + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff")); if (!EcoGlobalVar.gl_isProcessThreadRuning()) { EcoGlobalVar.gl_StartProcessfThread(false); flag = true; } this.devManDCFloorGrid1.Hide(); this.devRackInfo = this.devManDCFloorGrid1.getRackCtrl(); this.devRackInfo.SuspendLayout(); this.m_allRacks = ClientAPI.getRackInfo(); foreach (RackInfo rackInfo in this.m_allRacks) { int startPoint_X = rackInfo.StartPoint_X; int startPoint_Y = rackInfo.StartPoint_Y; int endPoint_X = rackInfo.EndPoint_X; int arg_BE_0 = rackInfo.EndPoint_Y; int num; if (startPoint_X == endPoint_X) { num = 0; } else { num = 1; } Label label = new Label(); label.Tag = rackInfo.RackID; label.ForeColor = Color.Silver; label.BackColor = Color.Silver; label.BorderStyle = BorderStyle.FixedSingle; label.Dock = DockStyle.Fill; label.Margin = new Padding(0); label.MouseHover += new System.EventHandler(this.Rack_MouseHover); label.MouseLeave += new System.EventHandler(this.Rack_MouseLeave); this.devRackInfo.Controls.Add(label, startPoint_Y, startPoint_X); if (num == 0) { this.devRackInfo.SetColumnSpan(label, 2); this.devRackInfo.SetRowSpan(label, 1); } else { if (num == 1) { this.devRackInfo.SetColumnSpan(label, 1); this.devRackInfo.SetRowSpan(label, 2); } } } this.devRackInfo.ResumeLayout(); commUtil.ShowInfo_DEBUG("boardDataInit ---FLGAppAct_DrawRack End " + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff")); this.m_TitleData_Info = ClientAPI.getDataSet(0); this.FreshFlg_DashBoard = -1; this.devManDCFloorGrid1.Show(); if (flag) { EcoGlobalVar.gl_StopProcessfThread(); } return(0); case 2: commUtil.ShowInfo_DEBUG("boardDataInit ---FLGAppAct_modifydata Begin " + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff")); this.m_allRacks = ClientAPI.getRackInfo(); this.m_TitleData_Info = ClientAPI.getDataSet(0); this.FreshFlg_DashBoard = -1; commUtil.ShowInfo_DEBUG("boardDataInit ---FLGAppAct_modifydata End " + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff")); return(0); default: return(1); } }
private void comm_butClick(object sender, System.EventArgs e) { string name = ((Button)sender).Name; this.enegManPage1.Visible = false; this.userManPage1.Visible = false; this.devManPage1.Visible = false; this.sysManPage1.Visible = false; this.logPage1.Visible = false; if (name.Equals(this.butOutletAccess.Name)) { EcoGlobalVar.stopalltimer(false); this.enegManPage1.Visible = true; this.CurSelMainTab = 0; this.butOutletAccess.Image = Resources.t_outletaccess_over; this.butUser.Image = Resources.t_usermanage; this.butDevice.Image = Resources.t_devicemanage; this.butSysManagement.Image = Resources.t_maintenance; this.butLog.Image = Resources.t_log; } else { if (name.Equals(this.butUser.Name)) { EcoGlobalVar.stopalltimer(false); this.userManPage1.Visible = true; this.CurSelMainTab = 1; this.butOutletAccess.Image = Resources.t_outletaccess; this.butUser.Image = Resources.t_usermanage_over; this.butDevice.Image = Resources.t_devicemanage; this.butSysManagement.Image = Resources.t_maintenance; this.butLog.Image = Resources.t_log; } else { if (name.Equals(this.butDevice.Name)) { EcoGlobalVar.stopalltimer(false); this.devManPage1.Visible = true; this.CurSelMainTab = 2; this.butOutletAccess.Image = Resources.t_outletaccess; this.butUser.Image = Resources.t_usermanage; this.butDevice.Image = Resources.t_devicemanage_over; this.butSysManagement.Image = Resources.t_maintenance; this.butLog.Image = Resources.t_log; } else { if (name.Equals(this.butSysManagement.Name)) { EcoGlobalVar.stopalltimer(false); this.sysManPage1.Visible = true; this.CurSelMainTab = 3; this.butOutletAccess.Image = Resources.t_outletaccess; this.butUser.Image = Resources.t_usermanage; this.butDevice.Image = Resources.t_devicemanage; this.butSysManagement.Image = Resources.t_maintenance_over; this.butLog.Image = Resources.t_log; } else { if (name.Equals(this.butLog.Name)) { EcoGlobalVar.stopalltimer(false); this.logPage1.Visible = true; this.CurSelMainTab = 4; this.butOutletAccess.Image = Resources.t_outletaccess; this.butUser.Image = Resources.t_usermanage; this.butDevice.Image = Resources.t_devicemanage; this.butSysManagement.Image = Resources.t_maintenance; this.butLog.Image = Resources.t_log_over; } } } } } this.pblogout.BringToFront(); if (EcoGlobalVar.gl_LoginUser.UserType != 1) { this.pbmonitor.BringToFront(); } else { this.pbmonitor.Visible = false; this.pbIdleTm.Location = this.pbmonitor.Location; } this.pbIdleTm.BringToFront(); this.butOutletAccess.ForeColor = Color.FromArgb(0, 168, 150); this.butUser.ForeColor = Color.FromArgb(0, 168, 150); this.butDevice.ForeColor = Color.FromArgb(0, 168, 150); this.butSysManagement.ForeColor = Color.FromArgb(0, 168, 150); this.butLog.ForeColor = Color.FromArgb(0, 168, 150); ((Button)sender).ForeColor = Color.FromArgb(211, 211, 212); }
private void butUserSave_Click(object sender, System.EventArgs e) { if (!this.userCheck()) { return; } string userName = this.m_CurUser.UserName; string text = this.tbUserNmEdit.Text; string text2 = this.tbUserPwEdit.Text; int num = 0; int num2; if (this.rbRole1.Checked) { num2 = 1; if (this.cbLog.Checked) { num |= 8; } } else { num2 = 0; if (this.cbUManagement.Checked) { num |= 1; } if (this.cbDManagement.Checked) { num |= 2; } if (this.cbSManagement.Checked) { num |= 4; } if (this.cbLog.Checked) { num |= 8; } } bool flag = false; bool flag2 = false; if (!this.m_CurUser.UserName.Equals(text) || !this.m_CurUser.UserPwd.Equals(text2) || this.m_CurUser.UserType != num2 || this.m_CurUser.UserRight != num) { flag = true; } if (!this.m_CurUser.UserDevice.Equals(this.m_deviceIds) || !this.m_CurUser.UserGroup.Equals(this.m_groupIds)) { flag2 = true; } if (!flag && !flag2) { return; } this.m_CurUser.UserName = text; this.m_CurUser.UserPwd = text2; this.m_CurUser.UserType = num2; this.m_CurUser.UserRight = num; this.m_CurUser.UserDevice = this.m_deviceIds; this.m_CurUser.UserGroup = this.m_groupIds; switch (this.m_CurUser.UpdateUser()) { case -2: EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.UsrInfo_dup, new string[] { text })); return; case -1: EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; case 0: break; case 1: { if (flag) { EcoGlobalVar.setDashBoardFlg(8192uL, "USER:"******"", 0); } } string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0330002", new string[] { text, valuePair }); } else { LogAPI.writeEventLog("0330002", new string[] { text }); } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); if (!userName.Equals(text)) { this.changeTreeSelect(text); } break; } default: return; } }
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])); }
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])); }