Beispiel #1
0
        public int DelAny(string[] ids)
        {
            string whereStr = string.Join(",", ids);
            string cmdStr   = "delete from T_Log where ID in (" + whereStr + ")";

            return(SQLHelpler.ExecuteNonQuery(cmdStr));
        }
Beispiel #2
0
        public int Del(int id)
        {
            string         cmdStr = "delete from T_PingObj where ID=@ID";
            OleDbParameter parm   = new OleDbParameter("ID", id);

            return(SQLHelpler.ExecuteNonQuery(cmdStr, parm));
        }
Beispiel #3
0
        public T_Exception Get()
        {
            string  cmdStr = "select * from T_Exception";
            DataRow dr     = SQLHelpler.ExecuteAdapter(cmdStr).Rows[0];

            return(ToModel(dr));
        }
Beispiel #4
0
        public int Add(T_MailAddress modelIn)
        {
            string         cmdStr = "insert into T_MailAddress(MAILADDRESS) values(@MAILADDRESS)";
            OleDbParameter parm   = new OleDbParameter("MAILADDRESS", modelIn.MAILADDRESS);

            SQLHelpler.ExecuteNonQuery(cmdStr, parm);
            return((int)SQLHelpler.ExecuteSclary("select max(ID) from T_MailAddress"));
        }
Beispiel #5
0
        public DataTable GetAll()
        {
            string cmdStr = "select * from T_Log order by ID desc";

            //List<T_Log> models = new List<T_Log>();
            //foreach (DataRow drTemp in SQLHelpler.ExecuteAdapter(cmdStr).Rows)
            //{
            //    ToModel(models, drTemp);
            //}
            //return models;
            return(SQLHelpler.ExecuteAdapter(cmdStr));
        }
Beispiel #6
0
        public IList <T_PingObj> GetAll()
        {
            string           cmdStr = "select * from T_PingObj";
            List <T_PingObj> models = new List <T_PingObj>();

            foreach (DataRow drTemp in SQLHelpler.ExecuteAdapter(cmdStr).Rows)
            {
                T_PingObj modelTemp = ToModel(drTemp);
                models.Add(modelTemp);
            }
            return(models);
        }
Beispiel #7
0
        public IList <T_PingObj> GetByMonitor()
        {
            string           cmdStr = "select * from T_PingObj where MONITORSPEED=true or MONITORNET=true";
            List <T_PingObj> models = new List <T_PingObj>();

            foreach (DataRow drTemp in SQLHelpler.ExecuteAdapter(cmdStr).Rows)
            {
                T_PingObj modelTemp = ToModel(drTemp);
                models.Add(modelTemp);
            }
            return(models);
        }
Beispiel #8
0
        public int Add(T_Log modelIn)
        {
            string cmdStr = "insert into T_Log(LOGTIME,OBJNAME,ADDRESS,STATE,RETIME) values(@LOGTIME,@OBJNAME,@ADDRESS,@STATE,@RETIME)";

            OleDbParameter[] parms =
            {
                new OleDbParameter("LOGTIME", modelIn.LOGTIME.ToString()),
                new OleDbParameter("OBJNAME", modelIn.OBJNAME),
                new OleDbParameter("ADDRESS", modelIn.ADDRESS),
                new OleDbParameter("STATE",   modelIn.STATE),
                new OleDbParameter("RETIME",  modelIn.RETIME)
            };
            return(SQLHelpler.ExecuteNonQuery(cmdStr, parms));
        }
Beispiel #9
0
        public int Update(T_PingObj modelIn)
        {
            string cmdStr = "update T_PingObj set OBJNAME=@OBJNAME,ADDRESS=@ADDRESS,MONITORSPEED=@MONITORSPEED,MONITORNET=@MONITORNET where ID=@ID";

            OleDbParameter[] parms =
            {
                new OleDbParameter("OBJNAME",      modelIn.OBJNAME == null?"":modelIn.OBJNAME),
                new OleDbParameter("ADDRESS",      modelIn.ADDRESS == null?"":modelIn.ADDRESS),
                new OleDbParameter("MONITORSPEED", modelIn.MONITORSPEED),
                new OleDbParameter("MONITORNET",   modelIn.MONITORNET),
                new OleDbParameter("ID",           modelIn.ID)
            };
            return(SQLHelpler.ExecuteNonQuery(cmdStr, parms));
        }
Beispiel #10
0
        public int Add(T_PingObj modelIn)
        {
            string cmdStr = "insert into T_PingObj(OBJNAME,ADDRESS,MONITORSPEED,MONITORNET) values(@OBJNAME,@ADDRESS,@MONITORSPEED,@MONITORNET)";

            OleDbParameter[] parms =
            {
                new OleDbParameter("OBJNAME",      modelIn.OBJNAME == null?"":modelIn.OBJNAME),
                new OleDbParameter("ADDRESS",      modelIn.ADDRESS == null?"":modelIn.ADDRESS),
                new OleDbParameter("MONITORSPEED", modelIn.MONITORSPEED),
                new OleDbParameter("MONITORNET",   modelIn.MONITORNET)
            };
            SQLHelpler.ExecuteNonQuery(cmdStr, parms);
            return((int)SQLHelpler.ExecuteSclary("select max(ID) from T_PingObj"));
        }
Beispiel #11
0
        public IList <T_MailAddress> GetAll()
        {
            string cmdStr = "select * from T_MailAddress";
            List <T_MailAddress> models = new List <T_MailAddress>();

            foreach (DataRow drTemp in SQLHelpler.ExecuteAdapter(cmdStr).Rows)
            {
                T_MailAddress modelTemp = new T_MailAddress();
                modelTemp.ID          = (int)drTemp["ID"];
                modelTemp.MAILADDRESS = (string)drTemp["MAILADDRESS"];
                models.Add(modelTemp);
            }
            return(models);
        }
Beispiel #12
0
        public int Update(T_Exception modelIn)
        {
            string cmdStr = "update T_Exception set ISMAIL=@ISMAIL,ISLOG=@ISLOG,ISREMIND=@ISREMIND,TIMESPAN=@TIMESPAN,SPEEDRETIME=@SPEEDRETIME,SPEEDCOUNT=@SPEEDCOUNT,NONETCOUNT=@NONETCOUNT where ID=@ID";

            OleDbParameter[] parms =
            {
                new OleDbParameter("ISMAIL",      modelIn.ISMAIL),
                new OleDbParameter("ISLOG",       modelIn.ISLOG),
                new OleDbParameter("ISREMIND",    modelIn.ISREMIND),
                new OleDbParameter("TIMESPAN",    modelIn.TIMESPAN),
                new OleDbParameter("SPEEDRETIME", modelIn.SPEEDRETIME),
                new OleDbParameter("SPEEDCOUNT",  modelIn.SPEEDCOUNT),
                new OleDbParameter("NONETCOUNT",  modelIn.NONETCOUNT),
                new OleDbParameter("ID",          modelIn.ID)
            };
            return(SQLHelpler.ExecuteNonQuery(cmdStr, parms));
        }
Beispiel #13
0
        public T_MailConfig Get()
        {
            string       cmdStr = "select * from T_MailConfig";
            DataRow      dr     = SQLHelpler.ExecuteAdapter(cmdStr).Rows[0];
            T_MailConfig model  = new T_MailConfig();

            model.ID        = (int)dr["ID"];
            model.ISSHOW    = (bool)dr["ISSHOW"];
            model.SENDMAIL  = (string)dr["SENDMAIL"];
            model.SENDER    = (string)dr["SENDER"];
            model.SENDSMTP  = (string)dr["SENDSMTP"];
            model.SENDPORT  = (int)dr["SENDPORT"];
            model.SENDUSER  = (string)dr["SENDUSER"];
            model.SENDPWD   = (string)dr["SENDPWD"];
            model.MAILTITLE = (string)dr["MAILTITLE"];
            model.MAILBODY  = (string)dr["MAILBODY"];
            return(model);
        }
Beispiel #14
0
        public int Update(T_MailConfig modelIn)
        {
            string cmdStr = "update T_MailConfig set ISSHOW=@ISSHOW,SENDMAIL=@SENDMAIL,SENDER=@SENDER,SENDSMTP=@SENDSMTP,SENDPORT=@SENDPORT,SENDUSER=@SENDUSER,SENDPWD=@SENDPWD,MAILTITLE=@MAILTITLE,MAILBODY=@MAILBODY where ID=@ID";

            //string cmdStr = string.Format("update T_MailConfig set SENDMAIL='{0}',SENDER='{1}',SENDSMTP='{2}',SENDPORT={3},SENDUSER='******',SENDPWD='{5}',MAILTITLE='{6}',MAILBODY='{7}' where ID={8}", modelIn.SENDMAIL, modelIn.SENDER, modelIn.SENDSMTP, modelIn.SENDPORT, modelIn.SENDUSER, modelIn.SENDPWD, modelIn.MAILTITLE, modelIn.MAILBODY, modelIn.ID);
            OleDbParameter[] parms =
            {
                new OleDbParameter("ISSHOW",    modelIn.ISSHOW),
                new OleDbParameter("SENDMAIL",  modelIn.SENDMAIL),
                new OleDbParameter("SENDER",    modelIn.SENDER),
                new OleDbParameter("SENDSMTP",  modelIn.SENDSMTP),
                new OleDbParameter("SENDPORT",  modelIn.SENDPORT),
                new OleDbParameter("SENDUSER",  modelIn.SENDUSER),
                new OleDbParameter("SENDPWD",   modelIn.SENDPWD),
                new OleDbParameter("MAILTITLE", modelIn.MAILTITLE),
                new OleDbParameter("MAILBODY",  modelIn.MAILBODY),
                new OleDbParameter("ID",        modelIn.ID)
            };
            return(SQLHelpler.ExecuteNonQuery(cmdStr, parms));
        }