/// <summary>
        /// Initializes a new instance of the <see cref="T:UserDetails"/> class.
        /// </summary>
        /// <param name="membershipUser">The membership user.</param>
        /// <param name="getProfile">if set to <c>true</c> [get profile].</param>
        public UserDetails(MembershipUser membershipUser, bool getProfile)
        {
            if (membershipUser != null)
            {
                UserName         = membershipUser.UserName;
                Email            = membershipUser.Email;
                LastActivityDate = membershipUser.LastActivityDate.ToShortDateString();

                if (getProfile)
                {
                    ProfileCommon p       = new ProfileCommon();
                    ProfileCommon profile = p.GetProfile(membershipUser.UserName);


                    if (profile != null)
                    {
                        OpCoId          = profile.OpCoId;
                        OpCoCode        = profile.OpCoCode;
                        RegionId        = profile.RegionId;
                        RegionCode      = profile.RegionCode;
                        WarehouseId     = profile.WarehouseId;
                        SalesLocationId = profile.SalesLocationId;
                        SalesLocation   = SalesLocationController.GetLocation(salesLocationId, false);
                        OpCo            = OpcoController.GetOpCo(OpCoId, false);
                        Warehouse       = WarehouseController.GetWarehouse(WarehouseId);
                        Region          = OptrakRegionController.GetRegion(RegionId);
                    }
                }
            }
        }
Пример #2
0
 protected static void SetUserDefaultWarehouse(ListControl listControl, ProfileCommon profile)
 {
     //default the warehouse dropdown to the current users warehouse
     if (profile.WarehouseId > 0)
     {
         ListItem defaultItem = new ListItem();
         if (listControl.DataValueField == "Code")
         {
             Warehouse warehouse = WarehouseController.GetWarehouse(profile.WarehouseId);
             if (warehouse != null)
             {
                 defaultItem = listControl.Items.FindByValue(warehouse.Code);
             }
         }
         else
         {
             defaultItem = listControl.Items.FindByValue(profile.WarehouseId.ToString());
         }
         if (defaultItem != null)
         {
             if (listControl.SelectedItem != null)
             {
                 listControl.SelectedItem.Selected = false;
             }
             defaultItem.Selected = true;
         }
     }
 }
Пример #3
0
        public void TestGetItemsByRegion()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                NonWorkingDay nonWorkingDay = PopulateNewItem();
                nonWorkingDay.Id = SaveItem(nonWorkingDay);

                if (nonWorkingDay.Id != -1)
                {
                    Warehouse warehouse = WarehouseController.GetWarehouse(nonWorkingDay.WarehouseId);
                    Assert.IsNotNull(GetItemsByRegion(warehouse.RegionId));
                }
            }
        }
Пример #4
0
        public void SaveItemsOneRegionOneWarehouseWeekend()
        {
            using (TransactionScope ts = new TransactionScope())
            {
                NonWorkingDay nonWorkingDay = PopulateNewItem();
                Warehouse     warehouse     = WarehouseController.GetWarehouse(nonWorkingDay.WarehouseId);

                int  regionId    = warehouse.RegionId;
                bool weekendOnly = true;

                int Id = SaveItemsWithinRange(nonWorkingDay, regionId, nonWorkingDay.WarehouseId, weekendOnly);
                Assert.IsTrue(Id != 0);
            }
        }
Пример #5
0
 internal Warehouse GetItem(int id)
 {
     return(WarehouseController.GetWarehouse(id));
 }