Пример #1
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]));
 }
Пример #2
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);
        }
Пример #3
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)
     {
     }
 }
Пример #4
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");
        }
Пример #5
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]));
        }
Пример #6
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();
        }
Пример #7
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);
        }
Пример #8
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]));
        }
Пример #9
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);
        }
Пример #10
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++;
            }
        }
Пример #11
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();
        }
Пример #12
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]));
            }
        }
Пример #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);
        }
Пример #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);
        }
Пример #15
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;
        }
Пример #16
0
 private void registrySettings_FormClosing(object sender, FormClosingEventArgs e)
 {
     if ((this.m_oldSrvStCode & DebugCenter.ST_fatalMask) == 0)
     {
         return;
     }
     if (base.DialogResult != DialogResult.OK && EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Login_quit, new string[0]), MessageBoxButtons.YesNo) == DialogResult.No)
     {
         e.Cancel = true;
     }
 }
Пример #17
0
 private void logout_LinkClicked(object sender, System.EventArgs e)
 {
     if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Login_quit, new string[0]), MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         this.Logout();
         ClientAPI.Logout();
         ClientAPI.StopBroadcastChannel();
         EcoGlobalVar.stopalltimer(true);
         Program.ExitApp();
     }
 }
Пример #18
0
 private void restoredb_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (base.DialogResult != DialogResult.OK && this.m_exitPara == 1)
     {
         if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Login_quit, new string[0]), MessageBoxButtons.YesNo) == DialogResult.No)
         {
             e.Cancel = true;
             return;
         }
         Program.ExitApp();
     }
 }
Пример #19
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Login_quit, new string[0]), MessageBoxButtons.YesNo) == DialogResult.No)
     {
         e.Cancel = true;
         return;
     }
     this.Logout();
     ClientAPI.StopBroadcastChannel();
     EcoGlobalVar.stopalltimer(true);
     Program.ExitApp();
 }
Пример #20
0
 private void btnPreview_Click(object sender, System.EventArgs e)
 {
     if (!this.m_isRPTSaved)
     {
         DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Rpt_notsaved, new string[0]), MessageBoxButtons.OKCancel);
         if (dialogResult == DialogResult.Cancel)
         {
             return;
         }
     }
     this.m_parent.showRpt(1, 0);
 }
Пример #21
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();
        }
Пример #22
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;
        }
Пример #23
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;
        }
Пример #24
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);
        }
Пример #25
0
        public void pageInit_1(EnegAnalysis parent)
        {
            this.m_parent                = parent;
            this.pbLoading.Visible       = false;
            this.btndel.Enabled          = true;
            this.btnAdd.Enabled          = true;
            this.dtptime.Value           = System.DateTime.Now;
            this.m_dtbeginlast           = this.dtptime.Value;
            this.cboperiod.SelectedIndex = 0;
            this.m_oldcboperiodindex     = this.cboperiod.SelectedIndex;
            float cO2KG = Sys_Para.GetCO2KG();

            if (cO2KG < 0f)
            {
                this.txtco2_elec.Text = "";
            }
            else
            {
                this.txtco2_elec.Text = cO2KG.ToString("F2");
            }
            float eLECTRICITYCOST = Sys_Para.GetELECTRICITYCOST();

            if (eLECTRICITYCOST < 0f)
            {
                this.txtprice_elec.Text = "";
            }
            else
            {
                this.txtprice_elec.Text = eLECTRICITYCOST.ToString("F2");
            }
            float cO2COST = Sys_Para.GetCO2COST();

            if (eLECTRICITYCOST < 0f)
            {
                this.txtprice_co2.Text = "";
            }
            else
            {
                this.txtprice_co2.Text = cO2COST.ToString("F2");
            }
            this.label39.Text = EcoGlobalVar.CurCurrency + this.m_ElecUnit;
            this.label2.Text  = EcoGlobalVar.CurCurrency + this.m_CO2Unit;
            this.FillgroupList();
            if (!DBTools.DatabaseIsReady())
            {
                EcoMessageBox.ShowInfo(this, EcoLanguage.getMsg(LangRes.DB_waitready, new string[0]));
                this.btnGen.Enabled = false;
                return;
            }
            this.btnGen.Enabled = true;
        }
Пример #26
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);
        }
Пример #27
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);
        }
Пример #28
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);
        }
Пример #29
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);
        }
Пример #30
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();
        }