Beispiel #1
0
        private void butOthDevicesDel_Click(object sender, System.EventArgs e)
        {
            if (this.dgvAllOtherDevices.SelectedRows.Count == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_needselect, new string[0]));
                return;
            }
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Dev_delCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < this.dgvAllOtherDevices.SelectedRows.Count; i++)
            {
                DataGridViewCellCollection cells = this.dgvAllOtherDevices.SelectedRows[i].Cells;
                string value = cells[4].Value.ToString();
                arrayList.Add(value);
            }
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_delDev, new string[0]), null, new progressPopup.ProcessInThread(this.delGateWayPro), arrayList, 0);

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

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
            this.changeTreeSelect("DevRoot");
        }
Beispiel #2
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;
        }
Beispiel #3
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;
     }
 }
Beispiel #4
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();
     }
 }
Beispiel #5
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();
     }
 }
Beispiel #6
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();
 }
Beispiel #7
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);
 }
Beispiel #8
0
        private void btCfgRestore_Click(object sender, System.EventArgs e)
        {
            if (!DBMaintain.ConvertOldDataFinish)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0]));
                return;
            }
            bool flag = false;

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

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

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

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

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.quitEcoFailed, new string[0]));
                Program.ExitApp();
                return;
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.quitEcoSucc, new string[0]));
            Program.ExitApp();
        }
Beispiel #9
0
 private void Login_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (this.m_userName != null)
     {
         return;
     }
     if (this.m_forceClose != 0)
     {
         this.m_userName = null;
         return;
     }
     if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Login_quit, new string[0]), MessageBoxButtons.YesNo) == DialogResult.No)
     {
         e.Cancel = true;
     }
 }
Beispiel #10
0
        private void butDevicesDel_Click(object sender, System.EventArgs e)
        {
            if (this.dgvAllDevices.SelectedRows.Count == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Dev_needselect, new string[0]));
                return;
            }
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Dev_delCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < this.dgvAllDevices.SelectedRows.Count; i++)
            {
                DataGridViewCellCollection cells = this.dgvAllDevices.SelectedRows[i].Cells;
                string value = cells["dgvtbcdeviceId"].Value.ToString();
                arrayList.Insert(0, value);
            }
            System.Collections.ArrayList allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty();
            Program.IdleTimer_Pause(1);
            progressPopup progressPopup = new progressPopup("Information", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_delDev, new string[0]), null, new progressPopup.ProcessInThread(this.delDevicePro), arrayList, 0);

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

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

            if (!num.HasValue || num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
            System.Collections.ArrayList allRack_NoEmpty2 = RackInfo.GetAllRack_NoEmpty();
            EcoGlobalVar.gl_DevManPage.FlushFlg_RackBoard = 1;
            if (allRack_NoEmpty.Count == allRack_NoEmpty2.Count)
            {
                EcoGlobalVar.setDashBoardFlg(526uL, "", 66);
            }
            else
            {
                EcoGlobalVar.setDashBoardFlg(526uL, "", 65);
            }
            EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
            this.changeTreeSelect("DevRoot");
        }
Beispiel #11
0
        private void btnDel_Click(object sender, System.EventArgs e)
        {
            if (this.grouplist.SelectedItems.Count <= 0)
            {
                return;
            }
            if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Group_delCfm, new string[0]), MessageBoxButtons.OKCancel).Equals(DialogResult.Cancel))
            {
                return;
            }
            string value = this.grouplist.SelectedItems[0].Tag.ToString().Split(new char[]
            {
                '|'
            })[0];
            string text  = this.grouplist.SelectedItems[0].SubItems[0].Text;
            string text2 = this.grouplist.SelectedItems[0].SubItems[1].Text;
            int    num   = GroupInfo.DeleteGroupByID((long)System.Convert.ToInt32(value));

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

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

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

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0430021", new string[]
                {
                    text,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0430021", new string[]
                {
                    text
                });
            }
            EcoGlobalVar.setDashBoardFlg(776uL, "", 64);
            this.treeMenuInit();
            this.zonerackInit();
            this.butAdd.Enabled = false;
            EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
        }
Beispiel #13
0
 private void btndel_Click(object sender, System.EventArgs e)
 {
     if (this.dgvwReport.SelectedRows.Count > 0)
     {
         if (EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.RptMng_delCrm, new string[0]), MessageBoxButtons.OKCancel).Equals(DialogResult.OK))
         {
             string text = this.dgvwReport.SelectedRows[0].Cells["ReportPath"].Value.ToString();
             string path = text.Substring(0, text.LastIndexOf('\\'));
             if (System.IO.Directory.Exists(path))
             {
                 try
                 {
                     System.IO.Directory.Delete(path, true);
                 }
                 catch
                 {
                     System.Console.WriteLine("Delete report fail,it is being used by another process");
                     EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                     return;
                 }
             }
             string sql = "delete from reportinfo where id=" + this.dgvwReport.SelectedRows[0].Cells[1].Value;
             int    num = DBTools.executeSql(sql);
             if (num > 0)
             {
                 EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
             }
             if (this.ShowAll)
             {
                 this.DataBind("");
                 return;
             }
             this.DataBind(this.cboby.SelectedIndex.ToString());
             return;
         }
     }
     else
     {
         EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
     }
 }
Beispiel #14
0
        private void dgvAllDevices_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = e.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }
            string value = this.dgvAllDevices.Rows[rowIndex].Cells["deviceId"].Value.ToString();

            if (!ClientAPI.IsDeviceOnline(System.Convert.ToInt32(value)))
            {
                DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Comm_devofflineCrm, new string[0]), MessageBoxButtons.OKCancel);
                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            this.m_devID      = System.Convert.ToInt32(value);
            base.DialogResult = DialogResult.OK;
        }
Beispiel #15
0
        private void butUserDel_Click(object sender, System.EventArgs e)
        {
            string       text         = this.dgvUserAll.CurrentRow.Cells[0].Value.ToString();
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.UsrInfo_delCrm, new string[0]), MessageBoxButtons.OKCancel);

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

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

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0330001", new string[]
                {
                    text,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0330001", new string[]
                {
                    text
                });
            }
            this.changeTreeSelect("");
        }
Beispiel #16
0
        private void butSel_Click(object sender, System.EventArgs e)
        {
            DataGridViewSelectedRowCollection selectedRows = this.dgvAllDevices.SelectedRows;

            if (selectedRows.Count <= 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
                return;
            }
            DataGridViewRow dataGridViewRow = selectedRows[0];
            string          value           = dataGridViewRow.Cells["deviceId"].Value.ToString();

            this.m_devID = System.Convert.ToInt32(value);
            if (!ClientAPI.IsDeviceOnline(this.m_devID))
            {
                DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Comm_devofflineCrm, new string[0]), MessageBoxButtons.OKCancel);
                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
            base.DialogResult = DialogResult.OK;
        }
Beispiel #17
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            string       value        = this.dataGridViewCfgTasks.CurrentRow.Cells[4].Value.ToString();
            long         i_taskid     = (long)System.Convert.ToInt32(value);
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Task_delCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            Backuptask taskByID = Backuptask.GetTaskByID(i_taskid);
            int        num      = Backuptask.DeleteTaskByID(i_taskid);

            if (num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0530001", new string[]
                {
                    taskByID.TaskName,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0530001", new string[]
                {
                    taskByID.TaskName
                });
            }
            this.pageInit();
        }
Beispiel #18
0
        private void btnsavedb_Click(object sender, System.EventArgs e)
        {
            if (!DBMaintain.ConvertOldDataFinish)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DB_inSplitMySQLTable, new string[0]));
                return;
            }
            bool   @checked = this.checkBoxUseMySQL.Checked;
            string dbIP     = "127.0.0.1";
            int    port     = 3306;
            string usrnm    = "";
            string psw      = "";
            bool   flag     = false;

            if (@checked && DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL"))
            {
                return;
            }
            if (!this.paradbCheck())
            {
                return;
            }
            if (@checked)
            {
                dbIP  = this.tbIP.Text;
                port  = System.Convert.ToInt32(this.textBoxMySQLPort.Text);
                usrnm = this.textBoxMySQLUsername.Text;
                psw   = this.textBoxMySQLPassword.Text;
            }
            if (!DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") && !@checked)
            {
                return;
            }
            if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") && @checked)
            {
                return;
            }
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.DB_ChangeCrm, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            int opt = 2;

            if (!flag)
            {
                long num = DBTools.EvaluateTime();
                if (num > 60L)
                {
                    dbchangeoptDlg dbchangeoptDlg = new dbchangeoptDlg();
                    DialogResult   dialogResult2  = dbchangeoptDlg.ShowDialog();
                    if (dialogResult2 != DialogResult.Yes)
                    {
                        opt = 1;
                    }
                }
            }
            dbchangeDlg dbchangeDlg = new dbchangeDlg(@checked, dbIP, port, usrnm, psw, opt);

            dbchangeDlg.ShowDialog();
            EcoMessageBox.ShowInfo(this, EcoLanguage.getMsg(LangRes.quitEco, new string[0]));
            Program.ExitApp();
        }
Beispiel #19
0
        private void butOff_Click(object sender, System.EventArgs e)
        {
            DataTable dataTable = (DataTable)this.dgvInfo.DataSource;

            System.Collections.Generic.List <DevSnmpConfig> list = new System.Collections.Generic.List <DevSnmpConfig>();
            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <int> > dictionary = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <int> >();
            this.m_parent.endTimer();
            DialogResult dialogResult;

            if (this.cbDReboot.Checked)
            {
                dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.OPCrm_reboot, new string[0]), MessageBoxButtons.OKCancel);
            }
            else
            {
                dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.OPCrm_off, new string[0]), MessageBoxButtons.OKCancel);
            }
            if (dialogResult == DialogResult.Cancel)
            {
                this.m_parent.starTimer();
                return;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                string text  = dataRow[0].ToString();
                string value = dataRow[3].ToString();
                if (dictionary.ContainsKey(text))
                {
                    System.Collections.Generic.List <int> list2 = dictionary[text];
                    list2.Add(System.Convert.ToInt32(value));
                }
                else
                {
                    dictionary.Add(text, new System.Collections.Generic.List <int>
                    {
                        System.Convert.ToInt32(value)
                    });
                }
            }
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            foreach (System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.List <int> > current in dictionary)
            {
                string text = current.Key;
                stringBuilder.Append(text + ",");
            }
            string text2 = stringBuilder.ToString();

            if (text2.Length > 1)
            {
                text2 = text2.Substring(0, text2.Length - 1);
            }
            System.Collections.Generic.List <DeviceInfo> list3 = (System.Collections.Generic.List <DeviceInfo>)ClientAPI.RemoteCall(7, 1, text2, 10000);
            if (list3 == null)
            {
                list3 = new System.Collections.Generic.List <DeviceInfo>();
            }
            foreach (DeviceInfo current2 in list3)
            {
                string        text     = current2.DeviceID.ToString();
                DevSnmpConfig sNMPpara = commUtil.getSNMPpara(current2);
                sNMPpara.groupOutlets = dictionary[text];
                list.Add(sNMPpara);
            }
            DevPortGroupAPI devPortGroupAPI = new DevPortGroupAPI(list);
            bool            flag;

            if (this.cbDReboot.Checked)
            {
                flag = devPortGroupAPI.RebootGroupOutlets();
            }
            else
            {
                flag = devPortGroupAPI.TurnOffGroupOutlets();
            }
            if (flag)
            {
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            }
            else
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
            this.m_parent.starTimer();
        }
Beispiel #20
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);
                }
            }
        }
Beispiel #21
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]));
     }
 }
Beispiel #22
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;
     }
 }
Beispiel #23
0
        private void butBankAssign_Click(object sender, System.EventArgs e)
        {
            bool   flag   = false;
            DBConn dBConn = null;
            string text   = this.labDevModel.Tag.ToString();

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