Ejemplo n.º 1
0
        private int Registration(string username, string password, string pDivID, string pName, string pEmail, string pUserRights, out string pDT)
        {
            int lResponse = -1;

            pDT = "";
            string lUsername, lpassword;

            lUsername = username;
            lpassword = password;

            string lResp = lSql.ConnectSQL(Splosno.AppSQLName);

            if (lResp.Length > 0)
            {
                throw new Exception(lResp);
            }

            StringBuilder sSQL = new StringBuilder();

            if (String.IsNullOrEmpty(lpassword))
            {
                lpassword = "";
            }
            sSQL.AppendLine(" ");
            sSQL.AppendLine("SELECT * FROM _mrt_Users ");
            sSQL.AppendLine("WHERE  acUserName = @username ");
            sSQL.AppendLine(" ");
            sSQL.AppendLine(" ");

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("@username", lUsername)
            };

            string    lErr = "";
            DataTable lDT  = lSql.FillDT(sSQL, sqlParams, out lErr);

            lSql.DisconnectSQL();

            if (lDT.Rows.Count == 0)
            {
                int _id = Uporabniki.Add(username, password, pName, "", true, pUserRights, pEmail, "", false, 99999);
                if (_id > 0)
                {
                    lResponse = 0;
                }
            }
            else
            {
                lResponse = 150;
            }

            return(lResponse);
        }