Exemplo n.º 1
0
        public bool Add(StaffAccountBLL item, out string serverSideError)
        {
            serverSideError = null;
            if (item.IsValid)
            {
                using (ProtoLibEntities context = new ProtoLibEntities())
                {
                    if (DatabaseDependantValidation(item, context, out serverSideError))
                    {
                        StaffAccount dalSA = new StaffAccount();
                        dalSA.AccountPrefs = new AccountPrefs();

                        CrossLayerEntityConverter.StaffAccountBllToDal(context, item, dalSA);

                        context.StaffAccounts.AddObject(dalSA);

                        context.SaveChanges();
                        return true;
                    }
                }
            }

            return false;
        }
        public static void StaffAccountDalToBll(ProtoLibEntities context,
            StaffAccountBLL bllSA, StaffAccount dalSA)
        {
            bllSA.ItemID = dalSA.AccountID;
            bllSA.UserName = dalSA.UserName;
            bllSA.Password = dalSA.Password;
            bllSA.ClearanceLevel = dalSA.ClearanceLevel;

            bllSA.MemberID = dalSA.MemberID;

            bllSA.Preferences.CacheSize = dalSA.AccountPrefs.CacheSize;
            bllSA.Preferences.SearchResultsPageSize = dalSA.AccountPrefs.SearchResultsPageSize;
            bllSA.Preferences.FullScreenMode = dalSA.AccountPrefs.FullScreenMode;
        }
        public static void StaffAccountBllToDal(ProtoLibEntities context,
            StaffAccountBLL bllSA, StaffAccount dalSA)
        {
            dalSA.UserName = bllSA.UserName;
            dalSA.Password = bllSA.Password;
            dalSA.ClearanceLevel = bllSA.ClearanceLevel;

            dalSA.Member = context.Members.SingleOrDefault(m => m.MemberID == bllSA.MemberID);

            dalSA.AccountPrefs.CacheSize = bllSA.Preferences.CacheSize;
            dalSA.AccountPrefs.SearchResultsPageSize = bllSA.Preferences.SearchResultsPageSize;
            dalSA.AccountPrefs.FullScreenMode = bllSA.Preferences.FullScreenMode;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the StaffAccounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStaffAccounts(StaffAccount staffAccount)
 {
     base.AddObject("StaffAccounts", staffAccount);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create a new StaffAccount object.
 /// </summary>
 /// <param name="accountID">Initial value of the AccountID property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="memberID">Initial value of the MemberID property.</param>
 /// <param name="clearanceLevel">Initial value of the ClearanceLevel property.</param>
 public static StaffAccount CreateStaffAccount(global::System.Int32 accountID, global::System.String userName, global::System.String password, global::System.Int32 memberID, global::System.Int32 clearanceLevel)
 {
     StaffAccount staffAccount = new StaffAccount();
     staffAccount.AccountID = accountID;
     staffAccount.UserName = userName;
     staffAccount.Password = password;
     staffAccount.MemberID = memberID;
     staffAccount.ClearanceLevel = clearanceLevel;
     return staffAccount;
 }