Example #1
0
        public itemsModels GetBadgeModels(userData userData, string cuurip)
        {
            DataTable      mainRows    = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@inoper", userData.userid.TrimEnd()));
            mainRows = new database().checkSelectSql("mssql", "sysstring", "exec web.modifynoticeform @inoper;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new itemsModels()
                {
                    showItem = false
                });
            }
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in mainRows.Rows)
            {
                items.Add(new Dictionary <string, object>()
                {
                    { "link", dr["link"].ToString().TrimEnd() }, { "name", dr["username"].ToString().TrimEnd().Substring(0, 1) }, { "value", dr["value"].ToString().TrimEnd() }, { "datetime", $"{dr["indate"].ToString().TrimEnd()} {dr["intime"].ToString().TrimEnd()}" }
                });
            }
            return(new itemsModels()
            {
                showItem = true, items = items
            });
        }
Example #2
0
        public itemsModels GetRecordModels(userData userData, string cuurip)
        {
            DataTable      mainRows    = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@newid", userData.userid.TrimEnd()));
            mainRows = new database().checkSelectSql("mssql", "sysstring", "exec web.searchrecordform @newid;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new itemsModels()
                {
                    showItem = false
                });
            }
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in mainRows.Rows)
            {
                items.Add(new Dictionary <string, object>()
                {
                    { "link", dr["link"].ToString().TrimEnd() }, { "icon", dr["icon"].ToString().TrimEnd() }, { "value", dr["value"].ToString().TrimEnd() }
                });
            }
            return(new itemsModels()
            {
                showItem = true, items = items
            });
        }
Example #3
0
        public loginModels GetLoginFormModels(userData userData, string cuurip, string userAgent)
        {
            switch (string.IsNullOrWhiteSpace(userData.userid))
            {
            case true:
                return(new loginModels()
                {
                    status = "errorFormLogin"
                });
            }
            database       database    = new database();
            DataTable      loginRows   = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@newid", userData.userid.TrimEnd()));
            dbparamlist.Add(new dbparam("@externip", cuurip));
            dbparamlist.Add(new dbparam("@status", "1"));
            loginRows = database.checkSelectSql("mssql", "sysstring", "exec web.checkformlogin @newid,@externip,@status;", dbparamlist);
            switch (loginRows.Rows.Count)
            {
            case 0:
                return(new loginModels()
                {
                    status = "nodata"
                });
            }
            if (loginRows.Rows[0]["isused"].ToString().TrimEnd() == "1" && loginRows.Rows[0]["islogin"].ToString().TrimEnd() == "1")
            {
                datetime    datetime = new datetime();
                information information = new information();
                string      date = datetime.sqldate("mssql", "sysstring"), time = datetime.sqltime("mssql", "sysstring");
                dbparamlist.Add(new dbparam("@cpu", ""));
                dbparamlist.Add(new dbparam("@os", information.osystem(userAgent)));
                dbparamlist.Add(new dbparam("@internip", ""));
                dbparamlist.Add(new dbparam("@indate", date));
                dbparamlist.Add(new dbparam("@intime", time));
                switch (database.checkActiveSql("mssql", "sysstring", "update web.sitelog set cpu = @cpu,os = @os,internip = @internip,indate = @indate,intime = @intime where newid = @newid and externip = @externip and islogin = @status;", dbparamlist))
                {
                case "istrue":
                    return(new loginModels()
                    {
                        newid = loginRows.Rows[0]["newid"].ToString().TrimEnd(), name = loginRows.Rows[0]["username"].ToString().TrimEnd().Substring(0, 1), allname = loginRows.Rows[0]["username"].ToString().TrimEnd(), status = "istrue"
                    });
                }
                return(new loginModels()
                {
                    status = "error"
                });
            }
            return(new loginModels()
            {
                status = "islock"
            });
        }
Example #4
0
        public sOptonModels GetSearchModels(userData userData, string cuurip)
        {
            List <Dictionary <string, object> > items = new List <Dictionary <string, object> >();

            foreach (DataRow dr in new database().checkSelectSql("mssql", "sysstring", "exec web.searchformname;", new List <dbparam>()).Rows)
            {
                items.Add(new Dictionary <string, object>()
                {
                    { "optionPadding", false }, { "value", dr["value"].ToString().TrimEnd() }
                });
            }
            return(new sOptonModels()
            {
                items = items
            });
        }
Example #5
0
        public permissModels GetPermissModels(userData userData, string cuurip)
        {
            DataTable      mainRows    = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@newid", userData.userid.TrimEnd()));
            mainRows = new database().checkSelectSql("mssql", "sysstring", "exec web.searchallmissform @newid;", dbparamlist);
            switch (mainRows.Rows.Count)
            {
            case 0:
                return(new permissModels()
                {
                    insert = false, update = false, delete = false, export = false
                });
            }
            return(new permissModels()
            {
                insert = mainRows.Rows[0]["isinsert"].ToString().TrimEnd() == "1", update = mainRows.Rows[0]["ismodify"].ToString().TrimEnd() == "1", delete = mainRows.Rows[0]["isdelete"].ToString().TrimEnd() == "1", export = mainRows.Rows[0]["isexport"].ToString().TrimEnd() == "1"
            });
        }
Example #6
0
 public statusModels GetSearchModels(userData userData, string cuurip)
 {
     /*database database = new database();
      * DataTable mainRows = new DataTable();
      * List<dbparam> dbparamlist = new List<dbparam>();
      * mainRows = database.checkSelectSql("mssql", "sysstring", "select value,icon from web.qaitemform where inoper = @inoper;", dbparamlist);
      * switch (mainRows.Rows.Count)
      * {
      *  case 0:
      *      return new sItemsModels() { status = "nodata" };
      * }
      * List<Dictionary<string, object>> items = new List<Dictionary<string, object>>();
      * foreach (DataRow dr in mainRows.Rows)
      * {
      *  items.Add(new Dictionary<string, object>() { { "icon", dr["icon"].ToString().TrimEnd() }, { "value", dr["value"].ToString().TrimEnd() } });
      * }*/
     return(new statusModels()
     {
         status = "istrue"
     });
 }
Example #7
0
        public userModels GetUserModels(userData userData, string cuurip)
        {
            switch (string.IsNullOrWhiteSpace(userData.userid))
            {
            case true:
                return(new userModels()
                {
                    status = "errorUserid"
                });
            }
            database       database    = new database();
            DataTable      userRows    = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@userid", userData.userid.TrimEnd()));
            dbparamlist.Add(new dbparam("@status", "1"));
            userRows = database.checkSelectSql("mssql", "sysstring", "exec web.checksiteber @userid,@status;", dbparamlist);
            switch (userRows.Rows.Count)
            {
            case 0:
                return(new userModels()
                {
                    status = "nodata"
                });
            }
            switch (userRows.Rows[0]["isused"].ToString().TrimEnd())
            {
            case "1":
                return(new userModels()
                {
                    newid = userRows.Rows[0]["newid"].ToString().TrimEnd(), status = "istrue"
                });
            }
            return(new userModels()
            {
                status = "islock"
            });
        }
Example #8
0
        public statusModels GetCheckNewModels(userData userData, string cuurip)
        {
            switch (string.IsNullOrWhiteSpace(userData.userid))
            {
            case true:
                return(new statusModels()
                {
                    status = "nodata"
                });
            }
            DataTable      checkRows   = new DataTable();
            List <dbparam> dbparamlist = new List <dbparam>();

            dbparamlist.Add(new dbparam("@newid", userData.userid.TrimEnd()));
            dbparamlist.Add(new dbparam("@status", "1"));
            checkRows = new database().checkSelectSql("mssql", "sysstring", "exec web.checkformnewid @newid,@status;", dbparamlist);
            switch (checkRows.Rows.Count)
            {
            case 0:
                return(new statusModels()
                {
                    status = "nodata"
                });
            }
            switch (checkRows.Rows[0]["isused"].ToString().TrimEnd())
            {
            case "1":
                return(new statusModels()
                {
                    status = "istrue"
                });
            }
            return(new statusModels()
            {
                status = "islock"
            });
        }