Exemplo n.º 1
0
        public void HowTo()
        {
//<document>
            long _idprofile = 0L;

            OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile _profile
                          = new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile();
            _profile.Name = "someprofile";
            _profile.IFApplication_isNull = true;
// assigning selectIdentity parameter to true retrieves Sequence/Identity for IDUser
            _idprofile = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_Profile.insObject(
                _profile,
                true
                );

            Console.WriteLine(
                "profile inserted, at:\nIDProfile = {0}",
                _idprofile
                );
//</document>

            // the only porpuses is to keep documentation code samples updated by:
            // 1) ensure documentation code samples are compiling
            // 2) no exceptions are beeing thrown by documentation code samples
            Assert.IsTrue(
                true,
                "documentation code sample is failing"
                );
        }
		public void HowTo() {

//<document>
long _idprofile = 0L;

OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile _profile
	= new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile();
_profile.Name = "someprofile";
_profile.IFApplication_isNull = true;
// assigning selectIdentity parameter to true retrieves Sequence/Identity for IDUser
_idprofile = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_Profile.insObject(
	_profile,
	true
);

Console.WriteLine(
	"profile inserted, at:\nIDProfile = {0}", 
	_idprofile
);
//</document>

			// the only porpuses is to keep documentation code samples updated by: 
			// 1) ensure documentation code samples are compiling 
			// 2) no exceptions are beeing thrown by documentation code samples
			Assert.IsTrue(
				true,
				"documentation code sample is failing"
			);

		}
Exemplo n.º 3
0
 public void updObject(
     string sessionGuid_in,
     string ip_forLogPurposes_in,
     OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile profile_in,
     long[] idProfile_parent_in,
     long[] idPermission_in,
     out int[] errors_out
     )
 {
     OGen.NTier.Kick.Libraries.BusinessLayer.SBO_CRD_Profile.updObject(
         sessionGuid_in,
         ip_forLogPurposes_in,
         profile_in,
         idProfile_parent_in,
         idPermission_in,
         out errors_out
         );
 }
Exemplo n.º 4
0
        public void HowTo()
        {
//<document>
            OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile _profile
                = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_Profile.getObject(1L);
            if (_profile == null)
            {
                Console.WriteLine("profile not found");
            }
            else
            {
                Console.Write(
                    "updating profile name:\nName = {0}\nnew Name = {1} ... ",
                    _profile.Name,
                    _profile.Name = "whatever"
                    );

                // makes no update unless changes have been made,
                // you can force update by sending true parameter
                OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_Profile.updObject(
                    _profile,
                    false
                    );

                Console.WriteLine("DONE!");
            }
//</document>

            // the only porpuses is to keep documentation code samples updated by:
            // 1) ensure documentation code samples are compiling
            // 2) no exceptions are beeing thrown by documentation code samples
            Assert.IsTrue(
                true,
                "documentation code sample is failing"
                );
        }
		public void HowTo() {

//<document>
string _testid = DateTime.Now.Ticks.ToString();
bool _constraint;
long _iduser;
long _ifprofile;

// we need a shared connection between Data Objects
OGen.Libraries.DataLayer.DBConnection _con = OGen.NTier.Kick.Libraries.DataLayer.DO__Utilities.DBConnection_createInstance(
	OGen.NTier.Kick.Libraries.DataLayer.DO__Utilities.DBServerType,
	OGen.NTier.Kick.Libraries.DataLayer.DO__Utilities.DBConnectionstring,
	string.Empty
);

Exception _exception = null;
try {
	// before beginning a transaction we need to open the connection
	_con.Open();

	// beginning transaction
	_con.Transaction.Begin();

	OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_User _user 
		= new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_User();
	// performing some operations on User Data Object
	_user.Login = _testid;
	_user.Password = _testid;
	_user.IFApplication_isNull = true;
	// sharing connection with User Data Object
	_iduser = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_User.insObject(
		_user,
		true,
		out _constraint,
		_con
	);
	// handling constraint code should be added here

	OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile _profile 
		= new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile();
	// performing some operations on User Data Object
	_profile.Name = _testid;
	_profile.IFApplication_isNull = true;
	// sharing connection with Group Data Object
	_ifprofile = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_Profile.insObject(
		_profile,
		true,
		_con
	);

	OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_UserProfile _userprofile
		= new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_UserProfile();
	// performing some operations on User Data Object
	_userprofile.IFProfile = _ifprofile;
	_userprofile.IFUser = _iduser;
	// sharing connection with Group Data Object
	OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_UserProfile.setObject(
		_userprofile,
		false,
		_con
	);

	// commit transaction
	_con.Transaction.Commit();

} catch (Exception _ex) {

	// rollback transaction
	_con.Transaction.Rollback();

	_exception = _ex;

} finally {

	//// terminate transaction
	//if (_con.Transaction.InTransaction) {
	//    _con.Transaction.Terminate();
	//}

	//// closing connection
	//if (_con.IsOpen) {
	//    _con.Close();
	//}

	// no need to (conditionally) terminate transaction and close connection, 
	// simply disposing connection will do all that
	_con.Dispose();
	_con = null;

}
if (_exception != null)
	throw _exception;
//</document>

			// the only porpuses is to keep documentation code samples updated by: 
			// 1) ensure documentation code samples are compiling 
			// 2) no exceptions are beeing thrown by documentation code samples
			Assert.IsTrue(
				true,
				"documentation code sample is failing"
			);

		}
Exemplo n.º 6
0
        public void HowTo()
        {
//<document>
            string _testid = DateTime.Now.Ticks.ToString();
            bool   _constraint;
            long   _iduser;
            long   _ifprofile;

// we need a shared connection between Data Objects
            OGen.Libraries.DataLayer.DBConnection _con = OGen.NTier.Kick.Libraries.DataLayer.DO__Utilities.DBConnection_createInstance(
                OGen.NTier.Kick.Libraries.DataLayer.DO__Utilities.DBServerType,
                OGen.NTier.Kick.Libraries.DataLayer.DO__Utilities.DBConnectionstring,
                string.Empty
                );

            Exception _exception = null;

            try {
                // before beginning a transaction we need to open the connection
                _con.Open();

                // beginning transaction
                _con.Transaction.Begin();

                OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_User _user
                    = new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_User();
                // performing some operations on User Data Object
                _user.Login                = _testid;
                _user.Password             = _testid;
                _user.IFApplication_isNull = true;
                // sharing connection with User Data Object
                _iduser = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_User.insObject(
                    _user,
                    true,
                    out _constraint,
                    _con
                    );
                // handling constraint code should be added here

                OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile _profile
                    = new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_Profile();
                // performing some operations on User Data Object
                _profile.Name = _testid;
                _profile.IFApplication_isNull = true;
                // sharing connection with Group Data Object
                _ifprofile = OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_Profile.insObject(
                    _profile,
                    true,
                    _con
                    );

                OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_UserProfile _userprofile
                    = new OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_CRD_UserProfile();
                // performing some operations on User Data Object
                _userprofile.IFProfile = _ifprofile;
                _userprofile.IFUser    = _iduser;
                // sharing connection with Group Data Object
                OGen.NTier.Kick.Libraries.DataLayer.DO_CRD_UserProfile.setObject(
                    _userprofile,
                    false,
                    _con
                    );

                // commit transaction
                _con.Transaction.Commit();
            } catch (Exception _ex) {
                // rollback transaction
                _con.Transaction.Rollback();

                _exception = _ex;
            } finally {
                //// terminate transaction
                //if (_con.Transaction.InTransaction) {
                //    _con.Transaction.Terminate();
                //}

                //// closing connection
                //if (_con.IsOpen) {
                //    _con.Close();
                //}

                // no need to (conditionally) terminate transaction and close connection,
                // simply disposing connection will do all that
                _con.Dispose();
                _con = null;
            }
            if (_exception != null)
            {
                throw _exception;
            }
//</document>

            // the only porpuses is to keep documentation code samples updated by:
            // 1) ensure documentation code samples are compiling
            // 2) no exceptions are beeing thrown by documentation code samples
            Assert.IsTrue(
                true,
                "documentation code sample is failing"
                );
        }