Beispiel #1
0
        private void butSave_Click(object sender, System.EventArgs e)
        {
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbIdleTimeOut, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbidletimeout.Text
                }));
                return;
            }
            if (!Ecovalidate.Rangeint(this.tbIdleTimeOut, 0, 30))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                {
                    this.lbidletimeout.Text,
                    "0",
                    "30"
                }));
                return;
            }
            int num = System.Convert.ToInt32(this.tbIdleTimeOut.Text);

            ValuePairs.setIdleTimeout(num, true);
            Program.m_IdleTimeSet = num * Program.m_IdleTimeFact;
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            base.DialogResult = DialogResult.OK;
            base.Close();
        }
Beispiel #2
0
        private void btnadd_Click(object sender, System.EventArgs e)
        {
            string text  = "";
            int    count = this.grouplist.SelectedItems.Count;

            if (this.m_existgpnum + count > 4)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_selmaxnum, new string[0]));
                this.grouplist.Focus();
                return;
            }
            foreach (ListViewItem listViewItem in this.grouplist.SelectedItems)
            {
                text = text + listViewItem.Tag + ",";
            }
            if (text.Length == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
                return;
            }
            text = text.Substring(0, text.Length - 1);
            GroupInfo.UpdateGroupThermalFlag(1, text);
            base.Close();
            base.Dispose();
        }
Beispiel #3
0
        public void pageInit(OtherDevices pParent, string gatewayID, string devName)
        {
            this.m_pParent   = pParent;
            this.m_gatewayID = gatewayID;
            InSnergyGateway gateWaybyGID = InSnergyGateway.GetGateWaybyGID(gatewayID);

            if (gateWaybyGID == null)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DevInfo_nofind, new string[]
                {
                    devName
                }));
                return;
            }
            this.tbDevName.Text  = gateWaybyGID.GatewayName;
            this.labDevIp.Text   = InSnergyService.getGatewayIP(gateWaybyGID.GatewayID);
            this.labDevType.Text = gateWaybyGID.GatewayType;
            this.dgvBranchPanels.Rows.Clear();
            int num = 1;

            foreach (Branch current in gateWaybyGID.BranchList)
            {
                string[] values = new string[]
                {
                    num.ToString(),
                            current.BranchName,
                            current.Location,
                            current.SubMeterList.Count.ToString(),
                            current.GatewayID,
                            current.BranchID
                };
                this.dgvBranchPanels.Rows.Add(values);
                num++;
            }
        }
Beispiel #4
0
 private void butSysparaSave_Click(object sender, System.EventArgs e)
 {
     if (!this.paraCheck())
     {
         return;
     }
     if (this.rbBilling1rate.Checked)
     {
         float bill_1rate = System.Convert.ToSingle(this.tb1rate.Text);
         if (Sys_Para.SetBill_ratetype(0) < 0 || Sys_Para.SetBill_1rate(bill_1rate) < 0)
         {
             EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
             return;
         }
     }
     else
     {
         float  bill_2rate     = System.Convert.ToSingle(this.tb2Rate1.Text);
         float  bill_2rate2    = System.Convert.ToSingle(this.tb2Rate2.Text);
         string bill_2from     = this.dtPicker2from1.Text + ":00:00";
         int    bill_2duration = System.Convert.ToInt32(this.tbduration.Text);
         if (Sys_Para.SetBill_ratetype(1) < 0 || Sys_Para.SetBill_2from1(bill_2from) < 0 || Sys_Para.SetBill_2duration1(bill_2duration) < 0 || Sys_Para.SetBill_2rate1(bill_2rate) < 0 || Sys_Para.SetBill_2rate2(bill_2rate2) < 0)
         {
             EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
             return;
         }
     }
     EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
 }
Beispiel #5
0
        private void btCfgBackup_Click(object sender, System.EventArgs e)
        {
            if (!DBMaintain.ConvertOldDataFinish)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0]));
                return;
            }
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbBackupPath, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbBackupPath.Text
                }));
                return;
            }
            Program.IdleTimer_Pause(1);
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_saving, new string[0]), null, new progressPopup.ProcessInThread(this.backupcfgPro), this.tbBackupPath.Text, 0);

            progressPopup.ShowDialog();
            object return_V = progressPopup.Return_V;

            Program.IdleTimer_Run(1);
            int?num = return_V as int?;

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
        }
Beispiel #6
0
        private bool paraCheck()
        {
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.textBoxMySQLPort, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.label1.Text
                }));
                return(false);
            }
            if (!Ecovalidate.Rangeint(this.textBoxMySQLPort, 1, 65535))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                {
                    this.label1.Text,
                    "1",
                    "65535"
                }));
                return(false);
            }
            Ecovalidate.checkTextIsNull(this.textBoxMySQLUsername, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.label2.Text
                }));
                return(false);
            }
            return(true);
        }
Beispiel #7
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            string text = Sys_Para.GetBillPath();

            if (text.Length == 0)
            {
                text = System.IO.Directory.GetCurrentDirectory() + "\\BillReportFile\\";
            }
            System.DateTime now = System.DateTime.Now;
            int             num = this.SaveToFile(text + now.ToString("yyyy-MM-dd HH-mm-ss"), this.m_pParaClass.Txttitle);

            if (num == -1)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rpt_saveErr1, new string[0]));
                return;
            }
            if (num == -2)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            string str = text + now.ToString("yyyy-MM-dd HH-mm-ss") + "\\" + this.m_pParaClass.Txttitle.Replace("'", "''");

            if (ReportInfo.InsertBillReport(this.m_pParaClass.Txttitle, this.m_pParaClass.Txtwriter, now, str + ".html") == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            this.m_isRPTSaved = true;
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
        }
Beispiel #8
0
        private bool userCheck()
        {
            string text = this.tbUserNmEdit.Text;

            if (string.IsNullOrEmpty(text))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbUserNmEdit.Text
                }));
                this.tbUserNmEdit.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(this.tbUserPwEdit.Text))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbUserPwEdit.Text
                }));
                this.tbUserPwEdit.Focus();
                return(false);
            }
            if (this.tbUserPwEdit.Text != this.tbUserCPwEdit.Text)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.match, new string[]
                {
                    this.lbUserPwEdit.Text,
                    this.lbUserCPwEdit.Text
                }));
                this.tbUserCPwEdit.Focus();
                return(false);
            }
            return(true);
        }
Beispiel #9
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            string text = this.txtpath.Text;

            if (text == "")
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbpath.Text
                }));
                return;
            }
            for (int i = 0; i < text.Length; i++)
            {
                char c = text.Substring(i, 1).ToCharArray()[0];
                if (c > '~')
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.RptMng_pathErr1, new string[0]));
                    return;
                }
            }
            int num = Sys_Para.UpdateDefinePath(this.txtpath.Text.Replace("'", "''"));

            if (num > 0)
            {
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            }
        }
Beispiel #10
0
        private bool paraoptCheck()
        {
            bool flag = false;

            if (this.cbkeepdata.Checked)
            {
                Ecovalidate.checkTextIsNull(this.tbkeepmonths, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbMonths.Text
                    }));
                    return(false);
                }
                if (!Ecovalidate.Rangeint(this.tbkeepmonths, 6, 60))
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                    {
                        this.lbMonths.Text,
                        "6",
                        "60"
                    }));
                    return(false);
                }
            }
            return(true);
        }
Beispiel #11
0
 private void initPage(object obj)
 {
     try
     {
         System.Threading.Thread.Sleep(500);
         System.TimeSpan timeout = System.TimeSpan.FromMilliseconds(30000.0);
         try
         {
             ServiceController serviceController = new ServiceController(EcoGlobalVar.gl_ServiceName);
             serviceController.Start();
             serviceController.WaitForStatus(ServiceControllerStatus.Running, timeout);
         }
         catch (System.Exception)
         {
             EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
         }
         ControlAccess.ConfigControl config = delegate(Control control, object param)
         {
             this.enableclose = 1;
             base.Close();
         };
         ControlAccess controlAccess = new ControlAccess(this, config);
         controlAccess.Access(this, null);
     }
     catch (System.Exception)
     {
     }
 }
Beispiel #12
0
        private void butOthDevicesDel_Click(object sender, System.EventArgs e)
        {
            if (this.dgvAllOtherDevices.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.dgvAllOtherDevices.SelectedRows.Count; i++)
            {
                DataGridViewCellCollection cells = this.dgvAllOtherDevices.SelectedRows[i].Cells;
                string value = cells[4].Value.ToString();
                arrayList.Add(value);
            }
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_delDev, new string[0]), null, new progressPopup.ProcessInThread(this.delGateWayPro), arrayList, 0);

            progressPopup.ShowDialog();
            object return_V = progressPopup.Return_V;
            int?   num      = return_V as int?;

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
            this.changeTreeSelect("DevRoot");
        }
Beispiel #13
0
        private bool DBparaCheck()
        {
            if (!this.checkBoxUseMySQL.Checked)
            {
                return(true);
            }
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbDBIP, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbDBIP.Text
                }));
                return(false);
            }
            try
            {
                string text = IPAddress.Parse(this.tbDBIP.Text).ToString();
                this.tbDBIP.Text = text;
            }
            catch (System.Exception)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.IPFORMAT, new string[0]));
                this.tbDBIP.Focus();
                bool result = false;
                return(result);
            }
            Ecovalidate.checkTextIsNull(this.tbDBPort, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbDBPort.Text
                }));
                return(false);
            }
            if (!Ecovalidate.Rangeint(this.tbDBPort, 1, 65535))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                {
                    this.lbDBPort.Text,
                    "1",
                    "65535"
                }));
                return(false);
            }
            Ecovalidate.checkTextIsNull(this.tbDBUsrnm, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbDBUsrnm.Text
                }));
                return(false);
            }
            return(true);
        }
Beispiel #14
0
        private bool devConfigCheck()
        {
            string value     = this.labDevModel.Tag.ToString();
            string fmwareVer = this.labDevIp.Tag.ToString();

            System.Convert.ToInt32(value);
            DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(this.labDevModel.Text, fmwareVer);
            bool           flag = false;

            if (this.tbRefVoltage.Visible)
            {
                Ecovalidate.checkTextIsNull(this.tbRefVoltage, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbRefVoltage.Text
                    }));
                    return(false);
                }
                if (!Ecovalidate.RangeDouble(this.tbRefVoltage, 90.0, 260.0))
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                    {
                        this.lbRefVoltage.Text,
                        "90",
                        "260"
                    }));
                    return(false);
                }
            }
            flag = true;
            int num = devcfgUtil.UIThresholdEditFlg(deviceModelConfig, "dev");

            Ecovalidate.checkThresholdValue(this.tbMinCurrent, this.labMaxCurrentBound, (num & 256) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMaxCurrent, this.labMaxCurrentBound, (num & 512) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMinVoltage, this.labMaxVoltageBound, (num & 1024) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMaxVoltage, this.labMaxVoltageBound, (num & 2048) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMinPower, this.labMaxPowerBound, (num & 4096) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMaxPower, this.labMaxPowerBound, (num & 8192) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMinPowerDiss, this.labMaxPowerDisBound, (num & 16384) == 0, ref flag);
            Ecovalidate.checkThresholdValue(this.tbMaxPowerDiss, this.labMaxPowerDisBound, (num & 32768) == 0, ref flag);
            if (!flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_Thresholdinvalid, new string[0]));
                return(false);
            }
            Ecovalidate.checkThresholdMaxMixValue(this.tbMaxCurrent, this.tbMinCurrent, ref flag);
            Ecovalidate.checkThresholdMaxMixValue(this.tbMaxVoltage, this.tbMinVoltage, ref flag);
            Ecovalidate.checkThresholdMaxMixValue(this.tbMaxPower, this.tbMinPower, ref flag);
            Ecovalidate.checkThresholdMaxMixValue(this.tbMaxPowerDiss, this.tbMinPowerDiss, ref flag);
            if (!flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdMinMax, new string[0]));
                return(false);
            }
            return(true);
        }
Beispiel #15
0
        private void btnSearch_Click(object sender, System.EventArgs e)
        {
            string text = this.cboby.SelectedIndex.ToString();

            if (text != "0" && this.txtkey.Text == "")
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.RptMng_needKeyword, new string[0]));
                return;
            }
            this.DataBind(text);
            this.ShowAll = false;
        }
Beispiel #16
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (this.grouplist.Items.Count >= 4)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_selmaxnum, new string[0]));
                return;
            }
            EGenRptParaGpAdd eGenRptParaGpAdd = new EGenRptParaGpAdd(this.grouplist.Items.Count);

            eGenRptParaGpAdd.ShowDialog();
            this.FillgroupList();
        }
Beispiel #17
0
        public void pageInit(DevManDevice pParent, int devID, string devName, bool onlinest)
        {
            this.m_ininit   = true;
            this.m_cleartab = true;
            this.tcDev.Controls.Clear();
            this.m_cleartab = false;
            DeviceInfo deviceByID = DeviceOperation.getDeviceByID(devID);

            if (deviceByID == null)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DevInfo_nofind, new string[]
                {
                    devName
                }));
                return;
            }
            this.m_onlinest = onlinest;
            this.m_curdevID = devID.ToString();
            this.tcDev.Controls.Add(this.tbDevice);
            this.propDev1.pageInit(pParent, devID, onlinest);
            if (deviceByID.GetPortInfo().Count > 0)
            {
                this.tcDev.Controls.Add(this.tbOutlet);
                this.propOutlet1.pageInit(devID, 0, onlinest);
            }
            if (deviceByID.GetBankInfo().Count > 0)
            {
                this.tcDev.Controls.Add(this.tbBank);
                this.propBank1.pageInit(devID, 0, onlinest);
            }
            if (deviceByID.GetLineInfo().Count > 0)
            {
                this.tcDev.Controls.Add(this.tbLine);
                this.propLine1.pageInit(devID, 0, onlinest);
            }
            if (deviceByID.GetSensorInfo().Count > 0)
            {
                this.tcDev.Controls.Add(this.tbSensor);
                this.propSensor1.pageInit(devID, onlinest);
            }
            if (DevAccessCfg.GetInstance().getDeviceModelConfig(deviceByID.ModelNm, deviceByID.FWVersion).popReading == 2)
            {
                this.tcDev.Controls.Add(this.tbPop);
                this.propPOP1.pageInit(devID, onlinest);
            }
            if (this.m_selectedTab == null || !this.tcDev.Contains(this.m_selectedTab))
            {
                this.m_selectedTab = this.tbDevice;
            }
            this.tcDev.SelectTab(this.m_selectedTab);
            this.m_ininit = false;
        }
Beispiel #18
0
        private bool bankCheck(DevModelConfig devcfg)
        {
            string text = this.tbBankNm.Text.Trim();

            this.tbBankNm.Text = text;
            string text2 = this.labBankNo.Text;
            int    num   = System.Convert.ToInt32(text2);
            bool   flag  = false;

            if (((ulong)devcfg.bankOpt_nameempty & (ulong)(1L << (num - 1 & 31))) != 0uL)
            {
                Ecovalidate.checkTextIsNull(this.tbBankNm, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbBankNm.Text
                    }));
                    this.tbBankNm.BackColor = Color.Red;
                    return(false);
                }
                this.tbBankNm.BackColor = Color.White;
            }
            if (this.gbThreshold.Visible)
            {
                flag = true;
                int num2 = devcfgUtil.UIThresholdEditFlg(devcfg, "bank");
                Ecovalidate.checkThresholdValue(this.tbOMinCurrent, this.labMaxPortCurrentBound, (num2 & 256) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMaxCurrent, this.labMaxPortCurrentBound, (num2 & 512) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMinVoltage, this.labMaxVoltageBound, (num2 & 1024) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMaxVoltage, this.labMaxVoltageBound, (num2 & 2048) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMinPower, this.labMaxPowerBound, (num2 & 4096) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMaxPower, this.labMaxPowerBound, (num2 & 8192) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMinPowerDiss, this.labMaxPowerDisBound, (num2 & 16384) == 0, ref flag);
                Ecovalidate.checkThresholdValue(this.tbOMaxPowerDiss, this.labMaxPowerDisBound, (num2 & 32768) == 0, ref flag);
                if (!flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_Thresholdinvalid, new string[0]));
                    return(false);
                }
                Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxCurrent, this.tbOMinCurrent, ref flag);
                Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxVoltage, this.tbOMinVoltage, ref flag);
                Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxPower, this.tbOMinPower, ref flag);
                Ecovalidate.checkThresholdMaxMixValue(this.tbOMaxPowerDiss, this.tbOMinPowerDiss, ref flag);
                if (!flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_ThresholdMinMax, new string[0]));
                    return(false);
                }
            }
            return(true);
        }
Beispiel #19
0
        private bool devConfigCheck()
        {
            string value     = this.labDevModel.Tag.ToString();
            string fmwareVer = this.labDevIp.Tag.ToString();

            System.Convert.ToInt32(value);
            DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(this.labDevModel.Text, fmwareVer);
            bool           flag = true;

            if (this.gbPop.Visible && this.cbPopEnable.Checked && this.rbPopUsrdef.Checked)
            {
                flag = false;
                Ecovalidate.checkTextIsNull(this.tbPopThreshold, ref flag);
                if (flag)
                {
                    this.tbPopThreshold.Focus();
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.rbPopUsrdef.Text
                    }));
                    return(false);
                }
                float num = 0f;
                try
                {
                    num = System.Convert.ToSingle(this.tbPopThreshold.Text);
                }
                catch (System.Exception)
                {
                    this.tbPopThreshold.Focus();
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_invalidNumber, new string[0]));
                    bool result = false;
                    return(result);
                }
                if (num > (float)deviceModelConfig.popUdefmax)
                {
                    this.tbPopThreshold.Focus();
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                    {
                        this.rbPopUsrdef.Text,
                        "0",
                        deviceModelConfig.popUdefmax.ToString()
                    }));
                    return(false);
                }
                return(true);
            }
            return(true);
        }
Beispiel #20
0
        private bool portparacheck(Label lb, TextBox tb, int Portindex)
        {
            bool flag = false;

            Ecovalidate.checkTextIsNull(tb, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    lb.Text
                }));
                return(false);
            }
            if (!Ecovalidate.Rangeint(tb, 1, 65535))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                {
                    lb.Text,
                    "1",
                    "65535"
                }));
                return(false);
            }
            int  port  = System.Convert.ToInt32(tb.Text);
            bool flag2 = false;

            switch (Portindex)
            {
            case 0:
            case 2:
            case 3:
                flag2 = NetworkShareAccesser.TcpPortInUse(port);
                break;

            case 1:
                flag2 = NetworkShareAccesser.UDPPortInUse(port);
                break;
            }
            if (flag2)
            {
                tb.Focus();
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                {
                    tb.Text
                }));
                return(false);
            }
            return(true);
        }
Beispiel #21
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            System.Collections.ArrayList allZone = ZoneInfo.getAllZone();
            if (allZone.Count >= EcoGlobalVar.gl_maxZoneNum)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Zone_MaxNum, new string[]
                {
                    EcoGlobalVar.gl_maxZoneNum.ToString()
                }));
                return;
            }
            ZoneInfoDlg zoneInfoDlg = new ZoneInfoDlg(this, -1L);

            zoneInfoDlg.ShowDialog(this);
        }
Beispiel #22
0
        private void butNew_Click(object sender, System.EventArgs e)
        {
            this.closetips();
            if (this.lbRack.Items.Count >= EcoGlobalVar.gl_maxRackNum)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_MaxNum, new string[]
                {
                    EcoGlobalVar.gl_maxRackNum.ToString()
                }));
                return;
            }
            RackInfoDlg rackInfoDlg = new RackInfoDlg(this, -1L);

            rackInfoDlg.ShowDialog(this);
        }
Beispiel #23
0
        private void btCfgRestore_Click(object sender, System.EventArgs e)
        {
            if (!DBMaintain.ConvertOldDataFinish)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0]));
                return;
            }
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbRestoreFile, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbRestoreFile.Text
                }));
                return;
            }
            if (!System.IO.File.Exists(this.tbRestoreFile.Text))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.File_unexist, new string[0]));
                this.tbRestoreFile.Focus();
                return;
            }
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DB_ConfigRestoreCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            Program.IdleTimer_Pause(1);
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Restorecfg, new string[0]), null, new progressPopup.ProcessInThread(this.RestorecfgPro), this.tbRestoreFile.Text, 0);

            progressPopup.ShowDialog();
            object return_V = progressPopup.Return_V;

            Program.IdleTimer_Run(1);
            int?num = return_V as int?;

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.quitEcoFailed, new string[0]));
                Program.ExitApp();
                return;
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.quitEcoSucc, new string[0]));
            Program.ExitApp();
        }
Beispiel #24
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");
        }
Beispiel #25
0
        private void btnDbExport_Click(object sender, System.EventArgs e)
        {
            if (!DBMaintain.ConvertOldDataFinish)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0]));
                return;
            }
            if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") && !DBMaintain.IsLocalIP(DBUrl.CURRENT_HOST_PATH))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBExportFail1, new string[0]));
                return;
            }
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbExportPath, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbExportPath.Text
                }));
                return;
            }
            if (!DBTools.CheckFreeSpaceSize4ExportDB(this.tbExportPath.Text))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBExportFail2, new string[0]));
                return;
            }
            Program.IdleTimer_Pause(1);
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_ExportDB, new string[0]), null, new progressPopup.ProcessInThread(this.dbExportPro), null, 0);

            progressPopup.ShowDialog();
            object return_V = progressPopup.Return_V;

            Program.IdleTimer_Run(1);
            int?num = return_V as int?;

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.quitEcoFailed, new string[0]));
                Program.ExitApp();
                return;
            }
            EcoMessageBox.ShowInfo(this, EcoLanguage.getMsg(LangRes.quitEcoSucc, new string[0]));
            Program.ExitApp();
        }
Beispiel #26
0
        private void butSave_Click(object sender, System.EventArgs e)
        {
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbZoneNm, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbZoneNm.Text
                }));
                return;
            }
            if (this.zoneNmExisted())
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Zone_nmdup, new string[]
                {
                    this.tbZoneNm.Text
                }));
                this.tbZoneNm.Focus();
                return;
            }
            if (this.colorExisted())
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Zone_colordup, new string[]
                {
                    this.tbZoneNm.Text
                }));
                return;
            }
            int num;

            if (this.m_zoneID == -1L)
            {
                num = this.m_parent2.addZone(this.tbZoneNm.Text, this.labColor.BackColor);
            }
            else
            {
                num = this.m_parent2.modifyZone(this.m_zoneID, this.tbZoneNm.Text, this.labColor.BackColor);
            }
            if (num == 1)
            {
                base.Close();
            }
        }
Beispiel #27
0
 private bool checkMove(string direction, int targetRow, int targetColumn, long oldRackID)
 {
     if (targetRow > this.dgvSetDevice.RowCount - 1)
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail1, new string[0]));
         return(false);
     }
     if (targetColumn > this.dgvSetDevice.ColumnCount - 1)
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail1, new string[0]));
         return(false);
     }
     if (this.checkPointHaveRack(targetRow, targetColumn, oldRackID))
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail2, new string[0]));
         return(false);
     }
     if (direction.Equals("H"))
     {
         if (targetColumn + 1 > this.dgvSetDevice.ColumnCount - 1)
         {
             EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail1, new string[0]));
             return(false);
         }
         if (this.checkPointHaveRack(targetRow, targetColumn + 1, oldRackID))
         {
             EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail2, new string[0]));
             return(false);
         }
     }
     else
     {
         if (targetRow + 1 > this.dgvSetDevice.RowCount - 1)
         {
             EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail1, new string[0]));
             return(false);
         }
         if (this.checkPointHaveRack(targetRow + 1, targetColumn, oldRackID))
         {
             EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Rack_Fail2, new string[0]));
             return(false);
         }
     }
     return(true);
 }
Beispiel #28
0
        private void btnSMBBrowse_Click(object sender, System.EventArgs e)
        {
            string text  = this.tbSMBUsername.Text;
            string text2 = this.tbSMBPsw.Text;

            if (text.Length > 0)
            {
                string arg_31_0 = this.tbSMBDir.Text;
                bool   flag     = false;
                Ecovalidate.checkTextIsNull(this.tbSMBDir, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbSMBDir.Text
                    }));
                    return;
                }
                string text3 = this.tbSMBDir.Text;
                string text4 = text3;
                while (text4.StartsWith("\\"))
                {
                    text4 = text4.Substring(1);
                }
                int num = text4.IndexOf('\\');
                if (num > 0)
                {
                    text4 = text4.Substring(0, num);
                }
                NetworkShareAccesser networkShareAccesser = NetworkShareAccesser.Access(text4, text, text2);
                if (networkShareAccesser.Result.Length > 0)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Task_Connectfailed, new string[0]));
                    return;
                }
            }
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.SelectedPath = this.tbSMBDir.Text;
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.tbSMBDir.Text = folderBrowserDialog.SelectedPath;
            }
        }
Beispiel #29
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);
        }
Beispiel #30
0
 private void butUpdate_Click(object sender, System.EventArgs e)
 {
     if (!this.check())
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
         return;
     }
     if (this.tbFileNm.Text.Equals(string.Empty))
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
         {
             this.lbFileNm.Text
         }));
         return;
     }
     this.cbMainFw.Enabled  = false;
     this.butBrowse.Enabled = false;
     this.butSearch.Enabled = false;
     this.butUpdate.Enabled = false;
     this.cbsel.Enabled     = false;
     System.Collections.Generic.List <FirmwareUpgrade> list = new System.Collections.Generic.List <FirmwareUpgrade>();
     for (int i = 0; i < this.dgvFwDevice.Rows.Count; i++)
     {
         DataGridViewRow dataGridViewRow = this.dgvFwDevice.Rows[i];
         DataGridViewDisableCheckBoxCell dataGridViewDisableCheckBoxCell = dataGridViewRow.Cells[0] as DataGridViewDisableCheckBoxCell;
         if (dataGridViewRow.Cells[0].Value != null && (bool)dataGridViewRow.Cells[0].Value)
         {
             list.Add(new FirmwareUpgrade
             {
                 FileName     = this.tbFileNm.Text,
                 CheckVersion = this.cbMainFw.Checked ? 1 : 0,
                 DevID        = System.Convert.ToInt32(dataGridViewRow.Cells["dgvtdevID"].Value.ToString()),
                 DevIP        = dataGridViewRow.Cells["dgvtbIp"].Value.ToString(),
                 httpPort     = dataGridViewRow.Cells["dgvtdevhttpPort"].Value.ToString()
             });
             dataGridViewRow.Cells["dgvtStatus"].Value = EcoLanguage.getMsg(LangRes.FrwUpgradeST_waiting, new string[0]);
         }
         dataGridViewDisableCheckBoxCell.Enabled  = false;
         dataGridViewDisableCheckBoxCell.ReadOnly = true;
     }
     this.dgvFwDevice.Update();
     this.dgvFwDevice.Focus();
     System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.ThreadFwUpgrade), list);
 }