Пример #1
0
        internal static long insObject_Registration(
            string login_in,
            string password_in,
            int idApplication_in,

            bool selectIdentity_in,
            ref List <int> errorlist_in,
            DBConnection con_in
            )
        {
            long _output = -1L;

            // user registering
            //

            if (!Sessionuser.checkLogin(login_in, ref errorlist_in))
            {
                return(_output);
            }

            bool _constraint;

            _output = DO_CRD_User.insObject(
                new SO_CRD_User(
                    -1L,
                    login_in,

// ToDos: here! encrypt before sending...
                    password_in,

                    idApplication_in
                    ),

                selectIdentity_in,
                out _constraint,

                con_in
                );
            if (_constraint)
            {
                errorlist_in.Add(ErrorType.data__constraint_violation);
            }
            else
            {
                if (con_in == null)
                {
                    // assuming NO other (internal) operations are going on
                    errorlist_in.Add(ErrorType.user__successfully_created__WARNING);
                }
            }

            return(_output);
        }
Пример #2
0
        internal static long insObject_CreateUser(
            Sessionuser sessionUser_in,

            string login_in,

            bool selectIdentity_in,
            ref List <int> errorlist_in,

            DBConnection con_in
            )
        {
            long _output = -1L;

            // ToDos: here! must have permission to create user
            if (!sessionUser_in.hasPermission(
                    PermissionType.User__insert
                    ))
            {
                errorlist_in.Add(ErrorType.user__lack_of_permissions_to_write);
                return(_output);
            }

            if (!Sessionuser.checkLogin(login_in, ref errorlist_in))
            {
                return(_output);
            }

            bool _constraint;

            _output = DO_CRD_User.insObject(
                new SO_CRD_User(
                    -1L,
                    login_in,

// ToDos: here! encrypt before sending...
                    login_in,                     // default: password = login

                    sessionUser_in.IDApplication
                    ),

                selectIdentity_in,
                out _constraint,

                con_in
                );

            if (_constraint)
            {
                errorlist_in.Add(ErrorType.data__constraint_violation);
            }
            else
            {
                if (con_in == null)
                {
                    // assuming NO other (internal) operations are going on
                    errorlist_in.Add(ErrorType.user__successfully_created__WARNING);
                }
            }

            return(_output);
        }