Esempio n. 1
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]));
        }
Esempio n. 2
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");
        }
Esempio n. 3
0
        private void btnSearch_Click(object sender, System.EventArgs e)
        {
            string value;

            if (this.txtkey.TextLength != 0)
            {
                value = this.txtkey.Text.Trim();
            }
            else
            {
                value = null;
            }
            int num;

            if (this.rbInclude.Checked)
            {
                num = 1;
            }
            else
            {
                if (this.rbExclude.Checked)
                {
                    num = 2;
                }
                else
                {
                    num = 0;
                    this.dtpLogtimeFrom.Value = System.DateTime.Now;
                    this.dtpLogtimeTo.Value   = System.DateTime.Now;
                }
            }
            System.DateTime value2 = this.dtpLogtimeFrom.Value;
            System.DateTime value3 = this.dtpLogtimeTo.Value;
            LogSysLog.nTatalLogs   = 0;
            LogSysLog.nCurrentPage = 1;
            LogSysLog.nTotalPage   = 0;
            int rowCount = LogInfo.GetRowCount(num, value2, value3);

            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            arrayList.Add(value);
            arrayList.Add(num);
            arrayList.Add(value2);
            arrayList.Add(value3);
            DataTable dtab_logs;

            if (rowCount > 50000)
            {
                progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_searchLog, new string[0]), null, new progressPopup.ProcessInThread(this.searchLogProc), arrayList, 0);
                progressPopup.ShowDialog();
                object obj = progressPopup.Return_V;
                dtab_logs = (obj as DataTable);
            }
            else
            {
                object obj = this.searchLogProc(arrayList);
                dtab_logs = (obj as DataTable);
            }
            this.displayFoundLogs(dtab_logs);
        }
Esempio n. 4
0
        private void init_devTB()
        {
            this.dgvFwDevice.Rows.Clear();
            this.m_allRows         = null;
            this.m_allRows         = new System.Collections.Generic.List <string[]>();
            this.cbsel.Checked     = true;
            this.cbMainFw.Enabled  = false;
            this.butBrowse.Enabled = false;
            this.butUpdate.Enabled = false;
            this.cbsel.Enabled     = false;
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_FWupfinddev, new string[0]), null, new progressPopup.ProcessInThread(this.initFWDevProc), null, 0);

            progressPopup.ShowDialog();
        }
Esempio n. 5
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();
        }
Esempio n. 6
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");
        }
Esempio n. 7
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();
        }
Esempio n. 8
0
        public void pageInit()
        {
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_loading, new string[0]), null, new progressPopup.ProcessInThread(this.startThread_FirstTimegetData), null, 0);

            progressPopup.ShowDialog();
            if (this.m_dbsize.Length == 2)
            {
                this.cbdbtype.Visible = false;
            }
            else
            {
                this.cbdbtype.Visible       = true;
                this.cbdbtype.SelectedIndex = 0;
            }
            this.dbCapacityData_show();
            this.startDBcapTimer();
        }
Esempio n. 9
0
 private void btnsaveDB_Click(object sender, System.EventArgs e)
 {
     if (!this.DBparaCheck())
     {
         return;
     }
     if (!this.checkBoxUseMySQL.Checked)
     {
         DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DB_ChangeCrm, new string[0]), MessageBoxButtons.OKCancel);
         if (dialogResult == DialogResult.Cancel)
         {
             return;
         }
         AccessDBUpdate.InitAccessDataDB();
         DBUtil.ChangeDBSetting2Access();
         base.DialogResult = DialogResult.OK;
         return;
     }
     else
     {
         string   text  = this.tbDBIP.Text;
         int      num   = System.Convert.ToInt32(this.tbDBPort.Text);
         string   text2 = this.tbDBUsrnm.Text;
         string   text3 = this.tbDBPsw.Text;
         string[] param = new string[]
         {
             text,
             this.tbDBPort.Text,
             text2,
             text3
         };
         progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Checkdbconnect, new string[0]), null, new progressPopup.ProcessInThread(this.dbCheckParameter), param, 0);
         progressPopup.ShowDialog();
         object return_V = progressPopup.Return_V;
         int?   num2     = return_V as int?;
         if (!num2.HasValue)
         {
             num2 = new int?(DebugCenter.ST_Unknown);
         }
         if (num2 == DebugCenter.ST_Success)
         {
             DBUtil.ChangeDBSetting2MySQL(text, num, text2, text3, false);
             base.DialogResult = DialogResult.OK;
             return;
         }
         if (num2 == DebugCenter.ST_MYSQLCONNECT_ERROR || num2 == DebugCenter.ST_MYSQLAUTH_ERROR || num2 == DebugCenter.ST_Unknown)
         {
             EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.DB_Connectfail, new string[0]));
             return;
         }
         DialogResult dialogResult2 = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DBinitcrm_Master, new string[0]), MessageBoxButtons.OKCancel);
         if (dialogResult2 == DialogResult.Cancel)
         {
             return;
         }
         string dbname = "";
         int    num3   = DBMaintain.InitMySQLDatabase4Master(text, num, text2, text3, ref dbname);
         if (num3 > 0)
         {
             num3 = DBUtil.ChangeDBSetting2MySQL(dbname, text, num, text2, text3);
             if (num3 == 1)
             {
                 num3 = DebugCenter.ST_Success;
             }
         }
         if (num3 == DebugCenter.ST_Success)
         {
             base.DialogResult = DialogResult.OK;
             return;
         }
         EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
         return;
     }
 }
Esempio n. 10
0
        private static void showpro(bool showinTaskBar)
        {
            switch (EcoLanguage.getLang())
            {
            case 0:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                break;

            case 1:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("de");
                break;

            case 2:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("es");
                break;

            case 3:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("fr");
                break;

            case 4:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("it");
                break;

            case 5:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ja");
                break;

            case 6:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ko");
                break;

            case 7:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("pt");
                break;

            case 8:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ru");
                break;

            case 9:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CHS");
                break;

            case 10:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CHT");
                break;

            default:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                break;
            }
            progressPopup dlg = new progressPopup("eco Sensors", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_loading, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(EcoGlobalVar.waitstopshowPro), null, 0);

            dlg.StartPosition = FormStartPosition.CenterScreen;
            if (showinTaskBar)
            {
                Form form = new Form();
                form.Size          = new Size(1, 1);
                form.StartPosition = FormStartPosition.Manual;
                Rectangle virtualScreen = SystemInformation.VirtualScreen;
                form.Location = new Point(virtualScreen.Bottom + 10, virtualScreen.Right + 10);
                form.Icon     = Resources.altusen_32x32;


                form.Show();
                form.Focus();
                form.BringToFront();
                form.TopMost = true;
                dlg.Owner    = form;
            }
            ControlAccess.ConfigControl config = delegate(Control control, object obj)
            {
                dlg.ShowDialog();
            };
            ControlAccess controlAccess = new ControlAccess(dlg, config);

            controlAccess.Access(dlg, null);
        }
Esempio n. 11
0
        private void btnDbImport_Click(object sender, System.EventArgs e)
        {
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbImportFile, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbImportFile.Text
                }));
                return;
            }
            if (!System.IO.File.Exists(this.tbImportFile.Text))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.File_unexist, new string[0]));
                this.tbImportFile.Focus();
                return;
            }
            DBTools.ProgramBar_Percent = 1;
            progressPopup progressPopup = new progressPopup("Information", 2, EcoLanguage.getMsg(LangRes.PopProgressMsg_Checkfile, new string[0]), null, new progressPopup.ProcessInThread(this.dbCheckImportFile), this.tbImportFile.Text, new progressPopup.ProgramBarThread(this.dbCheckImportFileBar), 0);

            progressPopup.ShowDialog();
            object return_V = progressPopup.Return_V;
            string text     = return_V as string;

            if (text == null || text.Length == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.File_illegal, new string[0]));
                this.tbImportFile.Focus();
                return;
            }
            if (text.StartsWith("DISKSIZELOW"))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBImportFail2, new string[0]));
                this.tbImportFile.Focus();
                return;
            }
            if (text.StartsWith("UNZIP_ERROR"))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBunziperror, new string[0]));
                return;
            }
            string text2 = "MYSQLVERSIONERROR;";

            if (text.StartsWith(text2))
            {
                string text3 = text.Substring(text2.Length);
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.needHighVerMySQL, new string[]
                {
                    text3
                }));
                return;
            }
            if (text.StartsWith("DBVERSION_ERROR"))
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DBImportLowVerError, new string[0]));
                return;
            }
            if (text.StartsWith("MYSQL_CONNECT_ERROR"))
            {
                mysqlsetting mysqlsetting = new mysqlsetting(text);
                DialogResult dialogResult = mysqlsetting.ShowDialog();
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                string text4 = DBUtil.CheckMySQLVersion("127.0.0.1", mysqlsetting.DBPort, mysqlsetting.DBusrnm, mysqlsetting.DBPsw, mysqlsetting.mySQLVer);
                if (text4.Length > 0)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.needHighVerMySQL, new string[]
                    {
                        text4
                    }));
                    return;
                }
                string[] array = text.Split(new string[]
                {
                    ","
                }, System.StringSplitOptions.RemoveEmptyEntries);
                string text5 = array[5];
                text = string.Concat(new object[]
                {
                    "127.0.0.1,",
                    mysqlsetting.DBPort,
                    ",",
                    mysqlsetting.DBusrnm,
                    ",",
                    mysqlsetting.DBPsw,
                    ",",
                    text5,
                    ",RESET"
                });
            }
            DialogResult dialogResult2 = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DB_ChangeCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult2 == DialogResult.Cancel)
            {
                return;
            }
            DBTools.ProgramBar_Percent = 1;
            progressPopup = new progressPopup("Information", 2, EcoLanguage.getMsg(LangRes.PopProgressMsg_ImportDB, new string[0]), null, new progressPopup.ProcessInThread(this.dbImportPro), text, new progressPopup.ProgramBarThread(this.dbImportProBar), 0);
            progressPopup.ShowDialog();
            return_V = progressPopup.Return_V;
            int?num = return_V as int?;

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            base.DialogResult = DialogResult.OK;
        }
Esempio n. 12
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]));
     }
 }
Esempio n. 13
0
        private static int LocalConsole_cfg()
        {
            DebugCenter instance       = DebugCenter.GetInstance();
            int         lastStatusCode = instance.getLastStatusCode();

            if (lastStatusCode == DebugCenter.ST_Unknown)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFailUnknown, new string[]
                {
                    lastStatusCode.ToString("X4")
                }));
                Program.ExitApp();
                return(-1);
            }
            if (lastStatusCode == DebugCenter.ST_DiskFull)
            {
                if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.srvFailDiskFull, new string[0]), MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    Program.ExitApp();
                    return(-1);
                }
                progressPopup progressPopup = new progressPopup("Service Checker", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_startsrv, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(Program.StartService), null, 0);
                progressPopup.StartPosition = FormStartPosition.CenterScreen;
                progressPopup.ShowDialog();
                object return_V = progressPopup.Return_V;
                int?   num      = return_V as int?;
                if (num == -1 || num == -2)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                    Program.ExitApp();
                    return(-1);
                }
                return(-2);
            }
            else
            {
                if ((lastStatusCode & DebugCenter.ST_fatalMask) == 0)
                {
                    ServiceController serviceController = new ServiceController(EcoGlobalVar.gl_ServiceName);
                    if (serviceController.Status.Equals(ServiceControllerStatus.Stopped))
                    {
                        progressPopup progressPopup2 = new progressPopup("Service Checker", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_startsrv, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(Program.StartService), null, 0);
                        progressPopup2.StartPosition = FormStartPosition.CenterScreen;
                        progressPopup2.ShowDialog();
                        object return_V2 = progressPopup2.Return_V;
                        int?   num2      = return_V2 as int?;
                        if (num2 == -1 || num2 == -2)
                        {
                            EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                            Program.ExitApp();
                            return(-1);
                        }
                        return(-2);
                    }
                    else
                    {
                        if (!Program.isService_initfinish())
                        {
                            int num3 = Program.waitService_initfinish();
                            if (num3 == -2)
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                                Program.ExitApp();
                                return(-1);
                            }
                            return(-2);
                        }
                        else
                        {
                            if (lastStatusCode == DebugCenter.ST_Success)
                            {
                                return(0);
                            }
                            DBUrl.RUNMODE = 1;
                            DBCacheStatus.DBSyncEventInit(false);
                            DBCacheEventProcess.StartRefreshThread(false);
                            DBCache.DBCacheInit(false);
                            if ((lastStatusCode & DebugCenter.ST_MYSQLCONNECT_LOST) != 0)
                            {
                                string text = "Lost DB connection. Please check your MySQL database service.";
                                EcoMessageBox.ShowWarning(text, MessageBoxButtons.OK);
                            }
                            if (lastStatusCode == DebugCenter.ST_MYSQLCONNECT_LOST)
                            {
                                return(0);
                            }
                            registrySettings registrySettings = new registrySettings(lastStatusCode);
                            registrySettings.ShowDialog();
                            return(0);
                        }
                    }
                }
                else
                {
                    if (lastStatusCode == DebugCenter.ST_DbUpgrade || lastStatusCode == DebugCenter.ST_SysdbNotExist || lastStatusCode == DebugCenter.ST_LogdbNotExist || lastStatusCode == DebugCenter.ST_DatadbNotExist || lastStatusCode == DebugCenter.ST_SysdbNotMatch || lastStatusCode == DebugCenter.ST_ImportDatabase_ERROR)
                    {
                        restoredb    restoredb    = new restoredb(1);
                        DialogResult dialogResult = restoredb.ShowDialog();
                        if (dialogResult != DialogResult.OK)
                        {
                            commUtil.ShowInfo_DEBUG("restoredbdlg.ShowDialog() result is not DialogResult.OK!!!!!");
                        }
                    }
                    else
                    {
                        DBUrl.RUNMODE = 1;
                        registrySettings registrySettings = new registrySettings(lastStatusCode);
                        DialogResult     dialogResult2    = registrySettings.ShowDialog();
                        if (dialogResult2 != DialogResult.OK)
                        {
                            Program.ExitApp();
                            return(-1);
                        }
                    }
                    progressPopup progressPopup3 = new progressPopup("Service Checker", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_startsrv, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(Program.StartService), null, 0);
                    progressPopup3.StartPosition = FormStartPosition.CenterScreen;
                    progressPopup3.ShowDialog();
                    object return_V3 = progressPopup3.Return_V;
                    int?   num4      = return_V3 as int?;
                    if (num4 == -1 || num4 == -2)
                    {
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
                        Program.ExitApp();
                        return(-1);
                    }
                    return(-2);
                }
            }
        }
Esempio n. 14
0
        private void rmtbutLogin_Click(object sender, System.EventArgs e)
        {
            bool flag = false;

            this.m_forceClose = 0;
            try
            {
                Ecovalidate.checkTextIsNull(this.rmttbSrvIP, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.rmtlbSrvIP.Text
                    }));
                }
                else
                {
                    try
                    {
                        string text = IPAddress.Parse(this.rmttbSrvIP.Text).ToString();
                        this.rmttbSrvIP.Text = text;
                    }
                    catch (System.Exception)
                    {
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.IPFORMAT, new string[0]));
                        this.rmttbSrvIP.Focus();
                        return;
                    }
                    Ecovalidate.checkTextIsNull(this.rmttbSrvPort, ref flag);
                    if (flag)
                    {
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                        {
                            this.rmtlbSrvPort.Text
                        }));
                    }
                    else
                    {
                        if (!Ecovalidate.Rangeint(this.rmttbSrvPort, 1, 65535))
                        {
                            EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                            {
                                this.rmtlbSrvPort.Text,
                                "1",
                                "65535"
                            }));
                        }
                        else
                        {
                            if (this.rmttbusrnm.Text == "")
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_needname, new string[0]));
                                this.rmttbusrnm.Focus();
                            }
                            else
                            {
                                if (this.rmttbpsw.Text == "")
                                {
                                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_needpsw, new string[0]));
                                    this.rmttbpsw.Focus();
                                }
                                else
                                {
                                    ValuePairs.setValuePair("MasterIP", this.rmttbSrvIP.Text);
                                    string text2 = this.rmttbSrvPort.Text;
                                    ValuePairs.setValuePair("ServicePort", text2);
                                    ValuePairs.setValuePair("Username", this.rmttbusrnm.Text);
                                    System.Version version  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                                    string         serialNo = ValuePairs.getSerialNo(true);
                                    string         param    = string.Concat(new object[]
                                    {
                                        this.rmttbusrnm.Text,
                                        "\n",
                                        this.rmttbpsw.Text,
                                        "\n",
                                        version,
                                        "\nMaster\nRemote\n",
                                        serialNo
                                    });
                                    progressPopup progressPopup = new progressPopup("Login", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Login, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(this.checkAuth), param, 0);
                                    progressPopup.StartPosition = FormStartPosition.CenterScreen;
                                    progressPopup.ShowDialog();
                                    object return_V = progressPopup.Return_V;
                                    int?   num      = return_V as int?;
                                    if (num == -1)
                                    {
                                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvConnectFail, new string[0]));
                                        this.m_forceClose = -1;
                                        base.Close();
                                    }
                                    else
                                    {
                                        if (num == -2)
                                        {
                                            EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_loginfail, new string[0]));
                                        }
                                        else
                                        {
                                            if (num == -3)
                                            {
                                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_VerMismatch, new string[0]));
                                            }
                                            else
                                            {
                                                if (num == -4)
                                                {
                                                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_waitready, new string[0]));
                                                }
                                                else
                                                {
                                                    ValuePairs.setValuePair("MasterIP", this.rmttbSrvIP.Text);
                                                    ValuePairs.setValuePair("ServicePort", this.rmttbSrvPort.Text);
                                                    ValuePairs.SaveValueKeyToRegistry(false);
                                                    this.m_userName = this.rmttbusrnm.Text;
                                                    this.m_psw      = this.rmttbpsw.Text;
                                                    EcoLanguage.ChangeLang(this.rmtcbLang.SelectedIndex);
                                                    base.Close();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.m_forceClose = -1;
                base.Close();
            }
        }
Esempio n. 15
0
        private void butlogin_Click(object sender, System.EventArgs e)
        {
            this.m_forceClose = 0;
            try
            {
                if (this.tbuserId.Text == "")
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_needname, new string[0]));
                    this.tbuserId.Focus();
                }
                else
                {
                    if (this.tbpassword.Text == "")
                    {
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_needpsw, new string[0]));
                        this.tbpassword.Focus();
                    }
                    else
                    {
                        string text = "Standalone";
                        string interProcessKeyValue = InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .getInterProcessKeyValue("Listen_Port");

                        if (!string.IsNullOrEmpty(interProcessKeyValue) && System.Convert.ToInt32(interProcessKeyValue) != 0)
                        {
                            ValuePairs.setValuePair("ServicePort", interProcessKeyValue);
                        }
                        System.Version version  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                        string         serialNo = ValuePairs.getSerialNo(false);
                        string         param    = string.Concat(new object[]
                        {
                            this.tbuserId.Text,
                            "\n",
                            this.tbpassword.Text,
                            "\n",
                            version,
                            "\n",
                            text,
                            "\nLocal\n",
                            serialNo
                        });
                        progressPopup progressPopup = new progressPopup("User Login", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Login, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(this.checkAuth), param, 0);
                        progressPopup.StartPosition = FormStartPosition.CenterScreen;
                        progressPopup.ShowDialog();
                        object return_V = progressPopup.Return_V;
                        int?   num      = return_V as int?;
                        if (num == -1)
                        {
                            EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvConnectFail, new string[0]));
                            this.m_forceClose = -1;
                            base.Close();
                        }
                        else
                        {
                            if (num == -2)
                            {
                                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_loginfail, new string[0]));
                            }
                            else
                            {
                                if (num == -3)
                                {
                                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Login_VerMismatch, new string[0]));
                                }
                                else
                                {
                                    if (num == -4)
                                    {
                                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_waitready, new string[0]));
                                    }
                                    else
                                    {
                                        this.m_userName = this.tbuserId.Text;
                                        this.m_psw      = this.tbpassword.Text;
                                        EcoLanguage.ChangeLang(this.cbolanguage.SelectedIndex);
                                        base.Close();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.m_forceClose = -1;
                base.Close();
            }
        }
Esempio n. 16
0
        private bool paradbCheck()
        {
            bool flag = false;

            if (this.checkBoxUseMySQL.Checked)
            {
                if (this.tbIP.Text.Equals(string.Empty))
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.IPFORMAT, new string[0]));
                    this.tbIP.Focus();
                    this.tbIP.BackColor = Color.Red;
                    return(false);
                }
                try
                {
                    string text = IPAddress.Parse(this.tbIP.Text).ToString();
                    this.tbIP.Text = text;
                }
                catch (System.Exception)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.IPFORMAT, new string[0]));
                    this.tbIP.Focus();
                    this.tbIP.BackColor = Color.Red;
                    bool result = false;
                    return(result);
                }
                this.tbIP.BackColor = Color.White;
                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);
                }
                string[] param = new string[]
                {
                    this.tbIP.Text,
                    this.textBoxMySQLPort.Text,
                    this.textBoxMySQLUsername.Text,
                    this.textBoxMySQLPassword.Text
                };
                progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_Checkdbconnect, new string[0]), null, new progressPopup.ProcessInThread(this.dbCheckParameter), param, 0);
                progressPopup.ShowDialog();
                object return_V = progressPopup.Return_V;
                int?   num      = return_V as int?;
                if (!num.HasValue || num != DebugCenter.ST_Success)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_Connectfail, new string[0]));
                    return(false);
                }
                return(true);
            }
            return(true);
        }