Ejemplo n.º 1
0
 public static bool SaveUserLogin(Page P, string s_USER_NAME, string sUSER_ID, string sFULL_NAME, string sUSER_GROUP_ID)
 {
     string sCLIENT_ID = P.Request.UserHostAddress.ToString();
     DataTable table = SQLConnectWeb.GetTable("select SESSION_ID from LOG_IN_SESSION where  CLIENT_ID='" + sCLIENT_ID + "'");
     if (table == null)
     {
         return false;
     }
     if (table.Rows.Count == 0)
     {
         return (LOG_IN_SESSION.Insert_Object(sCLIENT_ID, sUSER_ID, s_USER_NAME, sFULL_NAME, sUSER_GROUP_ID) != null);
     }
     LOG_IN_SESSION login = new LOG_IN_SESSION();
     login.SESSION_ID = table.Rows[0][LOG_IN_SESSION.cl_SESSION_ID].ToString();
     return login.Save_Object(sCLIENT_ID, sUSER_ID, s_USER_NAME, sFULL_NAME, sUSER_GROUP_ID);
 }
Ejemplo n.º 2
0
        //───────────────────────────────────────────────────────────────────────────────────────
        public static LOG_IN_SESSION Insert_Object(
            string sCLIENT_ID
            , string sUSER_ID
            , string sUSER_NAME
            , string sFULL_NAME
            , string sUSER_GROUP_ID
            )
        {
            string tem_sCLIENT_ID = MinhTam.DataAccess.Web.SQLToolWeb.GetSaveValue(sCLIENT_ID, "nvarchar");
             string tem_sUSER_ID = MinhTam.DataAccess.Web.SQLToolWeb.GetSaveValue(sUSER_ID, "int");
             string tem_sUSER_NAME = MinhTam.DataAccess.Web.SQLToolWeb.GetSaveValue(sUSER_NAME, "nvarchar");
             string tem_sFULL_NAME = MinhTam.DataAccess.Web.SQLToolWeb.GetSaveValue(sFULL_NAME, "nvarchar");

             string tem_sUSER_GROUP_ID = MinhTam.DataAccess.Web.SQLToolWeb.GetSaveValue(sUSER_GROUP_ID, "int");

             string sqlSave = " INSERT INTO LOG_IN_SESSION(" +
               "CLIENT_ID,"
            + "USER_ID,"
            + "USER_NAME,"
            + "FULL_NAME,"
            + "CLIENT_DATE,"
            + "USER_GROUP_ID) VALUES("
            + tem_sCLIENT_ID + ","
            + tem_sUSER_ID + ","
            + tem_sUSER_NAME + ","
            + tem_sFULL_NAME + ","
            + "getDate(),"
            +tem_sUSER_GROUP_ID + ")";
             bool OK = Exec(sqlSave) >= 1 ? true : false;
             if (OK)
             {
             LOG_IN_SESSION newLOG_IN_SESSION = new LOG_IN_SESSION();
             DataTable dt = GetTable(" SELECT TOP 1 SESSION_ID,CLIENT_DATE FROM LOG_IN_SESSION ORDER BY SESSION_ID DESC ");
             newLOG_IN_SESSION.SESSION_ID = dt.Rows[0]["SESSION_ID"].ToString();
             newLOG_IN_SESSION.CLIENT_ID = sCLIENT_ID;
             newLOG_IN_SESSION.USER_ID = sUSER_ID;
             newLOG_IN_SESSION.USER_NAME = sUSER_NAME;
             newLOG_IN_SESSION.FULL_NAME = sFULL_NAME;
             newLOG_IN_SESSION.CLIENT_DATE = dt.Rows[0]["CLIENT_DATE"].ToString();
             newLOG_IN_SESSION.USER_GROUP_ID = sUSER_GROUP_ID;
             return newLOG_IN_SESSION;
             }
             else return null;
        }