예제 #1
0
        private void butDel_Click(object sender, System.EventArgs e)
        {
            if (this.lbRack.SelectedItem == null)
            {
                return;
            }
            this.closetips();
            int          selectedIndex = this.lbRack.SelectedIndex;
            string       text          = this.lbRack.SelectedItem.ToString();
            DialogResult dialogResult  = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Rack_delCrm, new string[]
            {
                text
            }), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            this.lbRack.Items.RemoveAt(selectedIndex);
            RackInfo rackInfo = (RackInfo)this.m_AllRacks[selectedIndex];

            this.m_AllRacks.RemoveAt(selectedIndex);
            this.m_MapID2Rack.Remove(rackInfo.RackID);
            this.delRackUi(rackInfo.RackID);
            RackInfo.DeleteByID(rackInfo.RackID);
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0430011", new string[]
                {
                    text,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0430011", new string[]
                {
                    text
                });
            }
            EcoGlobalVar.setDashBoardFlg(780uL, "", 64);
            if (this.lbRack.Items.Count == 0)
            {
                this.butDel.Enabled    = false;
                this.butModify.Enabled = false;
                return;
            }
            if (selectedIndex < this.lbRack.Items.Count)
            {
                this.lbRack.SelectedIndex = selectedIndex;
                return;
            }
            this.lbRack.SelectedIndex = this.lbRack.Items.Count - 1;
        }
예제 #2
0
        public bool addRack(int column, int row, string direction, string rackNm, string rackFNm)
        {
            if (!this.checkMove(direction, row, column, -1L))
            {
                return(false);
            }
            int i_ex;
            int i_ey;

            if (direction.Equals("H"))
            {
                i_ex = row;
                i_ey = column + 1;
            }
            else
            {
                i_ex = row + 1;
                i_ey = column;
            }
            long   num       = RackInfo.CreateRackInfo(rackNm, "", row, column, i_ex, i_ey, rackFNm);
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0430010", new string[]
                {
                    rackNm,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0430010", new string[]
                {
                    rackNm
                });
            }
            this.initRackList();
            bool flag = commDev.updateZoneforRack(this.m_MapID2Rack[num]);

            this.addRackUI(column, row, direction, rackNm, "", num);
            RackInfo rackInfo = this.m_MapID2Rack[num];

            this.lbRack.SelectedItem = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
            ulong num2      = 516uL;
            int   appAction = 0;

            if (flag)
            {
                num2 |= 264uL;
            }
            EcoGlobalVar.setDashBoardFlg(num2, "", appAction);
            return(true);
        }
예제 #3
0
        private object backupcfgPro(object param)
        {
            string str_folder = (string)param;

            this.syncThreshold();
            DeviceOperation.RefreshDBCache(false);
            EcoGlobalVar.setDashBoardFlg(2uL, "", 0);
            int num = Backuptask.BackupConfig4UI(str_folder);

            return(num);
        }
예제 #4
0
        private void butDevicesDel_Click(object sender, System.EventArgs e)
        {
            if (this.dgvAllDevices.SelectedRows.Count == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_needselect, new string[0]));
                return;
            }
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Dev_delCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < this.dgvAllDevices.SelectedRows.Count; i++)
            {
                DataGridViewCellCollection cells = this.dgvAllDevices.SelectedRows[i].Cells;
                string value = cells["dgvtbcdeviceId"].Value.ToString();
                arrayList.Insert(0, value);
            }
            System.Collections.ArrayList allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty();
            Program.IdleTimer_Pause(1);
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_delDev, new string[0]), null, new progressPopup.ProcessInThread(this.delDevicePro), arrayList, 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(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
            System.Collections.ArrayList allRack_NoEmpty2 = RackInfo.GetAllRack_NoEmpty();
            EcoGlobalVar.gl_DevManPage.FlushFlg_RackBoard = 1;
            if (allRack_NoEmpty.Count == allRack_NoEmpty2.Count)
            {
                EcoGlobalVar.setDashBoardFlg(526uL, "", 66);
            }
            else
            {
                EcoGlobalVar.setDashBoardFlg(526uL, "", 65);
            }
            EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
            this.changeTreeSelect("DevRoot");
        }
예제 #5
0
        public int modifyZone(long zoneID, string zoneNm, Color color)
        {
            ZoneInfo zoneByID = ZoneInfo.getZoneByID(zoneID);

            zoneByID.ZoneName  = zoneNm;
            zoneByID.ZoneColor = color.ToArgb().ToString();
            int result = zoneByID.UpdateZone();

            switch (result)
            {
            case -2:
            case -1:
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                break;

            case 1:
            {
                string valuePair = ValuePairs.getValuePair("Username");
                if (!string.IsNullOrEmpty(valuePair))
                {
                    LogAPI.writeEventLog("0430022", new string[]
                        {
                            zoneNm,
                            valuePair
                        });
                }
                else
                {
                    LogAPI.writeEventLog("0430022", new string[]
                        {
                            zoneNm
                        });
                }
                EcoGlobalVar.setDashBoardFlg(256uL, "", 0);
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                this.treeMenuInit();
                this.treeMenuSelect(zoneNm);
                this.butAdd.Enabled = false;
                EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
                break;
            }
            }
            return(result);
        }
예제 #6
0
        private void btnDel_Click(object sender, System.EventArgs e)
        {
            if (this.grouplist.SelectedItems.Count <= 0)
            {
                return;
            }
            if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Group_delCfm, new string[0]), MessageBoxButtons.OKCancel).Equals(DialogResult.Cancel))
            {
                return;
            }
            string value = this.grouplist.SelectedItems[0].Tag.ToString().Split(new char[]
            {
                '|'
            })[0];
            string text  = this.grouplist.SelectedItems[0].SubItems[0].Text;
            string text2 = this.grouplist.SelectedItems[0].SubItems[1].Text;
            int    num   = GroupInfo.DeleteGroupByID((long)System.Convert.ToInt32(value));

            if (num > 0)
            {
                LogAPI.writeEventLog("0430031", new string[]
                {
                    text2,
                    text,
                    EcoGlobalVar.gl_LoginUser.UserName
                });
                EcoGlobalVar.setDashBoardFlg(520uL, "", 64);
                this.FillList();
                if (this.grouplist.Items.Count == 0)
                {
                    this.btnDel.Enabled    = false;
                    this.btnModify.Enabled = false;
                    this.itemlist.Columns.Clear();
                    this.itemlist.Items.Clear();
                    return;
                }
            }
            else
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
        }
예제 #7
0
        private void butDel_Click(object sender, System.EventArgs e)
        {
            TreeNode selectedNode = this.tvZone.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            string       text         = selectedNode.Text;
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Zone_delCrm, new string[]
            {
                text
            }), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            ZoneInfo.DeleteByName(text);
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0430021", new string[]
                {
                    text,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0430021", new string[]
                {
                    text
                });
            }
            EcoGlobalVar.setDashBoardFlg(776uL, "", 64);
            this.treeMenuInit();
            this.zonerackInit();
            this.butAdd.Enabled = false;
            EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
        }
예제 #8
0
        private void butUserDel_Click(object sender, System.EventArgs e)
        {
            string       text         = this.dgvUserAll.CurrentRow.Cells[0].Value.ToString();
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.UsrInfo_delCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            int num = UserMaintain.DeleteByName(text);

            if (num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.UsrInfo_delfail, new string[]
                {
                    text
                }));
                return;
            }
            EcoGlobalVar.setDashBoardFlg(8192uL, "USER:"******"Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0330001", new string[]
                {
                    text,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0330001", new string[]
                {
                    text
                });
            }
            this.changeTreeSelect("");
        }
예제 #9
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]));
        }
예제 #10
0
        public int addZone(string zoneNm, Color color)
        {
            string text = "";
            int    num  = System.Math.Min(this.zonedef_startR, this.zonedef_endR);
            int    num2 = System.Math.Max(this.zonedef_startR, this.zonedef_endR);
            int    num3 = System.Math.Min(this.zonedef_startC, this.zonedef_endC);
            int    num4 = System.Math.Max(this.zonedef_startC, this.zonedef_endC);

            for (int i = num; i <= num2; i++)
            {
                for (int j = num3; j <= num4; j++)
                {
                    DataGridViewSpanCell dataGridViewSpanCell = (DataGridViewSpanCell)this.dgvSetDevice.Rows[i].Cells[j];
                    if (dataGridViewSpanCell.GetRowSpan() != 0 || dataGridViewSpanCell.GetColumnSpan() != 0)
                    {
                        string str = dataGridViewSpanCell.Tag.ToString();
                        text = text + str + ",";
                    }
                }
            }
            text = commUtil.uniqueIDs(text);
            if (text.Length > 0)
            {
                text = text.Substring(0, text.Length - 1);
            }
            this.zonedef_cancel();
            int result = ZoneInfo.CreateZoneInfo(zoneNm, text, num, num3, num2, num4, color.ToArgb().ToString());

            switch (result)
            {
            case -2:
            case -1:
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                break;

            case 1:
            {
                string valuePair = ValuePairs.getValuePair("Username");
                if (!string.IsNullOrEmpty(valuePair))
                {
                    LogAPI.writeEventLog("0430020", new string[]
                        {
                            zoneNm,
                            valuePair
                        });
                }
                else
                {
                    LogAPI.writeEventLog("0430020", new string[]
                        {
                            zoneNm
                        });
                }
                EcoGlobalVar.setDashBoardFlg(256uL, "", 0);
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                this.treeMenuInit();
                this.treeMenuSelect(zoneNm);
                this.butAdd.Enabled = false;
                EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
                break;
            }
            }
            return(result);
        }
예제 #11
0
        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;
            }
        }
예제 #12
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();
        }
예제 #13
0
        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]));
        }
예제 #14
0
        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);
        }
예제 #15
0
 private void butSave_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.devConfigCheck())
         {
             string         text              = this.labDevModel.Text;
             string         value             = this.labDevModel.Tag.ToString();
             int            l_id              = System.Convert.ToInt32(value);
             DeviceInfo     deviceByID        = DeviceOperation.getDeviceByID(l_id);
             DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(text, deviceByID.FWVersion);
             if (this.tbRefVoltage.Visible)
             {
                 deviceByID.ReferenceVoltage = System.Convert.ToSingle(this.tbRefVoltage.Text);
             }
             deviceByID.Min_current = ThresholdUtil.UI2DB(this.tbMinCurrent, deviceByID.Min_current, 0);
             deviceByID.Max_current = ThresholdUtil.UI2DB(this.tbMaxCurrent, deviceByID.Max_current, 0);
             deviceByID.Min_voltage = ThresholdUtil.UI2DB(this.tbMinVoltage, deviceByID.Min_voltage, 0);
             deviceByID.Max_voltage = ThresholdUtil.UI2DB(this.tbMaxVoltage, deviceByID.Max_voltage, 0);
             deviceByID.Min_power   = ThresholdUtil.UI2DB(this.tbMinPower, deviceByID.Min_power, 0);
             if (deviceModelConfig.commonThresholdFlag == Constant.APC_PDU && deviceByID.Min_power != -300f)
             {
                 deviceByID.Min_power *= 1000f;
             }
             deviceByID.Max_power = ThresholdUtil.UI2DB(this.tbMaxPower, deviceByID.Max_power, 0);
             if (deviceModelConfig.commonThresholdFlag == Constant.APC_PDU && deviceByID.Max_power != -300f)
             {
                 deviceByID.Max_power *= 1000f;
             }
             deviceByID.Min_power_diss = ThresholdUtil.UI2DB(this.tbMinPowerDiss, deviceByID.Min_power_diss, 0);
             deviceByID.Max_power_diss = ThresholdUtil.UI2DB(this.tbMaxPowerDiss, deviceByID.Max_power_diss, 0);
             if (deviceModelConfig.doorReading == 2)
             {
                 deviceByID.DoorSensor = 0;
                 if (this.rbPhoto_1.Checked)
                 {
                     deviceByID.DoorSensor = 1;
                 }
                 else
                 {
                     if (this.rbInductive_2.Checked)
                     {
                         deviceByID.DoorSensor = 2;
                     }
                     else
                     {
                         if (this.rbReed_3.Checked)
                         {
                             deviceByID.DoorSensor = 3;
                         }
                     }
                 }
             }
             string          mac             = deviceByID.Mac;
             DevSnmpConfig   sNMPpara        = commUtil.getSNMPpara(deviceByID);
             DevAccessAPI    devAccessAPI    = new DevAccessAPI(sNMPpara);
             DeviceThreshold deviceThreshold = new DeviceThreshold();
             int             thflg           = devcfgUtil.ThresholdFlg(deviceModelConfig, "dev");
             deviceThreshold.MinCurrentMT   = deviceByID.Min_current;
             deviceThreshold.MaxCurrentMT   = deviceByID.Max_current;
             deviceThreshold.MinVoltageMT   = deviceByID.Min_voltage;
             deviceThreshold.MaxVoltageMT   = deviceByID.Max_voltage;
             deviceThreshold.MinPowerMT     = deviceByID.Min_power;
             deviceThreshold.MaxPowerMT     = deviceByID.Max_power;
             deviceThreshold.MaxPowerDissMT = deviceByID.Max_power_diss;
             ThresholdUtil.UI2Dev(thflg, deviceThreshold);
             deviceThreshold.DevReferenceVoltage = deviceByID.ReferenceVoltage;
             deviceThreshold.PopEnableMode       = -500;
             deviceThreshold.PopThreshold        = -500f;
             deviceThreshold.PopModeOutlet       = -500;
             deviceThreshold.PopModeLIFO         = -500;
             deviceThreshold.PopModePriority     = -500;
             deviceThreshold.DoorSensorType      = deviceByID.DoorSensor;
             if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold && !devAccessAPI.SetDeviceThreshold(deviceThreshold, mac))
             {
                 EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
             }
             else
             {
                 deviceByID.Update();
                 string valuePair = ValuePairs.getValuePair("Username");
                 if (!string.IsNullOrEmpty(valuePair))
                 {
                     LogAPI.writeEventLog("0630000", new string[]
                     {
                         deviceByID.DeviceName,
                         deviceByID.Mac,
                         deviceByID.DeviceIP,
                         valuePair
                     });
                 }
                 else
                 {
                     LogAPI.writeEventLog("0630000", new string[]
                     {
                         deviceByID.DeviceName,
                         deviceByID.Mac,
                         deviceByID.DeviceIP
                     });
                 }
                 EcoGlobalVar.setDashBoardFlg(128uL, "#UPDATE#D" + deviceByID.DeviceID + ":;", 2);
                 EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.Dev_ThresholdSucc, new string[0]));
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine("PropDev Exception" + ex.Message);
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
     }
 }
예제 #16
0
        private void Rack_DragDrop(object sender, DragEventArgs e)
        {
            Point point = this.dgvSetDevice.PointToClient(new Point(e.X, e.Y));

            DataGridView.HitTestInfo hitTestInfo = this.dgvSetDevice.HitTest(point.X, point.Y);
            if (this.dragBoxFromMouseDown == Rectangle.Empty)
            {
                return;
            }
            this.dragBoxFromMouseDown = Rectangle.Empty;
            int rowIndex = hitTestInfo.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }
            int columnIndex = hitTestInfo.ColumnIndex;

            if (columnIndex < 0)
            {
                return;
            }
            int num  = this.colIndexFromMouseDown;
            int num2 = this.rowIndexFromMouseDown;

            if (num == columnIndex && num2 == rowIndex)
            {
                return;
            }
            DataGridViewSpanCell dataGridViewSpanCell  = (DataGridViewSpanCell)this.dgvSetDevice.Rows[this.rowIndexFromMouseDown].Cells[this.colIndexFromMouseDown];
            DataGridViewSpanCell dataGridViewSpanCell2 = (DataGridViewSpanCell)this.dgvSetDevice.Rows[rowIndex].Cells[columnIndex];
            string text;

            if (dataGridViewSpanCell.GetRowSpan() != 0)
            {
                text = "V";
            }
            else
            {
                text = "H";
            }
            if (text.Equals("H") && num2 == rowIndex && num + 1 == columnIndex)
            {
                return;
            }
            if (text.Equals("V") && num2 + 1 == rowIndex && num == columnIndex)
            {
                return;
            }
            System.Console.WriteLine(string.Concat(new object[]
            {
                "in Rack_DragDrop, From ",
                this.rowIndexFromMouseDown,
                ":",
                this.colIndexFromMouseDown,
                "->",
                rowIndex,
                ":",
                columnIndex
            }));
            if (!this.checkMove(text, rowIndex, columnIndex, (long)dataGridViewSpanCell.Tag))
            {
                return;
            }
            long   num3        = (long)dataGridViewSpanCell.Tag;
            string toolTipText = dataGridViewSpanCell.ToolTipText;
            string value       = dataGridViewSpanCell.Value.ToString();
            Color  backColor   = dataGridViewSpanCell.BackColor;
            DataGridViewSpanCell dataGridViewSpanCell3;
            DataGridViewSpanCell dataGridViewSpanCell4;

            if (text.Equals("V"))
            {
                dataGridViewSpanCell.Tag         = null;
                dataGridViewSpanCell.Value       = "";
                dataGridViewSpanCell.ToolTipText = "You can drag and move the rack";
                dataGridViewSpanCell.SetRowSpan(0);
                dataGridViewSpanCell.BackColor    = this.ColorLabel_;
                dataGridViewSpanCell3             = (DataGridViewSpanCell)this.dgvSetDevice.Rows[this.rowIndexFromMouseDown + 1].Cells[this.colIndexFromMouseDown];
                dataGridViewSpanCell3.Tag         = null;
                dataGridViewSpanCell3.Value       = "";
                dataGridViewSpanCell3.ToolTipText = "You can drag and move the rack";
                dataGridViewSpanCell3.SetRowSpan(0);
                dataGridViewSpanCell3.BackColor   = this.ColorLabel_;
                dataGridViewSpanCell2.Tag         = num3;
                dataGridViewSpanCell2.Value       = value;
                dataGridViewSpanCell2.ToolTipText = toolTipText;
                dataGridViewSpanCell2.SetRowSpan(1);
                dataGridViewSpanCell2.BackColor   = backColor;
                dataGridViewSpanCell4             = (DataGridViewSpanCell)this.dgvSetDevice.Rows[rowIndex + 1].Cells[columnIndex];
                dataGridViewSpanCell4.Tag         = num3;
                dataGridViewSpanCell4.Value       = value;
                dataGridViewSpanCell4.ToolTipText = toolTipText;
                dataGridViewSpanCell4.SetRowSpan(-1);
                dataGridViewSpanCell4.BackColor = backColor;
            }
            else
            {
                dataGridViewSpanCell.Tag         = null;
                dataGridViewSpanCell.Value       = "";
                dataGridViewSpanCell.ToolTipText = "You can drag and move the rack";
                dataGridViewSpanCell.SetColumnSpan(0);
                dataGridViewSpanCell.BackColor    = this.ColorLabel_;
                dataGridViewSpanCell3             = (DataGridViewSpanCell)this.dgvSetDevice.Rows[this.rowIndexFromMouseDown].Cells[this.colIndexFromMouseDown + 1];
                dataGridViewSpanCell3.Tag         = null;
                dataGridViewSpanCell3.Value       = "";
                dataGridViewSpanCell3.ToolTipText = "You can drag and move the rack";
                dataGridViewSpanCell3.SetColumnSpan(0);
                dataGridViewSpanCell3.BackColor   = this.ColorLabel_;
                dataGridViewSpanCell2.Tag         = num3;
                dataGridViewSpanCell2.Value       = value;
                dataGridViewSpanCell2.ToolTipText = toolTipText;
                dataGridViewSpanCell2.SetColumnSpan(1);
                dataGridViewSpanCell2.BackColor   = backColor;
                dataGridViewSpanCell4             = (DataGridViewSpanCell)this.dgvSetDevice.Rows[rowIndex].Cells[columnIndex + 1];
                dataGridViewSpanCell4.Tag         = num3;
                dataGridViewSpanCell4.Value       = value;
                dataGridViewSpanCell2.ToolTipText = toolTipText;
                dataGridViewSpanCell4.SetColumnSpan(-1);
                dataGridViewSpanCell4.BackColor = backColor;
            }
            RackInfo rackInfo = this.m_MapID2Rack[num3];

            if (text.Equals("H"))
            {
                rackInfo.EndPoint_X = rowIndex;
                rackInfo.EndPoint_Y = columnIndex + 1;
            }
            else
            {
                rackInfo.EndPoint_X = rowIndex + 1;
                rackInfo.EndPoint_Y = columnIndex;
            }
            rackInfo.StartPoint_X = rowIndex;
            rackInfo.StartPoint_Y = columnIndex;
            rackInfo.UpdateRack();
            bool flag = commDev.updateZoneforRack(rackInfo);

            EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
            ulong num4 = 4uL;
            int   num5 = 0;

            if (flag)
            {
                num4 |= 264uL;
                num5 |= 64;
            }
            num5 |= 1;
            EcoGlobalVar.setDashBoardFlg(num4, "", num5);
            this.dgvSetDevice.InvalidateCell(dataGridViewSpanCell);
            this.dgvSetDevice.InvalidateCell(dataGridViewSpanCell3);
            this.dgvSetDevice.InvalidateCell(dataGridViewSpanCell2);
            this.dgvSetDevice.InvalidateCell(dataGridViewSpanCell4);
        }
예제 #17
0
 private void butAssign_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.devConfigCheck())
         {
             DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Dev_ApplyAll, new string[0]), MessageBoxButtons.OKCancel);
             if (dialogResult != DialogResult.Cancel)
             {
                 string         text              = this.labDevModel.Text;
                 string         value             = this.labDevModel.Tag.ToString();
                 int            l_id              = System.Convert.ToInt32(value);
                 DeviceInfo     deviceByID        = DeviceOperation.getDeviceByID(l_id);
                 DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(text, deviceByID.FWVersion);
                 System.Collections.Generic.List <DeviceInfo> allDeviceByModel = DeviceOperation.GetAllDeviceByModel(text);
                 string fWVersion = deviceByID.FWVersion;
                 System.Collections.Generic.List <DeviceInfo> list = new System.Collections.Generic.List <DeviceInfo>();
                 foreach (DeviceInfo current in allDeviceByModel)
                 {
                     if (current.DeviceID != deviceByID.DeviceID)
                     {
                         if (!DevAccessCfg.GetInstance().isAutodectDev(current.ModelNm, current.FWVersion))
                         {
                             list.Add(current);
                         }
                         else
                         {
                             if (current.FWVersion.Equals(fWVersion))
                             {
                                 list.Add(current);
                             }
                         }
                     }
                 }
                 if (this.tbRefVoltage.Visible)
                 {
                     deviceByID.ReferenceVoltage = System.Convert.ToSingle(this.tbRefVoltage.Text);
                 }
                 deviceByID.Min_current = ThresholdUtil.UI2DB(this.tbMinCurrent, deviceByID.Min_current, 0);
                 deviceByID.Max_current = ThresholdUtil.UI2DB(this.tbMaxCurrent, deviceByID.Max_current, 0);
                 deviceByID.Min_voltage = ThresholdUtil.UI2DB(this.tbMinVoltage, deviceByID.Min_voltage, 0);
                 deviceByID.Max_voltage = ThresholdUtil.UI2DB(this.tbMaxVoltage, deviceByID.Max_voltage, 0);
                 deviceByID.Min_power   = ThresholdUtil.UI2DB(this.tbMinPower, deviceByID.Min_power, 0);
                 if (deviceModelConfig.commonThresholdFlag == Constant.APC_PDU && deviceByID.Min_power != -300f)
                 {
                     deviceByID.Min_power *= 1000f;
                 }
                 deviceByID.Max_power = ThresholdUtil.UI2DB(this.tbMaxPower, deviceByID.Max_power, 0);
                 if (deviceModelConfig.commonThresholdFlag == Constant.APC_PDU && deviceByID.Max_power != -300f)
                 {
                     deviceByID.Max_power *= 1000f;
                 }
                 deviceByID.Min_power_diss = ThresholdUtil.UI2DB(this.tbMinPowerDiss, deviceByID.Min_power_diss, 0);
                 deviceByID.Max_power_diss = ThresholdUtil.UI2DB(this.tbMaxPowerDiss, deviceByID.Max_power_diss, 0);
                 if (deviceModelConfig.doorReading == 2)
                 {
                     deviceByID.DoorSensor = 0;
                     if (this.rbPhoto_1.Checked)
                     {
                         deviceByID.DoorSensor = 1;
                     }
                     else
                     {
                         if (this.rbInductive_2.Checked)
                         {
                             deviceByID.DoorSensor = 2;
                         }
                         else
                         {
                             if (this.rbReed_3.Checked)
                             {
                                 deviceByID.DoorSensor = 3;
                             }
                         }
                     }
                 }
                 DeviceInfo      item            = new DeviceInfo(-1, "", "", "", "", "", "", "", 0, 0, "", 161, 1, "", deviceByID.Max_voltage, deviceByID.Min_voltage, deviceByID.Max_power_diss, deviceByID.Min_power_diss, deviceByID.Max_power, deviceByID.Min_power, deviceByID.Max_current, deviceByID.Min_current, -1L, "", -500, -500f, deviceByID.DoorSensor, 0f, -500, -500, -500, "", -500f);
                 int             thflg           = devcfgUtil.ThresholdFlg(deviceModelConfig, "dev");
                 DeviceThreshold deviceThreshold = new DeviceThreshold();
                 deviceThreshold.MinCurrentMT   = deviceByID.Min_current;
                 deviceThreshold.MaxCurrentMT   = deviceByID.Max_current;
                 deviceThreshold.MinVoltageMT   = deviceByID.Min_voltage;
                 deviceThreshold.MaxVoltageMT   = deviceByID.Max_voltage;
                 deviceThreshold.MinPowerMT     = deviceByID.Min_power;
                 deviceThreshold.MaxPowerMT     = deviceByID.Max_power;
                 deviceThreshold.MaxPowerDissMT = deviceByID.Max_power_diss;
                 ThresholdUtil.UI2Dev(thflg, deviceThreshold);
                 deviceThreshold.PopEnableMode   = -500;
                 deviceThreshold.PopThreshold    = -500f;
                 deviceThreshold.PopModeOutlet   = -500;
                 deviceThreshold.PopModeLIFO     = -500;
                 deviceThreshold.PopModePriority = -500;
                 deviceThreshold.DoorSensorType  = -500;
                 System.Collections.Generic.List <DevSnmpConfig> list2 = new System.Collections.Generic.List <DevSnmpConfig>();
                 foreach (DeviceInfo current2 in list)
                 {
                     if (ClientAPI.IsDeviceOnline(current2.DeviceID))
                     {
                         DevSnmpConfig sNMPpara = commUtil.getSNMPpara(current2);
                         list2.Add(sNMPpara);
                     }
                 }
                 bool   flag  = false;
                 string text2 = "";
                 if (list.Count > 0)
                 {
                     System.Collections.Generic.List <object> list3 = new System.Collections.Generic.List <object>();
                     list3.Add(deviceThreshold);
                     list3.Add(item);
                     list3.Add(list2);
                     list3.Add(list);
                     Program.IdleTimer_Pause(1);
                     System.Collections.Generic.List <object> list4;
                     if (list2.Count > 50)
                     {
                         progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_setDevThreshold, new string[0]), null, new progressPopup.ProcessInThread(this.SetDeviceThresholdProc), list3, 0);
                         progressPopup.ShowDialog();
                         list4 = (progressPopup.Return_V as System.Collections.Generic.List <object>);
                     }
                     else
                     {
                         list4 = (this.SetDeviceThresholdProc(list3) as System.Collections.Generic.List <object>);
                     }
                     flag  = (bool)list4[0];
                     text2 = (string)list4[1];
                 }
                 if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold)
                 {
                     DevSnmpConfig sNMPpara2    = commUtil.getSNMPpara(deviceByID);
                     DevAccessAPI  devAccessAPI = new DevAccessAPI(sNMPpara2);
                     deviceThreshold.DevReferenceVoltage = deviceByID.ReferenceVoltage;
                     deviceThreshold.DoorSensorType      = deviceByID.DoorSensor;
                     if (devAccessAPI.SetDeviceThreshold(deviceThreshold, deviceByID.Mac))
                     {
                         flag = true;
                     }
                     else
                     {
                         text2 = "HAVE EXCEPTION!";
                     }
                 }
                 Program.IdleTimer_Run(1);
                 if (flag)
                 {
                     EcoGlobalVar.setDashBoardFlg(2uL, "", 2);
                     string valuePair = ValuePairs.getValuePair("Username");
                     if (!string.IsNullOrEmpty(valuePair))
                     {
                         LogAPI.writeEventLog("0630001", new string[]
                         {
                             text,
                             valuePair
                         });
                     }
                     else
                     {
                         LogAPI.writeEventLog("0630001", new string[]
                         {
                             text
                         });
                     }
                 }
                 if (text2.Length > 0)
                 {
                     if (text2.Equals("HAVE EXCEPTION!"))
                     {
                         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
                     }
                     else
                     {
                         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail_1, new string[]
                         {
                             text2
                         }));
                     }
                 }
                 else
                 {
                     EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.Dev_ThresholdSucc, new string[0]));
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine("Devive Porperties -- butAssign_Click Error:" + ex.Message);
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
     }
 }
예제 #18
0
        private void butBankAssign_Click(object sender, System.EventArgs e)
        {
            bool   flag   = false;
            DBConn dBConn = null;
            string text   = this.labDevModel.Tag.ToString();

            try
            {
                int            num               = System.Convert.ToInt32(text);
                DeviceInfo     deviceByID        = DeviceOperation.getDeviceByID(num);
                DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion);
                if (this.bankCheck(deviceModelConfig))
                {
                    DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Dev_ApplyBank, new string[0]), MessageBoxButtons.OKCancel);
                    if (dialogResult != DialogResult.Cancel)
                    {
                        string        text2         = this.tbBankNm.Text;
                        string        text3         = this.labBankNo.Text;
                        int           num2          = System.Convert.ToInt32(text3);
                        BankInfo      bankInfo      = new BankInfo(num, num2);
                        DevSnmpConfig sNMPpara      = commUtil.getSNMPpara(deviceByID);
                        BankThreshold bankThreshold = new BankThreshold(1);
                        if (this.gbThreshold.Visible)
                        {
                            bankInfo.Min_current    = ThresholdUtil.UI2DB(this.tbOMinCurrent, bankInfo.Min_current, 0);
                            bankInfo.Max_current    = ThresholdUtil.UI2DB(this.tbOMaxCurrent, bankInfo.Max_current, 0);
                            bankInfo.Min_voltage    = ThresholdUtil.UI2DB(this.tbOMinVoltage, bankInfo.Min_voltage, 0);
                            bankInfo.Max_voltage    = ThresholdUtil.UI2DB(this.tbOMaxVoltage, bankInfo.Max_voltage, 0);
                            bankInfo.Min_power      = ThresholdUtil.UI2DB(this.tbOMinPower, bankInfo.Min_power, 0);
                            bankInfo.Max_power      = ThresholdUtil.UI2DB(this.tbOMaxPower, bankInfo.Max_power, 0);
                            bankInfo.Min_power_diss = ThresholdUtil.UI2DB(this.tbOMinPowerDiss, bankInfo.Min_power_diss, 0);
                            bankInfo.Max_power_diss = ThresholdUtil.UI2DB(this.tbOMaxPowerDiss, bankInfo.Max_power_diss, 0);
                            int thflg = devcfgUtil.ThresholdFlg(deviceModelConfig, "bank");
                            bankThreshold.MinCurrentMt   = bankInfo.Min_current;
                            bankThreshold.MaxCurrentMT   = bankInfo.Max_current;
                            bankThreshold.MinVoltageMT   = bankInfo.Min_voltage;
                            bankThreshold.MaxVoltageMT   = bankInfo.Max_voltage;
                            bankThreshold.MinPowerMT     = bankInfo.Min_power;
                            bankThreshold.MaxPowerMT     = bankInfo.Max_power;
                            bankThreshold.MaxPowerDissMT = bankInfo.Max_power_diss;
                            ThresholdUtil.UI2Dev(thflg, bankThreshold);
                        }
                        DevAccessAPI devAccessAPI = new DevAccessAPI(sNMPpara);
                        string       myMac        = deviceByID.Mac;
                        System.Collections.Generic.List <BankInfo> bankInfo2 = deviceByID.GetBankInfo();
                        dBConn = DBConnPool.getConnection();
                        foreach (BankInfo current in bankInfo2)
                        {
                            BankThreshold bankThreshold2 = new BankThreshold(System.Convert.ToInt32(current.PortLists));
                            if (num2 == System.Convert.ToInt32(current.PortLists))
                            {
                                current.BankName = text2;
                            }
                            bankThreshold2.BankName = current.BankName;
                            if (this.gbThreshold.Visible)
                            {
                                bankThreshold2.MaxCurrentMT   = bankThreshold.MaxCurrentMT;
                                bankThreshold2.MinCurrentMt   = bankThreshold.MinCurrentMt;
                                bankThreshold2.MaxPowerMT     = bankThreshold.MaxPowerMT;
                                bankThreshold2.MinPowerMT     = bankThreshold.MinPowerMT;
                                bankThreshold2.MaxVoltageMT   = bankThreshold.MaxVoltageMT;
                                bankThreshold2.MinVoltageMT   = bankThreshold.MinVoltageMT;
                                bankThreshold2.MaxPowerDissMT = bankThreshold.MaxPowerDissMT;
                            }
                            bool flag2 = true;
                            if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold)
                            {
                                flag2 = devAccessAPI.SetBankThreshold(bankThreshold2, myMac);
                            }
                            if (!flag2)
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
                                return;
                            }
                            if (this.gbThreshold.Visible)
                            {
                                current.CopyThreshold(bankInfo);
                            }
                            current.UpdateBankThreshold(dBConn);
                            flag  = true;
                            myMac = "";
                        }
                        if (dBConn != null)
                        {
                            dBConn.close();
                        }
                        string valuePair = ValuePairs.getValuePair("Username");
                        if (!string.IsNullOrEmpty(valuePair))
                        {
                            LogAPI.writeEventLog("0630011", new string[]
                            {
                                deviceByID.ModelNm,
                                deviceByID.DeviceIP,
                                deviceByID.DeviceName,
                                valuePair
                            });
                        }
                        else
                        {
                            LogAPI.writeEventLog("0630011", new string[]
                            {
                                deviceByID.ModelNm,
                                deviceByID.DeviceIP,
                                deviceByID.DeviceName
                            });
                        }
                        EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.Dev_ThresholdSucc, new string[0]));
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine("butBankAssign_Click Exception" + ex.Message);
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
            }
            finally
            {
                if (dBConn != null)
                {
                    dBConn.close();
                }
                DeviceOperation.RefreshDBCache(false);
                if (flag)
                {
                    EcoGlobalVar.setDashBoardFlg(128uL, "#UPDATE#D" + text + ":B*;", 2);
                }
            }
        }
예제 #19
0
 private void butBankSave_Click(object sender, System.EventArgs e)
 {
     try
     {
         string         value             = this.labDevModel.Tag.ToString();
         int            num               = System.Convert.ToInt32(value);
         DeviceInfo     deviceByID        = DeviceOperation.getDeviceByID(num);
         DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion);
         if (this.bankCheck(deviceModelConfig))
         {
             string        text          = this.tbBankNm.Text;
             string        text2         = this.labBankNo.Text;
             int           num2          = System.Convert.ToInt32(text2);
             BankInfo      bankInfo      = new BankInfo(num, num2);
             DevSnmpConfig sNMPpara      = commUtil.getSNMPpara(deviceByID);
             BankThreshold bankThreshold = new BankThreshold(num2);
             bankThreshold.BankName = text;
             if (this.gbThreshold.Visible)
             {
                 bankInfo.Min_current    = ThresholdUtil.UI2DB(this.tbOMinCurrent, bankInfo.Min_current, 0);
                 bankInfo.Max_current    = ThresholdUtil.UI2DB(this.tbOMaxCurrent, bankInfo.Max_current, 0);
                 bankInfo.Min_voltage    = ThresholdUtil.UI2DB(this.tbOMinVoltage, bankInfo.Min_voltage, 0);
                 bankInfo.Max_voltage    = ThresholdUtil.UI2DB(this.tbOMaxVoltage, bankInfo.Max_voltage, 0);
                 bankInfo.Min_power      = ThresholdUtil.UI2DB(this.tbOMinPower, bankInfo.Min_power, 0);
                 bankInfo.Max_power      = ThresholdUtil.UI2DB(this.tbOMaxPower, bankInfo.Max_power, 0);
                 bankInfo.Min_power_diss = ThresholdUtil.UI2DB(this.tbOMinPowerDiss, bankInfo.Min_power_diss, 0);
                 bankInfo.Max_power_diss = ThresholdUtil.UI2DB(this.tbOMaxPowerDiss, bankInfo.Max_power_diss, 0);
                 int thflg = devcfgUtil.ThresholdFlg(deviceModelConfig, "bank");
                 bankThreshold.MinCurrentMt   = bankInfo.Min_current;
                 bankThreshold.MaxCurrentMT   = bankInfo.Max_current;
                 bankThreshold.MinVoltageMT   = bankInfo.Min_voltage;
                 bankThreshold.MaxVoltageMT   = bankInfo.Max_voltage;
                 bankThreshold.MinPowerMT     = bankInfo.Min_power;
                 bankThreshold.MaxPowerMT     = bankInfo.Max_power;
                 bankThreshold.MaxPowerDissMT = bankInfo.Max_power_diss;
                 ThresholdUtil.UI2Dev(thflg, bankThreshold);
             }
             bool flag = true;
             if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold)
             {
                 DevAccessAPI devAccessAPI = new DevAccessAPI(sNMPpara);
                 flag = devAccessAPI.SetBankThreshold(bankThreshold, deviceByID.Mac);
             }
             if (flag)
             {
                 if (bankInfo != null)
                 {
                     bankInfo.BankName = text;
                     bankInfo.Update();
                     EcoGlobalVar.setDashBoardFlg(128uL, string.Concat(new object[]
                     {
                         "#UPDATE#D",
                         bankInfo.DeviceID,
                         ":B",
                         bankInfo.ID,
                         ";"
                     }), 2);
                     string valuePair = ValuePairs.getValuePair("Username");
                     if (!string.IsNullOrEmpty(valuePair))
                     {
                         LogAPI.writeEventLog("0630010", new string[]
                         {
                             bankInfo.BankName,
                             bankInfo.PortLists,
                             deviceByID.DeviceIP,
                             deviceByID.DeviceName,
                             valuePair
                         });
                     }
                     else
                     {
                         LogAPI.writeEventLog("0630010", new string[]
                         {
                             bankInfo.BankName,
                             bankInfo.PortLists,
                             deviceByID.DeviceIP,
                             deviceByID.DeviceName
                         });
                     }
                 }
                 EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.Dev_ThresholdSucc, new string[0]));
             }
             else
             {
                 EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
             }
         }
     }
     catch (System.Exception ex)
     {
         System.Console.WriteLine("PropBank Exception" + ex.Message);
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdFail, new string[0]));
     }
 }
예제 #20
0
        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();
            }
        }