Exemple #1
0
        public User GetUser(string userName)
        {
            User               user = new UnknownUser();
            MMData             d    = new MMData();
            MMWebSiteConstants c    = new MMWebSiteConstants();

            try {
                DataSet x = d.GetStProcDataSet(c.DatabaseName(), SelectUser + " WHERE (U_Login = @aLogin)",
                                               new StProcParam[] { new StProcParam("@aLogin", DbType.AnsiString, userName) });
                if ((x.Tables.Count == 1) & (x.Tables[0].Rows.Count == 1))
                {
                    user = BuildUserFromRow(x.Tables[0].Rows[0]);
                }
            } catch { }
            return(user);
        }
Exemple #2
0
        public User GetUserID(string userID)
        {
            User               user = new UnknownUser();
            MMData             d    = new MMData();
            MMWebSiteConstants c    = new MMWebSiteConstants();

            try {
                DataSet x = d.GetStProcDataSet(c.DatabaseName(), SelectUser + "WHERE (U_ID = cast( @aID as uniqueidentifier ))",
                                               new StProcParam[] { new StProcParam("@aID", DbType.String, userID) });
                if ((x.Tables.Count == 1) & (x.Tables[0].Rows.Count == 1))
                {
                    user = BuildUserFromRow(x.Tables[0].Rows[0]);
                }
            }  catch { }
            return(user);
        }
Exemple #3
0
        public void UserUpdate(User toUpdate)
        {
            MMData             d  = new MMData();
            MMWebSiteConstants c  = new MMWebSiteConstants();
            DataSet            ud = d.GetStProcDataSet(c.DatabaseName(), "exec dbo.sp_AddUpdateUsers @aU_ID, @aU_Login, @aU_Password, @aU_Name, @aU_Email, @aU_SALT, @aU_IsAdmin, @aU_IsQA, @aU_IsManager, @aU_Domain",
                                                       new StProcParam[] {
                new StProcParam("@aU_ID", DbType.String, toUpdate.UserID),
                new StProcParam("@aU_Login", DbType.String, toUpdate.LoginName),
                new StProcParam("@aU_Password", DbType.String, toUpdate.Password),
                new StProcParam("@aU_Name", DbType.String, toUpdate.Name),
                new StProcParam("@aU_Email", DbType.String, toUpdate.Email),
                new StProcParam("@aU_SALT", DbType.String, toUpdate.Salter),
                new StProcParam("@aU_IsAdmin", DbType.Boolean, toUpdate.IsAdmin),
                new StProcParam("@aU_IsQA", DbType.Boolean, toUpdate.IsQA),
                new StProcParam("@aU_IsManager", DbType.Boolean, toUpdate.IsManager),
                new StProcParam("@aU_Domain", DbType.String, toUpdate.Domain)
            });

            //  if (toUpdate.UserID == -1) { // adding new user
            //    toUpdate = this.GetUser(toUpdate.LoginName);
            //  } else {
            //  }
        }