Exemplo n.º 1
0
        /// <summary>
        /// Renewal只对单表操作
        /// </summary>
        /// <param name="columns"></param>
        /// <returns> tuple的1是表字段,2为类属性</returns>
        private Tuple <List <String>, List <String> > ConvertHeader(List <ColumnRelevanceMapper> columns)
        {
            List <String> cols  = new List <String>();
            List <String> props = new List <String>();

            foreach (var column in columns)
            {
                String colName  = "";
                String propName = "";
                if (column.TableName != null)
                {
                    if (!ValuePairs.ContainsKey(column.ColumnName))
                    {
                        throw new ArgumentException("请传正确表字段");
                    }
                    colName  = ValuePairs[column.ColumnName].ColumnName;
                    propName = column.ColumnName;
                }
                else
                {
                    colName = column.ColumnName;
                }
                cols.Add(colName);
                props.Add(propName);
            }
            return(new Tuple <List <string>, List <string> >(cols, props));
        }
Exemplo n.º 2
0
        private void butSave_Click(object sender, System.EventArgs e)
        {
            bool flag = false;

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

            ValuePairs.setIdleTimeout(num, true);
            Program.m_IdleTimeSet = num * Program.m_IdleTimeFact;
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            base.DialogResult = DialogResult.OK;
            base.Close();
        }
Exemplo n.º 3
0
 private void butSaveISGDev_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.devConfigCheck())
         {
             string text = this.tbDevName.Text.Trim();
             if (InSnergyGateway.ModifyName(this.m_gatewayID, text) >= 0)
             {
                 string valuePair = ValuePairs.getValuePair("Username");
                 if (!string.IsNullOrEmpty(valuePair))
                 {
                     LogAPI.writeEventLog("0432012", new string[]
                     {
                         text,
                         valuePair
                     });
                 }
                 else
                 {
                     LogAPI.writeEventLog("0432012", new string[]
                     {
                         text
                     });
                 }
                 this.changeTreeSelect(this.m_gatewayID);
             }
         }
     }
     catch (System.Exception)
     {
     }
 }
Exemplo n.º 4
0
 public static void WriteLog(string format, params string[] list)
 {
     lock (DataWareHouse._lockLog)
     {
         if (!DataWareHouse.sCodebase.EndsWith("/") && !DataWareHouse.sCodebase.EndsWith("\\"))
         {
             DataWareHouse.sCodebase += "\\";
         }
         if (DataWareHouse._cfgFile == null)
         {
             DataWareHouse._logFile = "";
             DataWareHouse._cfgFile = ValuePairs.LoadValueKeyFromXML(DataWareHouse._xmlFile);
             if (DataWareHouse._cfgFile.ContainsKey("LogFile"))
             {
                 DataWareHouse._logFile = DataWareHouse._cfgFile["LogFile"];
             }
         }
         if (DataWareHouse._logFile != null && !(DataWareHouse._logFile == ""))
         {
             try
             {
                 string str = format;
                 if (list != null && list.Length > 0)
                 {
                     str = string.Format(format, list);
                 }
                 DateTime now  = DateTime.Now;
                 string   str2 = now.ToString("MM-dd HH:mm:ss.fff");
                 string   text = DataWareHouse.sCodebase + "\\debuglog\\" + DataWareHouse._logFile;
                 int      num  = text.LastIndexOf(".");
                 if (num >= 0)
                 {
                     text = text.Substring(0, num);
                 }
                 if (DBUtil.ServiceHandle != null)
                 {
                     text = text + "(" + now.ToString("yyyy-MM-dd") + ")s.log";
                 }
                 else
                 {
                     text = text + "(" + now.ToString("yyyy-MM-dd") + ")c.log";
                 }
                 using (StreamWriter streamWriter = File.AppendText(text))
                 {
                     if (DBUtil.ServiceHandle != null)
                     {
                         streamWriter.WriteLine(str2 + " [S] " + str, streamWriter);
                     }
                     else
                     {
                         streamWriter.WriteLine(str2 + " [-] " + str, streamWriter);
                     }
                 }
             }
             catch (Exception)
             {
             }
         }
     }
 }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
0
        public IdleTmDlg()
        {
            this.InitializeComponent();
            this.tbIdleTimeOut.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip;
            int idleTimeout = ValuePairs.getIdleTimeout(true);

            this.tbIdleTimeOut.Text = System.Convert.ToString(idleTimeout);
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
 public bool ContainsKey(Position p)
 {
     if (ValuePairs.ContainsKey(p))
     {
         CurrentCotainsKeyColor  = ValuePairs[p].Isblack;
         CurrentCotainsDirection = ValuePairs[p].Direction;
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
        public bool addRack(int column, int row, string direction, string rackNm, string rackFNm)
        {
            if (!this.checkMove(direction, row, column, -1L))
            {
                return(false);
            }
            int i_ex;
            int i_ey;

            if (direction.Equals("H"))
            {
                i_ex = row;
                i_ey = column + 1;
            }
            else
            {
                i_ex = row + 1;
                i_ey = column;
            }
            long   num       = RackInfo.CreateRackInfo(rackNm, "", row, column, i_ex, i_ey, rackFNm);
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0430010", new string[]
                {
                    rackNm,
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0430010", new string[]
                {
                    rackNm
                });
            }
            this.initRackList();
            bool flag = commDev.updateZoneforRack(this.m_MapID2Rack[num]);

            this.addRackUI(column, row, direction, rackNm, "", num);
            RackInfo rackInfo = this.m_MapID2Rack[num];

            this.lbRack.SelectedItem = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
            ulong num2      = 516uL;
            int   appAction = 0;

            if (flag)
            {
                num2 |= 264uL;
            }
            EcoGlobalVar.setDashBoardFlg(num2, "", appAction);
            return(true);
        }
Exemplo n.º 10
0
 public ValueGroupType(EnumData enumData, bool constant) : base(enumData.CodeName)
 {
     Constant = constant;
     EnumData = enumData;
     foreach (EnumMember member in enumData.Members)
     {
         EnumValuePair newPair = new EnumValuePair(member, constant, this);
         ValuePairs.Add(newPair);
         Scope.AddNativeVariable(newPair);
     }
 }
Exemplo n.º 11
0
 public static void WriteLine(string format, params string[] list)
 {
     lock (Common._lockLog)
     {
         if (Common._cfgFile == null)
         {
             Common._logFile = "";
             Common._cfgFile = ValuePairs.LoadValueKeyFromXML(Common._xmlFile);
             if (Common._cfgFile.ContainsKey("LogFile"))
             {
                 Common._logFile = Common._cfgFile["LogFile"];
             }
         }
         if (Common._logFile != null && !(Common._logFile == ""))
         {
             try
             {
                 string   str  = string.Format(format, list);
                 DateTime now  = DateTime.Now;
                 string   str2 = now.ToString("MM-dd HH:mm:ss.fff");
                 string   text = Common.sCodebase + "\\debuglog\\" + Common._logFile;
                 int      num  = text.LastIndexOf(".");
                 if (num >= 0)
                 {
                     text = text.Substring(0, num);
                 }
                 if (DispatchAPI.IsServerRole())
                 {
                     text = text + "(" + now.ToString("yyyy-MM-dd") + ")s.log";
                 }
                 else
                 {
                     text = text + "(" + now.ToString("yyyy-MM-dd") + ")c.log";
                 }
                 using (StreamWriter streamWriter = File.AppendText(text))
                 {
                     if (DispatchAPI.IsServerRole())
                     {
                         streamWriter.WriteLine(str2 + " [S] " + str, streamWriter);
                     }
                     else
                     {
                         streamWriter.WriteLine(str2 + " [-] " + str, streamWriter);
                     }
                 }
             }
             catch (Exception)
             {
             }
         }
     }
 }
Exemplo n.º 12
0
        public static int writeEventLog(string logKey, params string[] logPrar)
        {
            ValuePairs.getValuePair("uid");
            ValuePairs.getValuePair("Username");
            int num    = 1;
            int result = LogAPI.processNewLog(ref num, logKey, logPrar);

            if (num > 0)
            {
                result = LogAPI.emailNewLog(logKey, logPrar);
            }
            return(result);
        }
Exemplo n.º 13
0
 private static void IdleTimer_init()
 {
     if (Program.m_IdleTimer == null)
     {
         Program.m_IdleTimer           = new System.Timers.Timer();
         Program.m_IdleTimer.Elapsed  += new ElapsedEventHandler(Program.theIdleTimeout);
         Program.m_IdleTimer.Interval  = 10000.0;
         Program.m_IdleTimer.AutoReset = true;
         Program.m_IdleCounter         = 0;
         Program.m_IdleTimeSet         = ValuePairs.getIdleTimeout(true);
         Program.m_IdleTimeSet        *= Program.m_IdleTimeFact;
         Program.m_IdleTimer.Start();
     }
 }
Exemplo n.º 14
0
                public void ToStream(XmlWriter s,
                                     Managers.TagManager tag, TI.Definition owner)
                {
                    s.WriteStartElement("entry");

                    if (!Title.Handle.IsNull)
                    {
                        s.WriteAttributeString("titleId", Title.ToString());
                    }
                    if (!Description.Handle.IsNull)
                    {
                        s.WriteAttributeString("descId", Description.ToString());
                    }
                    if (Unknown20 != 0)
                    {
                        s.WriteAttributeString("settingCategory", Unknown20.ToString());
                        if (!SettingCategories.ContainsKey(Unknown20.Value))
                        {
                            string title   = Title.ToString();
                            string tagname = null;

                            if (!Settings.Datum.IsNull)
                            {
                                tagname = Settings.GetTagPath();
                            }
                            else if (!Template.Datum.IsNull)
                            {
                                tagname = Template.GetTagPath();
                            }

                            SettingCategories[Unknown20.Value] = new CategoryInfo(title, tagname);
                        }
                    }

                    if (!Settings.Datum.IsNull)
                    {
                        s.WriteElementString("settings", Settings.GetTagPath());
                    }
                    if (!Template.Datum.IsNull)
                    {
                        s.WriteElementString("template", Template.GetTagPath());
                    }
                    if (!ValuePairs.Datum.IsNull)
                    {
                        s.WriteElementString("values", ValuePairs.GetTagPath());
                    }

                    s.WriteEndElement();
                }
Exemplo n.º 15
0
        private void Socket_OnDataPairs(MessGet data)
        {
            // save
            pairs = (data as MessGetPairs)?.Value;

            // load markets
            try
            {
                this.BeginInvoke((Action)(() => {
                    lbMarkets.Items.Clear();
                    lbMarkets.Items.AddRange(pairs.Data.Keys.ToArray());
                }));
            }
            catch { }
        }
Exemplo n.º 16
0
        public Login()
        {
            this.InitializeComponent();
            this.tbuserId.ContextMenuStrip   = EcoGlobalVar.nullcontextMenuStrip;
            this.tbpassword.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip;
            this.cbolanguage.Items.Clear();
            this.rmtcbLang.Items.Clear();
            for (int i = 0; i < EcoLanguage.strLang.Length; i++)
            {
                this.cbolanguage.Items.Add(EcoLanguage.strLang[i]);
                this.rmtcbLang.Items.Add(EcoLanguage.strLang[i]);
            }
            this.cbolanguage.SelectedIndex = 0;
            this.rmtcbLang.SelectedIndex   = 0;
            string text = DevAccessCfg.GetInstance().getVersion();

            if (text.Length > 0)
            {
                text = " (" + text + ")";
            }
            else
            {
                System.Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                text = string.Concat(new string[]
                {
                    " (V",
                    version.Major.ToString(),
                    ".",
                    version.Minor.ToString(),
                    ".",
                    version.Build.ToString("000"),
                    ".",
                    version.Revision.ToString("000"),
                    ")"
                });
            }
            this.Text += text;
            if (EcoGlobalVar.ECOAppRunMode == 1)
            {
                this.panelRemote.Visible = false;
                ValuePairs.setValuePair("MasterIP", "127.0.0.1");
                return;
            }
            this.panelLocal.Visible = false;
            this.lbSetting.Visible  = false;
            this.rmttbSrvIP.Text    = ValuePairs.getValuePair("MasterIP");
            this.rmttbSrvPort.Text  = ValuePairs.getValuePair("ServicePort");
        }
Exemplo n.º 17
0
        private object delDevicePro(object param)
        {
            int num = 1;

            System.Collections.ArrayList arrayList = param as System.Collections.ArrayList;
            DBConn connection = DBConnPool.getConnection();

            for (int i = 0; i < arrayList.Count; i++)
            {
                string     value      = (string)arrayList[i];
                DeviceInfo deviceByID = DeviceOperation.getDeviceByID(System.Convert.ToInt32(value));
                int        num2       = DeviceOperation.DeleteDeviceByID(connection, System.Convert.ToInt32(value));
                if (num2 < 0)
                {
                    num = num2;
                }
                else
                {
                    string valuePair = ValuePairs.getValuePair("Username");
                    if (!string.IsNullOrEmpty(valuePair))
                    {
                        LogAPI.writeEventLog("0430001", new string[]
                        {
                            deviceByID.ModelNm,
                            deviceByID.Mac,
                            deviceByID.DeviceIP,
                            deviceByID.DeviceName,
                            valuePair
                        });
                    }
                    else
                    {
                        LogAPI.writeEventLog("0430001", new string[]
                        {
                            deviceByID.ModelNm,
                            deviceByID.Mac,
                            deviceByID.DeviceIP,
                            deviceByID.DeviceName
                        });
                    }
                }
            }
            connection.Close();
            DeviceOperation.RefreshDBCache(false);
            DeviceOperation.StartDBCleanupThread();
            return(num);
        }
Exemplo n.º 18
0
 private void otherDevSave(System.Collections.Generic.List <System.Collections.Hashtable> list)
 {
     foreach (System.Collections.Hashtable current in list)
     {
         string str_ip   = (string)current["ip"];
         string text     = (string)current["devNm"];
         string str_type = (string)current["type"];
         string text2    = (string)current["devID"];
         int    i_usage  = 0;
         System.Collections.Generic.List <Branch> list2      = new System.Collections.Generic.List <Branch>();
         System.Collections.Generic.List <string> branchList = InSnergyService.GetBranchList(text2);
         foreach (string current2 in branchList)
         {
             System.Collections.Generic.List <SubMeter> list3 = new System.Collections.Generic.List <SubMeter>();
             Branch item = new Branch(text2, current2, "", "", list3);
             list2.Add(item);
             System.Collections.Generic.List <string> meterList = InSnergyService.GetMeterList(text2, current2);
             foreach (string current3 in meterList)
             {
                 SubMeter item2 = new SubMeter(text2, current2, current3, "", 0f, i_usage);
                 list3.Add(item2);
             }
         }
         InSnergyGateway inSnergyGateway = new InSnergyGateway(text2, text, str_type, str_ip, list2);
         if (inSnergyGateway.Insert() > 0)
         {
             string valuePair = ValuePairs.getValuePair("Username");
             if (!string.IsNullOrEmpty(valuePair))
             {
                 LogAPI.writeEventLog("0432010", new string[]
                 {
                     text,
                     valuePair
                 });
             }
             else
             {
                 LogAPI.writeEventLog("0432010", new string[]
                 {
                     text
                 });
             }
             InSnergyService.Manage(text2);
         }
     }
 }
Exemplo n.º 19
0
        public int modifyZone(long zoneID, string zoneNm, Color color)
        {
            ZoneInfo zoneByID = ZoneInfo.getZoneByID(zoneID);

            zoneByID.ZoneName  = zoneNm;
            zoneByID.ZoneColor = color.ToArgb().ToString();
            int result = zoneByID.UpdateZone();

            switch (result)
            {
            case -2:
            case -1:
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                break;

            case 1:
            {
                string valuePair = ValuePairs.getValuePair("Username");
                if (!string.IsNullOrEmpty(valuePair))
                {
                    LogAPI.writeEventLog("0430022", new string[]
                        {
                            zoneNm,
                            valuePair
                        });
                }
                else
                {
                    LogAPI.writeEventLog("0430022", new string[]
                        {
                            zoneNm
                        });
                }
                EcoGlobalVar.setDashBoardFlg(256uL, "", 0);
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                this.treeMenuInit();
                this.treeMenuSelect(zoneNm);
                this.butAdd.Enabled = false;
                EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
                break;
            }
            }
            return(result);
        }
        public ValueGroupType(EnumData enumData, bool constant) : base(enumData.CodeName)
        {
            Scope     = new Scope("enum " + Name);
            Constant  = constant;
            EnumData  = enumData;
            TokenType = TokenType.Enum;

            if (constant)
            {
                TokenModifiers.Add(TokenModifier.Readonly);
            }

            foreach (EnumMember member in enumData.Members)
            {
                EnumValuePair newPair = new EnumValuePair(member, constant, this);
                ValuePairs.Add(newPair);
                Scope.AddNativeVariable(newPair);
            }
        }
Exemplo n.º 21
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;
        }
Exemplo n.º 22
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]));
        }
Exemplo n.º 23
0
        public bool FlipColor(Position p, Direction newdirection)
        {
            bool IsBlack = true;

            if (ValuePairs.ContainsKey(p))
            {
                //FlipColor
                var direction = ValuePairs[p].Direction;
                var Isblack   = !ValuePairs[p].Isblack;

                ValuePairs[p] = new TrakerFields(Isblack, direction);
                IsBlack       = ValuePairs[p].Isblack;
            }
            else
            {
                Add(p, isBlack: IsBlack, newdirection);
            }

            return(IsBlack);
        }
Exemplo n.º 24
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("");
        }
Exemplo n.º 25
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();
        }
Exemplo n.º 26
0
 public registrySettings(int SrvStCode)
 {
     this.InitializeComponent();
     this.m_oldSrvStCode                 = SrvStCode;
     this.tbDBIP.ContextMenuStrip        = EcoGlobalVar.nullcontextMenuStrip;
     this.tbDBPort.ContextMenuStrip      = EcoGlobalVar.nullcontextMenuStrip;
     this.tbDBUsrnm.ContextMenuStrip     = EcoGlobalVar.nullcontextMenuStrip;
     this.tbDBPsw.ContextMenuStrip       = EcoGlobalVar.nullcontextMenuStrip;
     this.tbManagerPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip;
     this.tbTrapPort.ContextMenuStrip    = EcoGlobalVar.nullcontextMenuStrip;
     this.tbBillingPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip;
     this.tbGatewayPort.ContextMenuStrip = EcoGlobalVar.nullcontextMenuStrip;
     this.tcLoginSettings.Controls.Clear();
     if ((SrvStCode & DebugCenter.ST_fatalMask) != 0)
     {
         string text = "";
         if (SrvStCode == DebugCenter.ST_SevsPortNA)
         {
             this.tcLoginSettings.Controls.Add(this.tpPortsetting);
             this.lbManagerPort.Visible = true;
             this.tbManagerPort.Visible = true;
             this.lbTrapPort.Visible    = false;
             this.tbTrapPort.Visible    = false;
             this.lbBillingPort.Visible = false;
             this.tbBillingPort.Visible = false;
             this.lbGatewayPort.Visible = false;
             this.tbGatewayPort.Visible = false;
             this.tbManagerPort.Text    = ValuePairs.getValuePair("ServicePort");
         }
         DBUrl.initconfig();
         if (SrvStCode == DebugCenter.ST_MYSQLCONNECT_ERROR)
         {
             text = "MySQL database connection failure (error code: " + SrvStCode.ToString("X4") + "). Please check your settings and try again.";
         }
         if (SrvStCode == DebugCenter.ST_MYSQLAUTH_ERROR)
         {
             text = "MySQL database authentication failure (error code: " + SrvStCode.ToString("X4") + "). Please check your settings and try again.";
         }
         if (SrvStCode == DebugCenter.ST_MYSQLNotExist || SrvStCode == DebugCenter.ST_MYSQLSIDNotMatch || SrvStCode == DebugCenter.ST_MYSQLREPAIR_ERROR)
         {
             text = "MySQL database fatal error (error code: " + SrvStCode.ToString("X4") + "). Please try either restore database, or use Access (by uncheck \"Use MySQL database\") instead.";
         }
         if (text.Length > 0)
         {
             this.tcLoginSettings.Controls.Add(this.tpdatabase);
             this.lbDBMsg.Text             = text;
             this.checkBoxUseMySQL.Checked = true;
             this.tbDBIP.Text    = "127.0.0.1";
             this.tbDBPort.Text  = DBUrl.CURRENT_PORT.ToString();
             this.tbDBUsrnm.Text = DBUrl.CURRENT_USER_NAME;
             this.tbDBPsw.Text   = DBUrl.CURRENT_PWD;
         }
         return;
     }
     this.tcLoginSettings.Controls.Add(this.tpPortsetting);
     this.lbManagerPort.Visible = false;
     this.tbManagerPort.Visible = false;
     this.m_pSyspara            = new Sys_Para();
     if ((SrvStCode & DebugCenter.ST_TrapPortNA) != 0)
     {
         this.lbTrapPort.Visible = true;
         this.tbTrapPort.Visible = true;
         this.tbTrapPort.Text    = System.Convert.ToString(this.m_pSyspara.TrapPort);
     }
     else
     {
         this.lbTrapPort.Visible = false;
         this.tbTrapPort.Visible = false;
     }
     if ((SrvStCode & DebugCenter.ST_BillingPortNA) != 0)
     {
         this.lbBillingPort.Visible = true;
         this.tbBillingPort.Visible = true;
         this.tbBillingPort.Text    = System.Convert.ToString(Sys_Para.GetBPPort());
     }
     else
     {
         this.lbBillingPort.Visible = false;
         this.tbBillingPort.Visible = false;
     }
     if ((SrvStCode & DebugCenter.ST_GateWayPortNA) != 0)
     {
         this.lbGatewayPort.Visible = true;
         this.tbGatewayPort.Visible = true;
         this.tbGatewayPort.Text    = System.Convert.ToString(Sys_Para.GetISGPort());
         return;
     }
     this.lbGatewayPort.Visible = false;
     this.tbGatewayPort.Visible = false;
 }
Exemplo n.º 27
0
        public int addZone(string zoneNm, Color color)
        {
            string text = "";
            int    num  = System.Math.Min(this.zonedef_startR, this.zonedef_endR);
            int    num2 = System.Math.Max(this.zonedef_startR, this.zonedef_endR);
            int    num3 = System.Math.Min(this.zonedef_startC, this.zonedef_endC);
            int    num4 = System.Math.Max(this.zonedef_startC, this.zonedef_endC);

            for (int i = num; i <= num2; i++)
            {
                for (int j = num3; j <= num4; j++)
                {
                    DataGridViewSpanCell dataGridViewSpanCell = (DataGridViewSpanCell)this.dgvSetDevice.Rows[i].Cells[j];
                    if (dataGridViewSpanCell.GetRowSpan() != 0 || dataGridViewSpanCell.GetColumnSpan() != 0)
                    {
                        string str = dataGridViewSpanCell.Tag.ToString();
                        text = text + str + ",";
                    }
                }
            }
            text = commUtil.uniqueIDs(text);
            if (text.Length > 0)
            {
                text = text.Substring(0, text.Length - 1);
            }
            this.zonedef_cancel();
            int result = ZoneInfo.CreateZoneInfo(zoneNm, text, num, num3, num2, num4, color.ToArgb().ToString());

            switch (result)
            {
            case -2:
            case -1:
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                break;

            case 1:
            {
                string valuePair = ValuePairs.getValuePair("Username");
                if (!string.IsNullOrEmpty(valuePair))
                {
                    LogAPI.writeEventLog("0430020", new string[]
                        {
                            zoneNm,
                            valuePair
                        });
                }
                else
                {
                    LogAPI.writeEventLog("0430020", new string[]
                        {
                            zoneNm
                        });
                }
                EcoGlobalVar.setDashBoardFlg(256uL, "", 0);
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                this.treeMenuInit();
                this.treeMenuSelect(zoneNm);
                this.butAdd.Enabled = false;
                EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
                break;
            }
            }
            return(result);
        }
Exemplo n.º 28
0
        public bool modifyRack(long rackId, int column, int row, string direction, string rackOrigNm, string rackFuNm)
        {
            RackInfo rackByID = RackInfo.getRackByID(rackId);

            if (rackByID == null)
            {
                return(true);
            }
            if (!this.checkMove(direction, row, column, rackId))
            {
                return(false);
            }
            string devIDs = this.delRackUi(rackId);
            int    num;
            int    num2;

            if (direction.Equals("H"))
            {
                num  = row;
                num2 = column + 1;
            }
            else
            {
                num  = row + 1;
                num2 = column;
            }
            bool flag  = false;
            bool flag2 = false;

            if (!rackByID.OriginalName.Equals(rackOrigNm) || !rackByID.RackFullName.Equals(rackFuNm))
            {
                flag = true;
            }
            if (rackByID.StartPoint_X != row || rackByID.StartPoint_Y != column || rackByID.EndPoint_X != num || rackByID.EndPoint_Y != num2)
            {
                flag2 = true;
            }
            rackByID.OriginalName = rackOrigNm;
            rackByID.RackFullName = rackFuNm;
            rackByID.StartPoint_X = row;
            rackByID.StartPoint_Y = column;
            rackByID.EndPoint_X   = num;
            rackByID.EndPoint_Y   = num2;
            rackByID.UpdateRack();
            this.addRackUI(column, row, direction, rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag), devIDs, rackId);
            string valuePair = ValuePairs.getValuePair("Username");

            if (!string.IsNullOrEmpty(valuePair))
            {
                LogAPI.writeEventLog("0430012", new string[]
                {
                    rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag),
                    valuePair
                });
            }
            else
            {
                LogAPI.writeEventLog("0430012", new string[]
                {
                    rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag)
                });
            }
            bool flag3 = false;

            if (flag2)
            {
                flag3 = commDev.updateZoneforRack(rackByID);
            }
            EcoGlobalVar.gl_DevManPage.FlushFlg_ZoneBoard = 1;
            ulong num3 = 4uL;
            int   num4 = 0;

            if (flag3)
            {
                num3 |= 264uL;
                num4 |= 64;
            }
            if (flag2)
            {
                EcoGlobalVar.setDashBoardFlg(num3, "", num4 | 1);
            }
            else
            {
                if (flag)
                {
                    EcoGlobalVar.setDashBoardFlg(num3, "", num4);
                }
            }
            this.initRackList();
            this.lbRack.SelectedItem = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
            return(true);
        }
Exemplo n.º 29
0
        private void btnsavePort_Click(object sender, System.EventArgs e)
        {
            if (!this.tbManagerPort.Visible)
            {
                int num  = 0;
                int num2 = 0;
                int num3 = 0;
                if (this.tbTrapPort.Visible)
                {
                    if (!this.portparacheck(this.lbTrapPort, this.tbTrapPort, 1))
                    {
                        return;
                    }
                    num = System.Convert.ToInt32(this.tbTrapPort.Text);
                }
                if (this.tbBillingPort.Visible)
                {
                    if (!this.portparacheck(this.lbBillingPort, this.tbBillingPort, 3))
                    {
                        return;
                    }
                    num2 = System.Convert.ToInt32(this.tbBillingPort.Text);
                    if (num2 == num)
                    {
                        this.tbBillingPort.Focus();
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                        {
                            this.tbBillingPort.Text
                        }));
                        return;
                    }
                }
                if (this.tbGatewayPort.Visible)
                {
                    if (!this.portparacheck(this.lbGatewayPort, this.tbGatewayPort, 2))
                    {
                        return;
                    }
                    num3 = System.Convert.ToInt32(this.tbGatewayPort.Text);
                    if (num3 == num || num3 == num2)
                    {
                        this.tbGatewayPort.Focus();
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                        {
                            this.tbGatewayPort.Text
                        }));
                        return;
                    }
                }
                if (this.tbTrapPort.Visible)
                {
                    new Sys_Para
                    {
                        TrapPort = num
                    }.update();
                    string valuePair = ValuePairs.getValuePair("Username");
                    if (!string.IsNullOrEmpty(valuePair))
                    {
                        LogAPI.writeEventLog("0130022", new string[]
                        {
                            valuePair
                        });
                    }
                    else
                    {
                        LogAPI.writeEventLog("0130022", new string[0]);
                    }
                }
                if (this.tbBillingPort.Visible)
                {
                    Sys_Para.SetBPPort(num2);
                    InSnergyService.RestartBillingProtocol(Sys_Para.GetBPFlag() == 1, num2, Sys_Para.GetBPSecurity());
                }
                if (this.tbGatewayPort.Visible)
                {
                    Sys_Para.SetISGPort(num3);
                    if (Sys_Para.GetISGFlag() == 0)
                    {
                        InSnergyService.Restart(false, num3);
                    }
                    else
                    {
                        InSnergyService.Restart(true, num3);
                    }
                }
                base.DialogResult = DialogResult.OK;
                return;
            }
            if (!this.portparacheck(this.lbManagerPort, this.tbManagerPort, 0))
            {
                return;
            }
            int value = System.Convert.ToInt32(this.tbManagerPort.Text);

            ValuePairs.setValuePair("ServicePort", System.Convert.ToString(value));
            ValuePairs.SaveValueKeyToRegistry(true);
            base.DialogResult = DialogResult.OK;
        }
Exemplo n.º 30
0
 private void btnsave_Click(object sender, System.EventArgs e)
 {
     if (this.rbbyperiod.Checked)
     {
         if (this.i_days < 7)
         {
             this.i_days = 7;
         }
         else
         {
             if (this.i_days > 366)
             {
                 this.i_days = 366;
             }
         }
         this.txtperiod.Text           = this.i_days.ToString();
         this.myLogSetting.Days        = this.i_days;
         this.myLogSetting.Maintenance = 0;
     }
     else
     {
         if (this.i_records < 100)
         {
             this.i_records = 100;
         }
         else
         {
             if (this.i_records > 99999)
             {
                 this.i_records = 99999;
             }
         }
         this.txtrecords.Text          = this.i_records.ToString();
         this.myLogSetting.RecordNum   = this.i_records;
         this.myLogSetting.Maintenance = 1;
     }
     if (this.i_pagesize < 10)
     {
         this.i_pagesize = 10;
     }
     else
     {
         if (this.i_pagesize > 100)
         {
             this.i_pagesize = 100;
         }
     }
     this.txtpagesize.Text      = this.i_pagesize.ToString();
     this.myLogSetting.PageSize = this.i_pagesize;
     if (this.myLogSetting.update() > 0)
     {
         string valuePair = ValuePairs.getValuePair("Username");
         if (!string.IsNullOrEmpty(valuePair))
         {
             LogAPI.writeEventLog("0130030", new string[]
             {
                 valuePair
             });
         }
         else
         {
             LogAPI.writeEventLog("0130030", new string[0]);
         }
         EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
         return;
     }
     EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
 }