private void initPage(long rackID) { RackInfo rackByID = RackInfo.getRackByID(rackID); if (rackByID == null) { return; } int num = rackByID.StartPoint_X + 1; int num2 = rackByID.StartPoint_Y + 1; int num3 = rackByID.EndPoint_X + 1; int num4 = 0; if (num != num3) { num4 = 1; } this.tbRackNm.Text = rackByID.OriginalName; this.tbRackFNm.Text = rackByID.RackFullName; this.tbRow.Text = num.ToString(); this.tbColumn.Text = num2.ToString(); if (num4 == 0) { this.rbH.Checked = true; return; } this.rbV.Checked = true; }
private void tvUserDeviceInit() { this.dgvAllDevices.Rows.Clear(); string[] source = this.m_deviceIds.Split(new char[] { ',' }); System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice(); for (int i = 0; i < allDevice.Count; i++) { DeviceInfo deviceInfo = allDevice[i]; string deviceIP = deviceInfo.DeviceIP; string mac = deviceInfo.Mac; string deviceName = deviceInfo.DeviceName; string modelNm = deviceInfo.ModelNm; RackInfo rackByID = RackInfo.getRackByID(deviceInfo.RackID); string displayRackName = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); string text = deviceInfo.DeviceID.ToString(); if (source.Contains(text)) { this.dgvAllDevices.Rows.Add(new object[] { true, deviceName, mac, deviceIP, modelNm, displayRackName, text }); } else { this.dgvAllDevices.Rows.Add(new object[] { false, deviceName, mac, deviceIP, modelNm, displayRackName, text }); } } }
private void FillList() { this.dgvGpmember.DataSource = null; DataTable dataTable = new DataTable(); dataTable.Columns.Add("objID", typeof(string)); switch (this.cboType.SelectedIndex) { case 0: { dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string)); System.Collections.ArrayList allZone = ZoneInfo.getAllZone(); System.Collections.IEnumerator enumerator = allZone.GetEnumerator(); try { while (enumerator.MoveNext()) { ZoneInfo zoneInfo = (ZoneInfo)enumerator.Current; string text = zoneInfo.ZoneID.ToString(); string[] values = new string[] { text, zoneInfo.ZoneName }; dataTable.Rows.Add(values); } goto IL_46A; } finally { System.IDisposable disposable = enumerator as System.IDisposable; if (disposable != null) { disposable.Dispose(); } } break; } case 1: break; case 2: goto IL_285; case 3: goto IL_36E; default: goto IL_46A; } dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string)); dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string)); System.Collections.ArrayList allZone2 = ZoneInfo.getAllZone(); System.Collections.ArrayList allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty(); System.Collections.IEnumerator enumerator2 = allRack_NoEmpty.GetEnumerator(); try { while (enumerator2.MoveNext()) { RackInfo rackInfo = (RackInfo)enumerator2.Current; string displayRackName = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); string text2 = rackInfo.RackID.ToString(); bool flag = false; string text3 = ""; foreach (ZoneInfo zoneInfo2 in allZone2) { text3 = zoneInfo2.ZoneName; string[] source = zoneInfo2.RackInfo.Split(new char[] { ',' }); if (source.Contains(text2)) { flag = true; break; } } string[] values; if (flag) { values = new string[] { text2, displayRackName, text3 }; } else { values = new string[] { text2, displayRackName, "" }; } dataTable.Rows.Add(values); } goto IL_46A; } finally { System.IDisposable disposable3 = enumerator2 as System.IDisposable; if (disposable3 != null) { disposable3.Dispose(); } } IL_285: dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string)); dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string)); System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice(); using (System.Collections.Generic.List <DeviceInfo> .Enumerator enumerator4 = allDevice.GetEnumerator()) { while (enumerator4.MoveNext()) { DeviceInfo current = enumerator4.Current; string deviceName = current.DeviceName; string text4 = current.DeviceID.ToString(); RackInfo rackByID = RackInfo.getRackByID(current.RackID); string displayRackName2 = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); string[] values = new string[] { text4, deviceName, displayRackName2 }; dataTable.Rows.Add(values); } goto IL_46A; } IL_36E: dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMOutlet, new string[0]), typeof(string)); dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string)); allDevice = DeviceOperation.GetAllDevice(); foreach (DeviceInfo current2 in allDevice) { System.Collections.Generic.List <PortInfo> portInfo = current2.GetPortInfo(); foreach (PortInfo current3 in portInfo) { string[] values = new string[] { current3.ID.ToString(), current3.PortName, current2.DeviceName }; dataTable.Rows.Add(values); } } IL_46A: this.dgvGpmember.DataSource = dataTable; this.dgvGpmember.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; this.dgvGpmember.Columns[0].Visible = false; int selectedIndex = this.cboType.SelectedIndex; if (selectedIndex == 0) { this.dgvGpmember.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; return; } this.dgvGpmember.Columns[1].Width = 140; this.dgvGpmember.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
public bool modifyRack(long rackId, int column, int row, string direction, string rackOrigNm, string rackFuNm) { RackInfo rackByID = RackInfo.getRackByID(rackId); if (rackByID == null) { return(true); } if (!this.checkMove(direction, row, column, rackId)) { return(false); } string devIDs = this.delRackUi(rackId); int num; int num2; if (direction.Equals("H")) { num = row; num2 = column + 1; } else { num = row + 1; num2 = column; } bool flag = false; bool flag2 = false; if (!rackByID.OriginalName.Equals(rackOrigNm) || !rackByID.RackFullName.Equals(rackFuNm)) { flag = true; } if (rackByID.StartPoint_X != row || rackByID.StartPoint_Y != column || rackByID.EndPoint_X != num || rackByID.EndPoint_Y != num2) { flag2 = true; } rackByID.OriginalName = rackOrigNm; rackByID.RackFullName = rackFuNm; rackByID.StartPoint_X = row; rackByID.StartPoint_Y = column; rackByID.EndPoint_X = num; rackByID.EndPoint_Y = num2; rackByID.UpdateRack(); this.addRackUI(column, row, direction, rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag), devIDs, rackId); string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0430012", new string[] { rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag), valuePair }); } else { LogAPI.writeEventLog("0430012", new string[] { rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag) }); } bool flag3 = false; if (flag2) { flag3 = commDev.updateZoneforRack(rackByID); } EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1; ulong num3 = 4uL; int num4 = 0; if (flag3) { num3 |= 264uL; num4 |= 64; } if (flag2) { EcoGlobalVar.setDashBoardFlg(num3, "", num4 | 1); } else { if (flag) { EcoGlobalVar.setDashBoardFlg(num3, "", num4); } } this.initRackList(); this.lbRack.SelectedItem = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); return(true); }
private void pageInit() { this.dgvAllDevices.Rows.Clear(); System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice(); int num = -1; DataSet dataSet = ClientAPI.getDataSet(0); int num2 = 0; int num3 = 0; int num4 = 0; for (int i = 0; i < allDevice.Count; i++) { DeviceInfo deviceInfo = allDevice[i]; string deviceName = deviceInfo.DeviceName; if (!deviceInfo.ModelNm.Equals("EC1000") && !deviceInfo.ModelNm.Equals("EC2004")) { num4++; DataRow[] array; if (dataSet == null) { array = null; } else { array = dataSet.Tables[0].Select("device_id = " + System.Convert.ToString(deviceInfo.DeviceID)); } string text = ""; if (ClientAPI.IsDeviceOnline(deviceInfo.DeviceID)) { num3++; try { text = System.Convert.ToSingle(array[0]["voltage_value"]).ToString("F2"); goto IL_FE; } catch { goto IL_FE; } } if (this.rbonlinedev.Checked) { goto IL_19E; } IL_FE: RackInfo rackByID = RackInfo.getRackByID(deviceInfo.RackID); string[] values = new string[] { deviceName, deviceInfo.Mac, deviceInfo.DeviceIP, deviceInfo.Port.ToString(), deviceInfo.ModelNm, text, rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag), deviceInfo.DeviceID.ToString() }; this.dgvAllDevices.Rows.Add(values); if (deviceInfo.DeviceID == this.m_devID) { num = num2; } num2++; } IL_19E :; } this.rbonlinedev.Text = this.stronlineDevText + " (" + num3.ToString() + ")"; this.rballev.Text = this.strallDevText + " (" + num4.ToString() + ")"; if (num >= 0) { this.dgvAllDevices.CurrentCell = this.dgvAllDevices.Rows[num].Cells[0]; } }
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 (deviceModelConfig.popReading != 2) { this.gbPop.Hide(); this.gbPop2.Hide(); this.gbPOPBankPriority.Hide(); return; } if (deviceModelConfig.popNewRule == Constant.YES) { this.gbPop.Hide(); this.gbPop2.Show(); if (deviceModelConfig.perportreading == Constant.NO) { this.pop2_cbOutlet.Hide(); this.pop2_cbBankLIFO.Hide(); } else { this.pop2_cbOutlet.Show(); this.pop2_cbBankLIFO.Show(); } if (deviceByID.OutletPOPMode == 1) { this.pop2_cbOutlet.Checked = false; } else { this.pop2_cbOutlet.Checked = true; } if (deviceByID.BankPOPLIFOMode == 1) { this.pop2_cbBankLIFO.Checked = false; } else { this.pop2_cbBankLIFO.Checked = true; } if (deviceByID.BankPOPPriorityMode == 1) { this.pop2_cbBankPriority.Checked = false; } else { this.pop2_cbBankPriority.Checked = true; } if (deviceModelConfig.popPrioritySupport == Constant.NO) { this.gbPOPBankPriority.Hide(); return; } this.gbPOPBankPriority.Show(); string[] array = deviceByID.Bank_Priority.Split(new char[] { '#' }); string[] array2 = array[0].Split(new char[] { ',' }); string[] array3 = null; if (array.Length >= 2) { array3 = array[1].Split(new char[] { ',' }); } this.dgvBank1_PList.Rows.Clear(); DataGridViewComboBoxColumn dataGridViewComboBoxColumn = (DataGridViewComboBoxColumn)this.dgvBank1_PList.Columns[1]; this.m_Bank1_Priority_ComboStrings = new System.Collections.Generic.List <string>(); dataGridViewComboBoxColumn.Items.Clear(); dataGridViewComboBoxColumn.Items.Add("N/A"); this.m_Bank1_Priority_ComboStrings.Add("N/A"); int num; int num2; if (deviceModelConfig.bankNum == 0) { num = 1; num2 = deviceModelConfig.portNum; } else { num = deviceModelConfig.bankOutlets[0].fromPort; num2 = deviceModelConfig.bankOutlets[0].toPort; } for (int i = num; i <= num2; i++) { if (deviceModelConfig.isOutletSwitchable(i - 1)) { dataGridViewComboBoxColumn.Items.Add("Outlet " + i.ToString()); this.m_Bank1_Priority_ComboStrings.Add("Outlet " + i.ToString()); } } int num3 = 0; for (int j = num; j <= num2; j++) { if (deviceModelConfig.isOutletSwitchable(j - 1)) { if (array2[num3].Equals("0")) { this.dgvBank1_PList.Rows.Add(new object[] { "Priority" + (num3 + 1).ToString(), "N/A" }); } else { string text2 = "Outlet " + System.Convert.ToInt16(array2[num3]).ToString(); if (this.m_Bank1_Priority_ComboStrings.Contains(text2)) { this.dgvBank1_PList.Rows.Add(new object[] { "Priority" + (num3 + 1).ToString(), text2 }); } else { this.dgvBank1_PList.Rows.Add(new object[] { "Priority" + (num3 + 1).ToString(), "N/A" }); } } num3++; } } if (deviceModelConfig.bankNum >= 2) { this.lbbank2.Visible = true; this.dgvBank2_PList.Visible = true; this.dgvBank2_PList.Rows.Clear(); dataGridViewComboBoxColumn = (DataGridViewComboBoxColumn)this.dgvBank2_PList.Columns[1]; this.m_Bank2_Priority_ComboStrings = new System.Collections.Generic.List <string>(); dataGridViewComboBoxColumn.Items.Clear(); dataGridViewComboBoxColumn.Items.Add("N/A"); this.m_Bank2_Priority_ComboStrings.Add("N/A"); for (int k = deviceModelConfig.bankOutlets[1].fromPort; k <= deviceModelConfig.bankOutlets[1].toPort; k++) { if (deviceModelConfig.isOutletSwitchable(k - 1)) { dataGridViewComboBoxColumn.Items.Add("Outlet " + k.ToString()); this.m_Bank2_Priority_ComboStrings.Add("Outlet " + k.ToString()); } } num3 = 0; for (int l = deviceModelConfig.bankOutlets[1].fromPort; l <= deviceModelConfig.bankOutlets[1].toPort; l++) { if (deviceModelConfig.isOutletSwitchable(l - 1)) { if (array3[num3].Equals("0")) { this.dgvBank2_PList.Rows.Add(new object[] { "Priority" + (num3 + 1).ToString(), "N/A" }); } else { string text2 = "Outlet " + System.Convert.ToInt16(array3[num3]).ToString(); if (this.m_Bank2_Priority_ComboStrings.Contains(text2)) { this.dgvBank2_PList.Rows.Add(new object[] { "Priority" + (num3 + 1).ToString(), text2 }); } else { this.dgvBank2_PList.Rows.Add(new object[] { "Priority" + (num3 + 1).ToString(), "N/A" }); } } num3++; } } return; } this.lbbank2.Visible = false; this.dgvBank2_PList.Visible = false; return; } else { if (deviceByID.POPThreshold == -500f) { this.gbPop.Hide(); this.gbPop2.Hide(); this.gbPOPBankPriority.Hide(); return; } this.gbPop.Show(); this.gbPop2.Hide(); this.gbPOPBankPriority.Hide(); this.rbPopMaxBankC.Text = this.PopMaxBank_txt + " " + deviceModelConfig.popDefault.ToString("F1") + "A"; if (deviceByID.POPEnableMode == 1) { this.cbPopEnable.Checked = false; this.rbPopMaxBankC.Checked = true; this.tbPopThreshold.Text = ""; this.cbPopEnable_CheckedChanged(this.cbPopEnable, null); return; } if (deviceByID.POPThreshold < 0f) { this.cbPopEnable.Checked = true; this.rbPopMaxBankC.Checked = true; this.tbPopThreshold.Text = ""; return; } this.cbPopEnable.Checked = true; this.rbPopUsrdef.Checked = true; this.tbPopThreshold.Text = deviceByID.POPThreshold.ToString("F1"); return; } }
public void pageInit(int devID, int bankID, bool onlinest) { this.butBankAssign.Enabled = onlinest; this.butBankSave.Enabled = onlinest; DeviceInfo deviceByID = DeviceOperation.getDeviceByID(devID); this.labDevIp.Text = deviceByID.DeviceIP; this.labDevIp.Tag = deviceByID.FWVersion; this.labDevModel.Text = deviceByID.ModelNm; this.labDevModel.Tag = devID.ToString(); this.labDevNm.Text = deviceByID.DeviceName; string text = deviceByID.ModelNm; if (DevAccessCfg.GetInstance().isAutodectDev(deviceByID.ModelNm, deviceByID.FWVersion)) { text = text + " (F/W: " + deviceByID.FWVersion + ")"; } this.toolTip1.SetToolTip(this.labDevModel, text); RackInfo rackByID = RackInfo.getRackByID(deviceByID.RackID); this.labDevRackNm.Text = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion); this.butBank1.Visible = false; this.butBank2.Visible = false; this.butBank3.Visible = false; this.butBank4.Visible = false; this.butBank5.Visible = false; this.butBank6.Visible = false; this.butBank7.Visible = false; this.butBank8.Visible = false; System.Collections.Generic.List <BankInfo> bankInfo = deviceByID.GetBankInfo(); foreach (BankInfo current in bankInfo) { string portLists = current.PortLists; switch (System.Convert.ToInt32(portLists)) { case 1: this.butBank1.Visible = true; this.butBank1.Tag = current.ID.ToString(); break; case 2: this.butBank2.Visible = true; this.butBank2.Tag = current.ID.ToString(); break; case 3: this.butBank3.Visible = true; this.butBank3.Tag = current.ID.ToString(); break; case 4: this.butBank4.Visible = true; this.butBank4.Tag = current.ID.ToString(); break; case 5: this.butBank5.Visible = true; this.butBank5.Tag = current.ID.ToString(); break; case 6: this.butBank6.Visible = true; this.butBank6.Tag = current.ID.ToString(); break; case 7: this.butBank7.Visible = true; this.butBank7.Tag = current.ID.ToString(); break; case 8: this.butBank8.Visible = true; this.butBank8.Tag = current.ID.ToString(); break; } } this.bankConfigPageControlInit(deviceModelConfig); if (bankID == 0) { this.setBankConfigData(deviceByID, System.Convert.ToInt32(this.butBank1.Tag)); return; } this.setBankConfigData(deviceByID, bankID); }
private void init_Avail_data() { System.Collections.Generic.Dictionary <long, string> dictionary = new System.Collections.Generic.Dictionary <long, string>(); if (this.m_groupID >= 0L) { GroupInfo groupByID = GroupInfo.GetGroupByID(this.m_groupID); string memberList = groupByID.GetMemberList(); if (memberList != null && memberList.Length > 0) { string[] array = memberList.Split(new string[] { "," }, System.StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string value = array2[i]; long key = (long)System.Convert.ToInt32(value); dictionary.Add(key, ""); } } } this.dgvAvail.DataSource = null; this.Avail_tb = new DataTable(); this.Avail_tb.Columns.Add("objID", typeof(string)); this.Avail_tb.PrimaryKey = new DataColumn[] { this.Avail_tb.Columns[0] }; string groupType; if ((groupType = this.m_groupType) != null) { if (cct == null) { cct = new System.Collections.Generic.Dictionary <string, int>(7) { { "zone", 0 }, { "rack", 1 }, { "allrack", 2 }, { "dev", 3 }, { "alldev", 4 }, { "outlet", 5 }, { "alloutlet", 6 } }; } int num; if (cct.TryGetValue(groupType, out num)) { switch (num) { case 0: { this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string)); System.Collections.ArrayList allZone = ZoneInfo.getAllZone(); System.Collections.IEnumerator enumerator = allZone.GetEnumerator(); try { while (enumerator.MoveNext()) { ZoneInfo zoneInfo = (ZoneInfo)enumerator.Current; string text = zoneInfo.ZoneID.ToString(); if (!dictionary.ContainsKey(zoneInfo.ZoneID)) { string[] values = new string[] { text, zoneInfo.ZoneName }; this.Avail_tb.Rows.Add(values); } } return; } finally { System.IDisposable disposable = enumerator as System.IDisposable; if (disposable != null) { disposable.Dispose(); } } break; } case 1: case 2: break; case 3: case 4: goto IL_401; case 5: case 6: goto IL_50F; default: return; } this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string)); this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string)); System.Collections.ArrayList allZone2 = ZoneInfo.getAllZone(); System.Collections.ArrayList allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty(); System.Collections.IEnumerator enumerator2 = allRack_NoEmpty.GetEnumerator(); try { while (enumerator2.MoveNext()) { RackInfo rackInfo = (RackInfo)enumerator2.Current; if (!dictionary.ContainsKey(rackInfo.RackID)) { string displayRackName = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); string text2 = rackInfo.RackID.ToString(); bool flag = false; string text3 = ""; foreach (ZoneInfo zoneInfo2 in allZone2) { text3 = zoneInfo2.ZoneName; string[] source = zoneInfo2.RackInfo.Split(new char[] { ',' }); if (source.Contains(text2)) { flag = true; break; } } string[] values; if (flag) { values = new string[] { text2, displayRackName, text3 }; } else { values = new string[] { text2, displayRackName, "" }; } this.Avail_tb.Rows.Add(values); } } return; } finally { System.IDisposable disposable3 = enumerator2 as System.IDisposable; if (disposable3 != null) { disposable3.Dispose(); } } IL_401: this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string)); this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string)); System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice(); using (System.Collections.Generic.List <DeviceInfo> .Enumerator enumerator4 = allDevice.GetEnumerator()) { while (enumerator4.MoveNext()) { DeviceInfo current = enumerator4.Current; if (!dictionary.ContainsKey((long)current.DeviceID)) { string deviceName = current.DeviceName; string text4 = current.DeviceID.ToString(); RackInfo rackByID = RackInfo.getRackByID(current.RackID); string displayRackName2 = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); string[] values = new string[] { text4, deviceName, displayRackName2 }; this.Avail_tb.Rows.Add(values); } } return; } IL_50F: this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMOutlet, new string[0]), typeof(string)); this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string)); allDevice = DeviceOperation.GetAllDevice(); foreach (DeviceInfo current2 in allDevice) { System.Collections.Generic.List <PortInfo> portInfo = current2.GetPortInfo(); foreach (PortInfo current3 in portInfo) { if (!dictionary.ContainsKey((long)current3.ID)) { string[] values = new string[] { current3.ID.ToString(), current3.PortName, current2.DeviceName }; this.Avail_tb.Rows.Add(values); } } } } } }
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 int filldata(DataTable data, string groupname, long rackID, string showmonth, string strBegin, string strEnd, string device_id, string portid, int BillrateType, float Bill_1rate, float Bill_2rate1, float Bill_2rate2, ref double totalKWH, ref double totalFee) { string text = ""; RackInfo rackInfo = null; if (rackID > 0L) { rackInfo = RackInfo.getRackByID(rackID); text = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag); } float voltage = DeviceOperation.GetVoltage(device_id, portid); string text2 = "N/A"; string text3 = "N/A"; if ((double)voltage > 0.01) { text2 = voltage.ToString("F2") + "V"; } System.Collections.Generic.List <BillReportInfo> billReportInfo = DBTools.GetBillReportInfo(strBegin, strEnd, device_id, portid); double num = 0.0; double num2 = 0.0; foreach (BillReportInfo current in billReportInfo) { double num3 = (double)current.KWH / 10000.0; double num4 = num3 / (double)current.TIMESPAN_HOUR; if ((double)voltage > 0.01) { text3 = (num4 * 1000.0 / (double)voltage).ToString("F2") + "A"; } if (BillrateType == 0) { float num5 = Bill_1rate; double num6 = num3 * (double)num5; num2 += num6; totalFee += num6; totalKWH += num3; if (rackInfo == null) { data.Rows.Add(new object[] { groupname, showmonth, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } else { data.Rows.Add(new object[] { groupname, text, showmonth, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } } else { float num5; double num6; string msg; if (current.PERIOD.Equals("PEAK")) { msg = EcoLanguage.getMsg(LangRes.Rpt_BillPEAK, new string[0]); num5 = Bill_2rate1; num6 = num3 * (double)num5; num2 += num6; totalFee += num6; } else { msg = EcoLanguage.getMsg(LangRes.Rpt_BillnonPEAK, new string[0]); num5 = Bill_2rate2; num6 = num3 * (double)num5; num2 += num6; totalFee += num6; } num += num3; totalKWH += num3; if (rackInfo == null) { data.Rows.Add(new object[] { groupname, showmonth, msg, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } else { data.Rows.Add(new object[] { groupname, text, showmonth, msg, text3, text2, num4.ToString("F2"), num3.ToString("F4"), num5.ToString("F2"), num6.ToString("F2") }); } } groupname = ""; showmonth = ""; text = ""; } if (BillrateType == 1 && billReportInfo.Count > 0) { string msg = EcoLanguage.getMsg(LangRes.Rpt_BillALL, new string[0]); if (rackInfo == null) { data.Rows.Add(new object[] { groupname, showmonth, msg, "", "", "", num.ToString("F4"), "", num2.ToString("F2") }); } else { data.Rows.Add(new object[] { groupname, text, showmonth, msg, "", "", "", num.ToString("F4"), "", num2.ToString("F2") }); } } if (billReportInfo.Count > 0) { return(1); } return(0); }