Esempio n. 1
0
 private object delGateWayPro(object param)
 {
     System.Collections.ArrayList arrayList = param as System.Collections.ArrayList;
     for (int i = 0; i < arrayList.Count; i++)
     {
         string          text         = (string)arrayList[i];
         InSnergyGateway gateWaybyGID = InSnergyGateway.GetGateWaybyGID(text);
         int             num          = InSnergyGateway.DeleteGateway(text);
         if (num < 0)
         {
             return(num);
         }
         string valuePair = ValuePairs.getValuePair("Username");
         if (!string.IsNullOrEmpty(valuePair))
         {
             LogAPI.writeEventLog("0432011", new string[]
             {
                 gateWaybyGID.GatewayName,
                 valuePair
             });
         }
         else
         {
             LogAPI.writeEventLog("0432011", new string[]
             {
                 gateWaybyGID.GatewayName
             });
         }
         InSnergyService.Unmanage(text);
     }
     return(1);
 }
Esempio n. 2
0
        private void btnsaveopt_Click(object sender, System.EventArgs e)
        {
            if (!this.paraoptCheck())
            {
                return;
            }
            if (this.cbkeepdata.Checked)
            {
                Sys_Para.SetDBOpt_keepMMflag(1);
                int dBOpt_keepMM = System.Convert.ToInt32(this.tbkeepmonths.Text);
                Sys_Para.SetDBOpt_keepMM(dBOpt_keepMM);
            }
            else
            {
                Sys_Para.SetDBOpt_keepMMflag(0);
            }
            if (this.cbdelOlddata.Visible)
            {
                if (this.cbdelOlddata.Checked)
                {
                    Sys_Para.SetDBOpt_deloldflag(1);
                }
                else
                {
                    Sys_Para.SetDBOpt_deloldflag(0);
                }
            }
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0130020", new string[]
                {
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0130020", new string[0]);
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
        }
Esempio n. 3
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("");
        }
Esempio n. 4
0
        private void butSave_Click(object sender, System.EventArgs e)
        {
            if (!this.checkValue())
            {
                return;
            }
            string text = this.tbTaskName.Text;
            int    num;
            string text2;
            string text3;
            string text4;
            string text5;
            int    num2;

            if (this.rbStore_SMB.Checked)
            {
                num   = 2;
                text2 = this.tbSMBUsername.Text;
                text3 = this.tbSMBPsw.Text;
                text4 = this.tbSMBDir.Text;
                text5 = "";
                num2  = 0;
            }
            else
            {
                num   = 1;
                text5 = this.tbFTPServer.Text;
                num2  = System.Convert.ToInt32(this.tbFTPPort.Text);
                text4 = this.tbFTPDir.Text;
                if (this.cbFTPAuth.Checked)
                {
                    text2 = "";
                    text3 = this.tbFTPPsw.Text;
                }
                else
                {
                    text2 = this.tbFTPUsername.Text;
                    text3 = this.tbFTPPsw.Text;
                }
            }
            int num3;

            string[] array;
            if (this.cbTaskType.SelectedItem.Equals(this.m_TPDaily))
            {
                num3  = 0;
                array = new string[1];
                string text6 = this.dtPickerOnD00.Text;
                array[0] = text6 + ":00";
            }
            else
            {
                num3  = 1;
                array = new string[7];
                if (this.checkBoxOnW01.Checked)
                {
                    array[0] = this.dtPickerOnW01.Text + ":00";
                }
                else
                {
                    array[0] = "";
                }
                if (this.checkBoxOnW02.Checked)
                {
                    array[1] = this.dtPickerOnW02.Text + ":00";
                }
                else
                {
                    array[1] = "";
                }
                if (this.checkBoxOnW03.Checked)
                {
                    array[2] = this.dtPickerOnW03.Text + ":00";
                }
                else
                {
                    array[2] = "";
                }
                if (this.checkBoxOnW04.Checked)
                {
                    array[3] = this.dtPickerOnW04.Text + ":00";
                }
                else
                {
                    array[3] = "";
                }
                if (this.checkBoxOnW05.Checked)
                {
                    array[4] = this.dtPickerOnW05.Text + ":00";
                }
                else
                {
                    array[4] = "";
                }
                if (this.checkBoxOnW06.Checked)
                {
                    array[5] = this.dtPickerOnW06.Text + ":00";
                }
                else
                {
                    array[5] = "";
                }
                if (this.checkBoxOnW07.Checked)
                {
                    array[6] = this.dtPickerOnW07.Text + ":00";
                }
                else
                {
                    array[6] = "";
                }
            }
            int num4;

            if (this.m_taskID < 0L)
            {
                num4 = Backuptask.CreateTask(text, num3, num, text2, text3, text5, num2, text4, array);
                if (num4 > 0)
                {
                    string valuePair = ValuePairs.getValuePair("Username");
                    if (!string.IsNullOrEmpty(valuePair))
                    {
                        LogAPI.writeEventLog("0530000", new string[]
                        {
                            text,
                            valuePair
                        });
                    }
                    else
                    {
                        LogAPI.writeEventLog("0530000", new string[]
                        {
                            text
                        });
                    }
                }
            }
            else
            {
                Backuptask taskByID = Backuptask.GetTaskByID(this.m_taskID);
                taskByID.TaskName     = text;
                taskByID.TaskType     = num3;
                taskByID.STOREType    = num;
                taskByID.Host         = text5;
                taskByID.UserName     = text2;
                taskByID.Password     = text3;
                taskByID.Port         = num2;
                taskByID.Filepath     = text4;
                taskByID.TaskSchedule = array;
                num4 = taskByID.UpdateTask();
                if (num4 > 0)
                {
                    string valuePair2 = ValuePairs.getValuePair("Username");
                    if (!string.IsNullOrEmpty(valuePair2))
                    {
                        LogAPI.writeEventLog("0530002", new string[]
                        {
                            text,
                            valuePair2
                        });
                    }
                    else
                    {
                        LogAPI.writeEventLog("0530002", new string[]
                        {
                            text
                        });
                    }
                }
            }
            if (num4 < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            base.DialogResult = DialogResult.OK;
            base.Close();
        }
Esempio n. 5
0
        private void butSaveISGSetting_Click(object sender, System.EventArgs e)
        {
            int  iSGFlag     = Sys_Para.GetISGFlag();
            int  num         = 0;
            int  iSGPort     = Sys_Para.GetISGPort();
            int  num2        = iSGPort;
            int  iTPowerFlag = Sys_Para.GetITPowerFlag();
            int  num3        = iTPowerFlag;
            bool flag        = false;

            if (this.cbEnableISGateway.Checked)
            {
                num = 1;
                Ecovalidate.checkTextIsNull(this.tbISGServicePort, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbServicePort.Text
                    }));
                    return;
                }
                if (!Ecovalidate.Rangeint(this.tbISGServicePort, 1, 65535))
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                    {
                        this.lbServicePort.Text,
                        "1",
                        "65535"
                    }));
                    return;
                }
                num2 = System.Convert.ToInt32(this.tbISGServicePort.Text);
                if (iSGPort != num2)
                {
                    bool flag2 = NetworkShareAccesser.TcpPortInUse(num2);
                    if (flag2)
                    {
                        this.tbISGServicePort.Focus();
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                        {
                            this.tbISGServicePort.Text
                        }));
                        return;
                    }
                }
                if (!this.cbAtenPDU.Checked)
                {
                    num3 = 0;
                }
                else
                {
                    num3 = 1;
                }
            }
            Sys_Para.SetISGFlag(num);
            Sys_Para.SetISGPort(num2);
            Sys_Para.SetITPowerFlag(num3);
            if (iSGFlag != num || iSGPort != num2)
            {
                if (num == 0)
                {
                    InSnergyService.Restart(false, num2);
                }
                else
                {
                    InSnergyService.Restart(true, num2);
                }
            }
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0432000", new string[]
                {
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0432000", new string[0]);
            }
            if (iSGFlag != num || iTPowerFlag != num3)
            {
                EcoGlobalVar.setDashBoardFlg(32uL, "", 32);
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
        }