public static List <hccProgramPlan> GetAll()
 {
     try
     {
         using (var cont = new healthychefEntities())
         {
             return(cont.hccProgramPlans
                    .Join(cont.hccPrograms, a => a.ProgramID, b => b.ProgramID, (j1, j2) => new { Plan = j1, Program = j2 })
                    .OrderBy(a => a.Program.Name)
                    .ThenBy(a => a.Plan.NumWeeks)
                    .ThenBy(a => a.Plan.NumDaysPerWeek)
                    .Select(a => a.Plan)
                    .ToList());
         }
     }
     catch
     {
         throw;
     }
 }
        public void Delete()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    EntityKey key          = cont.CreateEntityKey(this.EntityKey.EntitySetName, this);
                    object    originalItem = null;

                    if (cont.TryGetObjectByKey(key, out originalItem))
                    {
                        cont.hccMenuItemIngredients.DeleteObject((hccMenuItemIngredient)originalItem);
                        cont.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static hccCartItem GetBy(int cartId, string itemName, int?profileId, bool?planisautorenew)
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    var ci = cont.hccCartItems.Where(c => c.CartID == cartId && c.ItemName == itemName && c.Plan_IsAutoRenew == planisautorenew);

                    if (profileId.HasValue && profileId.Value > 0)
                    {
                        ci = ci.Where(a => a.UserProfileID == profileId.Value);
                    }

                    return(ci.SingleOrDefault());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public List <hccPreference> GetPreferences()
 {
     try
     {
         using (var cont = new healthychefEntities())
         {
             return(cont.hccMenuItemPreferences
                    .Where(a => a.MenuItemID == this.MenuItemID)
                    .Join(cont.hccPreferences,
                          j1 => j1.PreferenceID,
                          j2 => j2.PreferenceID,
                          (j1, j2) => j2)
                    .OrderBy(a => a.Name)
                    .ToList());
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #5
0
        public void Delete()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    var d = cont.hccCartItemMealPreferences
                            .SingleOrDefault(a => a.CartItemID == this.CartItemID && a.PreferenceID == this.PreferenceID);

                    if (d != null)
                    {
                        cont.hccCartItemMealPreferences.DeleteObject(d);
                        cont.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #6
0
        public void Delete()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    hccUserProfilePreference t = cont.hccUserProfilePreferences
                                                 .Where(a => a.PreferenceID == this.PreferenceID && a.UserProfileID == this.UserProfileID)
                                                 .SingleOrDefault();

                    if (t != null)
                    {
                        cont.hccUserProfilePreferences.DeleteObject(t);
                        cont.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public List <hccIngredient> GetIngredients()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    List <hccIngredient> items = cont.hccMenuItemIngredients
                                                 .Where(a => a.MenuItemID == this.MenuItemID)
                                                 .Join(cont.hccIngredients,
                                                       j1 => j1.IngredientID,
                                                       j2 => j2.IngredientID,
                                                       (j1, j2) => j2)
                                                 .ToList();

                    return(items);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void Delete()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    hccIngredientAllergen t = cont.hccIngredientAllergens
                                              .Where(a => a.AllergenID == this.AllergenID && a.IngredientID == this.IngredientID)
                                              .SingleOrDefault();

                    if (t != null)
                    {
                        cont.hccIngredientAllergens.DeleteObject(t);
                        cont.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #9
0
        public static hccGlobalSetting GetSettings()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    var gs = cont.hccGlobalSettings.FirstOrDefault();

                    if (gs == null)
                    {
                        gs = new hccGlobalSetting();
                        gs.Save();
                    }

                    return(gs);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void lkbRemove_Click(object sender, EventArgs e)
        {
            LinkButton  lkbRemove  = (LinkButton)sender;
            int         cartItemId = int.Parse(lkbRemove.CommandArgument);
            hccCartItem cartItem   = hccCartItem.GetById(cartItemId);

            if (cartItem != null)
            {
                hccCartItem vsItem = CurrentProfileCart.CartItems.Single(a => a.CartItemID == cartItemId);
                if (vsItem != null)
                {
                    CurrentProfileCart.CartItems.Remove(vsItem);
                }

                try
                {  // remove any potential recurring status to prevent orphaning records without a valid cartId and cartitemId
                    using (var hcE = new healthychefEntities())
                    {
                        var rOrder = hcE.hccRecurringOrders.FirstOrDefault(i => i.CartID == cartItem.CartID && i.CartItemID == cartItemId);

                        if (rOrder != null)
                        {
                            hcE.hccRecurringOrders.DeleteObject(rOrder);
                            hcE.SaveChanges();
                        }
                    }
                }
                catch (Exception) { }


                cartItem.Delete(((List <hccRecurringOrder>)Session["autorenew"]));
                OnCartItemListItemUpdated();
            }
            else
            {
                // couldnt find cart item
            }
        }
예제 #11
0
        //static healthychefEntities cont
        //{
        //    get { return healthychefEntities.Default; }
        //}

        public void Save()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    System.Data.EntityKey key = cont.CreateEntityKey("hccGlobalSettings", this);
                    object oldObj;

                    if (cont.TryGetObjectByKey(key, out oldObj))
                    {
                        cont.ApplyCurrentValues("hccGlobalSettings", this);
                    }
                    else
                    {
                        cont.hccGlobalSettings.AddObject(this);
                    }

                    cont.SaveChanges();
                }
            }
            catch { throw; }
        }
        public void Delete()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    EntityKey key          = cont.CreateEntityKey(this.EntityKey.EntitySetName, this);
                    object    originalItem = null;

                    if (cont.TryGetObjectByKey(key, out originalItem))
                    {
                        cont.hccMenuItemPreferences.DeleteObject((hccMenuItemPreference)originalItem);
                        cont.SaveChanges();

                        //cont.Refresh(System.Data.Objects.RefreshMode.StoreWins, cont.hccMenuItemPreferences);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Deletes alc menu item of cart from the database.
        /// </summary>
        /// <exception cref="System.Exception">re-thrown exception</exception>
        /// <returns>Returns void.</returns>
        public void Delete()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    var    key          = cont.CreateEntityKey("hccCartALCMenuItems", this);
                    object originalItem = null;

                    if (cont.TryGetObjectByKey(key, out originalItem))
                    {
                        var cartItem = (hccCartALCMenuItem)originalItem;

                        cont.hccCartALCMenuItems.DeleteObject(cartItem);
                        cont.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #14
0
        public static List <hcc_WeeklyMenuReport_Result> GetWeeklyMenuReport(DateTime startDate, DateTime endDate)
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    List <hcc_WeeklyMenuReport_Result> retVals = new List <hcc_WeeklyMenuReport_Result>();
                    List <hcc_WeeklyMenuReport_Result> inVals  = cont.hcc_WeeklyMenuReport(startDate, endDate).ToList();

                    inVals.ForEach(delegate(hcc_WeeklyMenuReport_Result inVal)
                    {
                        hcc_WeeklyMenuReport_Result retVal = new hcc_WeeklyMenuReport_Result
                        {
                            Allergens       = string.IsNullOrWhiteSpace(inVal.Allergens) ? string.Empty : "Allergens: " + inVal.Allergens,
                            DeliveryDate    = inVal.DeliveryDate,
                            Ingredients     = string.IsNullOrWhiteSpace(inVal.Ingredients) ? string.Empty : "Ingredients: " + inVal.Ingredients,
                            MealTypeDesc    = inVal.MealTypeDesc,
                            MealTypeID      = inVal.MealTypeID,
                            MenuID          = inVal.MenuID,
                            MenuItemDesc    = inVal.MenuItemDesc,
                            MenuItemID      = inVal.MenuItemID,
                            MenuItemName    = inVal.MenuItemName,
                            NutritionalInfo = string.IsNullOrWhiteSpace(inVal.NutritionalInfo) ? string.Empty : "Nutrition Info: " + inVal.NutritionalInfo,
                            Preferences     = string.IsNullOrWhiteSpace(inVal.Preferences) ? string.Empty : "Preferences: " + inVal.Preferences
                        };

                        retVals.Add(retVal);
                    });

                    return(retVals);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #15
0
        public bool RemoveFamilyStyle(int cartItemId)
        {
            try
            {
                int result = 0;

                using (var cont = new healthychefEntities())
                {
                    hccCartItem hcccartItem = cont.hccCartItems.FirstOrDefault(x => x.CartItemID == cartItemId);
                    if (hcccartItem != null)
                    {
                        if (hcccartItem.Plan_IsAutoRenew == true)
                        {
                            hcccartItem.Plan_IsAutoRenew = false;
                        }
                        else
                        {
                            hcccartItem.Plan_IsAutoRenew = true;
                        }
                        hcccartItem.Save();
                        result = 1;
                    }
                }
                if (result > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static List <hccPreference> GetBy(HealthyChef.Common.Enums.PreferenceType prefType, bool?isRetired)
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    var p = cont.hccPreferences
                            .Where(a => a.PreferenceType == (int)prefType)
                            .OrderBy(b => b.Name)
                            .ToList();

                    if (isRetired.HasValue)
                    {
                        p = p.Where(a => a.IsRetired == isRetired.Value).ToList();
                    }

                    return(p);
                }
            }
            catch
            {
                throw;
            }
        }
예제 #17
0
        public static List <ActiveCustomerDto> CreateQuery(DateTime startDate, DateTime endDate, int programId)
        {
            using (healthychefEntities context = new healthychefEntities())
            {
                context.CommandTimeout = 600;

                QueryDataObject dataObject = new QueryDataObject();
                dataObject.StartTime = startDate;
                dataObject.EndTime   = endDate;
                dataObject.ProgramId = programId;

                var query = context.hccCarts
                            .Where(c => c.StatusID == (int)Enums.CartStatus.Paid);

                if (programId == -3)
                {
                    return(new QueryGC(context, dataObject).Process(query));
                }
                else if (programId == -2)
                {
                    return(new QueryAlc(context, dataObject).Process(query));
                }
                else if (programId == -1)
                {
                    return(new QueryAll(context, dataObject).Process(query));
                }
                else if (programId == -4)
                {
                    return(new QueryAlcFamily(context, dataObject).Process(query));
                }
                else
                {
                    return(new QueryType(context, dataObject).Process(query));
                }
            }
        }
예제 #18
0
        //static healthychefEntities cont
        //{
        //    get { return healthychefEntities.Default; }
        //}

        public void Save()
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    System.Data.EntityKey key = cont.CreateEntityKey("hccLedgers", this);
                    object oldObj;

                    if (cont.TryGetObjectByKey(key, out oldObj))
                    {
                        cont.ApplyCurrentValues("hccLedgers", this);
                    }
                    else
                    {
                        cont.hccLedgers.AddObject(this);
                    }

                    cont.SaveChanges();
                    //cont.Refresh(System.Data.Objects.RefreshMode.StoreWins, this);
                }
            }
            catch { throw; }
        }
예제 #19
0
 /// <summary>
 /// This method gets all programs, with a specifier pertaining to program activation.
 /// </summary>
 /// <param name="isActive">Determines whether the method is to return records depending upon their IsActive flag; Active(true), Inactive(false), All(null)</param>
 /// <returns>List&lt;hccProgram&gt;</returns>
 /// <exception cref="System.Exception">re-thrown exception.</exception>
 public static List <hccProgram> GetBy(bool?isActive)
 {
     try
     {
         using (var cont = new healthychefEntities())
         {
             if (isActive.HasValue)
             {
                 return(cont.hccPrograms
                        .Where(a => a.IsActive == isActive)
                        .ToList());
             }
             else
             {
                 return(cont.hccPrograms
                        .ToList());
             }
         }
     }
     catch
     {
         throw;
     }
 }
        public void Page_Init(object sender, EventArgs e)
        {
            //lvRecurringOrders.DataBinding += lvRecurringOrders_DataBinding;
            //lvRecurringOrders.ItemDataBound += lvRecurringOrders_ItemDataBound;

            //lvAllRecurringOrders.DataBinding += lvAllRecurringOrders_DataBinding;
            //lvAllRecurringOrders.ItemDataBound += lvAllRecurringOrders_ItemDataBound;

            try
            {
                using (var hcE = new healthychefEntities())
                {
                    var roDeliveryDate = hcE.hcc_RecurringOrderByDeliveryDate();

                    MinCutOffDate = ((DateTime)roDeliveryDate.Min(x => x.maxcutoffdate)).AddDays(1);
                    //lvAllRecurringOrders.DataSource = hcE.hccRecurringOrders.ToList();
                    //lvAllRecurringOrders.DataSource = hcE.hcc_RecurringOrderByDeliveryDate().ToList();
                    //lvAllRecurringOrders.DataBind();
                }
            }
            catch
            {
            }
        }
        public static void Import(out int count)
        {
            using (StreamWriter writer = new StreamWriter(@"C:\HCCCustomerOutput.txt"))
            {
                Console.SetOut(writer);

                count = 0;
                List <string> errorReport = new List <string>();

                try
                {
                    List <ImportedCustomer> impCusts = GetAll();

                    foreach (ImportedCustomer impCust in impCusts)
                    {
                        Console.WriteLine(count + " : ");
                        if (!impCust.IsValid)
                        {
                            impCust.Email = "admin" + count.ToString() + "@healthychefcreations.com";
                        }
                        else if (impCust.Email.Contains("info@healthychef") || impCust.Email.Contains("thehealthyassistant@earthlink"))
                        {
                            impCust.Email = "admin" + count.ToString() + "@healthychefcreations.com";
                        }

                        Console.WriteLine(impCust.Email);

                        if (impCust.IsValid)
                        {
                            count++;

                            string         userName    = impCust.Email.Trim().Split('@')[0] + DateTime.Now.ToString("yyyyMMddHHmmtt");
                            string         password    = OrderNumberGenerator.GenerateOrderNumber("?#?#?#?#");
                            string         aspUserName = Membership.GetUserNameByEmail(impCust.Email.Trim());
                            MembershipUser newUser     = null;

                            if (!string.IsNullOrWhiteSpace(aspUserName))
                            {
                                newUser = Membership.GetUser(aspUserName);
                            }

                            MembershipCreateStatus createResult = MembershipCreateStatus.UserRejected;

                            if (newUser == null)
                            {
                                newUser = Membership.CreateUser(userName, password, impCust.Email.Trim(), "import", "import", true, out createResult);

                                if (newUser != null)
                                {
                                    Console.WriteLine(newUser.UserName + "New user.");
                                }
                            }
                            else
                            {
                                Console.WriteLine(newUser.UserName + " Existing user.");
                                createResult = MembershipCreateStatus.Success;
                            }

                            if (newUser != null)
                            {
                                if (createResult == MembershipCreateStatus.Success)
                                {
                                    //Assign Customer role to newUser
                                    try
                                    {
                                        if (!Roles.IsUserInRole(newUser.UserName, "Customer"))
                                        {
                                            Roles.AddUserToRole(newUser.UserName, "Customer");
                                            Console.WriteLine(newUser.UserName + " Role assigned.");
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(newUser.UserName + " =Assign role failed." + ex.Message + ex.StackTrace);
                                    }
                                    //Send E-mail notification to account user
                                    //HealthyChef.Email.EmailController ec = new HealthyChef.Email.EmailController();
                                    //ec.SendMail_NewUserConfirmation(email, password);

                                    //Create a Healthy Chef profile for this new user
                                    hccUserProfile newProfile = hccUserProfile.GetBy((Guid)newUser.ProviderUserKey).SingleOrDefault(a => !a.ParentProfileID.HasValue);

                                    if (newProfile == null)
                                    {
                                        try
                                        {
                                            newProfile = new hccUserProfile
                                            {
                                                MembershipID   = (Guid)newUser.ProviderUserKey,
                                                CreatedBy      = (Membership.GetUser() == null ? Guid.Empty : (Guid)Membership.GetUser().ProviderUserKey),
                                                CreatedDate    = DateTime.Now,
                                                AccountBalance = 0.00m,
                                                IsActive       = true,
                                                FirstName      = impCust.FirstName.Trim(),
                                                LastName       = impCust.LastName.Trim(),
                                                ProfileName    = impCust.FirstName.Trim()
                                            };

                                            //Save all hccProfile information
                                            using (var cont = new healthychefEntities())
                                            {
                                                System.Data.EntityKey key = cont.CreateEntityKey("hccUserProfiles", newProfile);
                                                object oldObj;

                                                if (cont.TryGetObjectByKey(key, out oldObj))
                                                {
                                                    cont.ApplyCurrentValues("hccUserProfiles", newProfile);
                                                }
                                                else
                                                {
                                                    cont.hccUserProfiles.AddObject(newProfile);
                                                }

                                                cont.SaveChanges();
                                            }
                                            //cont.Refresh(System.Data.Objects.RefreshMode.StoreWins, newProfile);
                                            Console.WriteLine(newUser.UserName + " New profile.");
                                        }
                                        catch (Exception)
                                        {
                                            Console.WriteLine("=" + newUser.UserName + " Save Profile failed.");
                                        }
                                    }
                                    else
                                    {
                                        Console.WriteLine(newUser.UserName + " Existing profile.");
                                        createResult = MembershipCreateStatus.Success;
                                    }

                                    if (newProfile != null && newProfile.UserProfileID > 0)
                                    {
                                        if (impCust.OtherDeliveryInfo != null && !string.IsNullOrWhiteSpace(impCust.OtherDeliveryInfo))
                                        {
                                            hccUserProfileNote shipNote = new hccUserProfileNote
                                            {
                                                DateCreated   = DateTime.Now,
                                                DisplayToUser = false,
                                                UserProfileID = newProfile.UserProfileID,
                                                IsActive      = true,
                                                Note          = impCust.OtherDeliveryInfo,
                                                NoteTypeID    = (int)Enums.UserProfileNoteTypes.ShippingNote
                                            };

                                            using (var cont = new healthychefEntities())
                                            {
                                                EntityKey key          = cont.CreateEntityKey("hccUserProfileNotes", shipNote);
                                                object    originalItem = null;

                                                if (cont.TryGetObjectByKey(key, out originalItem))
                                                {
                                                    cont.ApplyCurrentValues(key.EntitySetName, shipNote);
                                                }
                                                else
                                                {
                                                    cont.hccUserProfileNotes.AddObject(shipNote);
                                                }

                                                cont.SaveChanges();
                                            }
                                        }

                                        if (impCust.HowDidYouHear != null && !string.IsNullOrWhiteSpace(impCust.HowDidYouHear))
                                        {
                                            hccUserProfileNote hearNote = new hccUserProfileNote
                                            {
                                                DateCreated   = DateTime.Now,
                                                DisplayToUser = false,
                                                UserProfileID = newProfile.UserProfileID,
                                                IsActive      = true,
                                                Note          = impCust.HowDidYouHear,
                                                NoteTypeID    = (int)Enums.UserProfileNoteTypes.GeneralNote
                                            };

                                            using (var cont = new healthychefEntities())
                                            {
                                                EntityKey key          = cont.CreateEntityKey("hccUserProfileNotes", hearNote);
                                                object    originalItem = null;

                                                if (cont.TryGetObjectByKey(key, out originalItem))
                                                {
                                                    cont.ApplyCurrentValues(key.EntitySetName, hearNote);
                                                }
                                                else
                                                {
                                                    cont.hccUserProfileNotes.AddObject(hearNote);
                                                }

                                                cont.SaveChanges();
                                            }
                                        }

                                        try
                                        {
                                            //save Shipping Address
                                            hccAddress shipAddr = null;

                                            if (newProfile.ShippingAddressID.HasValue)
                                            {
                                                shipAddr = hccAddress.GetById(newProfile.ShippingAddressID.Value);
                                            }

                                            if (shipAddr != null)
                                            {
                                                try
                                                {
                                                    newProfile.ShippingAddressID = null;
                                                    //Save all hccProfile information
                                                    using (var cont = new healthychefEntities())
                                                    {
                                                        System.Data.EntityKey key1 = cont.CreateEntityKey("hccUserProfiles", newProfile);
                                                        object oldObj1;

                                                        if (cont.TryGetObjectByKey(key1, out oldObj1))
                                                        {
                                                            cont.ApplyCurrentValues("hccUserProfiles", newProfile);
                                                        }
                                                        else
                                                        {
                                                            cont.hccUserProfiles.AddObject(newProfile);
                                                        }
                                                        cont.SaveChanges();
                                                    }
                                                    //cont.Refresh(System.Data.Objects.RefreshMode.StoreWins, newProfile);
                                                    using (var cont = new healthychefEntities())
                                                    {
                                                        EntityKey key          = cont.CreateEntityKey("hccAddresses", shipAddr);
                                                        object    originalItem = null;

                                                        if (cont.TryGetObjectByKey(key, out originalItem))
                                                        {
                                                            cont.AttachTo(shipAddr.EntityKey.EntitySetName, shipAddr);
                                                            cont.DeleteObject(shipAddr);
                                                        }
                                                        cont.SaveChanges();
                                                    }

                                                    shipAddr = null;
                                                }
                                                catch (Exception ex)
                                                {
                                                    Console.WriteLine(newUser.UserName + " =Delete old shipping address failed." + ex.Message + ex.StackTrace);
                                                }
                                            }

                                            if (shipAddr == null)
                                            {
                                                shipAddr = new hccAddress();
                                            }

                                            if (impCust.ShippingAddress1 != null)
                                            {
                                                shipAddr.Address1 = (string.IsNullOrWhiteSpace(impCust.ShippingAddress1) ? "" : impCust.ShippingAddress1.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.Address1 = "";
                                            }

                                            if (impCust.ShippingAddress2 != null)
                                            {
                                                shipAddr.Address2 = (string.IsNullOrWhiteSpace(impCust.ShippingAddress2) ? "" : impCust.ShippingAddress2.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.Address2 = "";
                                            }

                                            if (impCust.ShippingAddress3 != null)
                                            {
                                                shipAddr.Address2 += " " + (string.IsNullOrWhiteSpace(impCust.ShippingAddress3) ? "" : impCust.ShippingAddress3.Trim());
                                            }

                                            shipAddr.AddressTypeID = (int)Enums.AddressType.Shipping;

                                            if (impCust.ShippingCity != null)
                                            {
                                                shipAddr.City = (string.IsNullOrWhiteSpace(impCust.ShippingCity) ? "" : impCust.ShippingCity.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.City = "";
                                            }

                                            shipAddr.Country = "US";

                                            if (impCust.FirstName != null)
                                            {
                                                shipAddr.FirstName = (string.IsNullOrWhiteSpace(impCust.FirstName) ? "" : impCust.FirstName.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.FirstName = "";
                                            }

                                            shipAddr.IsBusiness = false;

                                            if (impCust.LastName != null)
                                            {
                                                shipAddr.LastName = (string.IsNullOrWhiteSpace(impCust.LastName) ? "" : impCust.LastName.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.LastName = "";
                                            }

                                            if (impCust.Phone1 != null)
                                            {
                                                shipAddr.Phone = (string.IsNullOrWhiteSpace(impCust.Phone1) ? "" : impCust.Phone1.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.Phone = "";
                                            }

                                            if (impCust.Phone1Ext != null)
                                            {
                                                shipAddr.Phone += (string.IsNullOrWhiteSpace(impCust.Phone1Ext.Trim()) ? "" : " x" + impCust.Phone1Ext.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.Phone = "";
                                            }

                                            if (impCust.ShippingZipCode != null)
                                            {
                                                shipAddr.PostalCode = (string.IsNullOrWhiteSpace(impCust.ShippingZipCode) ? "" : impCust.ShippingZipCode.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.PostalCode = "";
                                            }

                                            if (impCust.ShippingState != null)
                                            {
                                                shipAddr.State = (string.IsNullOrWhiteSpace(impCust.ShippingState) ? "" : impCust.ShippingState.Trim());
                                            }
                                            else
                                            {
                                                shipAddr.State = "";
                                            }

                                            if (impCust.ShipMethod == null)
                                            {
                                                shipAddr.DefaultShippingTypeID = (int)Enums.DeliveryTypes.Delivery;
                                            }
                                            else if (impCust.ShipMethod.Trim() == "F")
                                            {
                                                shipAddr.DefaultShippingTypeID = (int)Enums.DeliveryTypes.Delivery;
                                            }
                                            else if (impCust.ShipMethod.Trim() == "P")
                                            {
                                                shipAddr.DefaultShippingTypeID = (int)Enums.DeliveryTypes.LocalPickUp;
                                            }
                                            else if (impCust.ShipMethod.Trim() == "D")
                                            {
                                                shipAddr.DefaultShippingTypeID = (int)Enums.DeliveryTypes.LocalDelivery;
                                            }
                                            else
                                            {
                                                shipAddr.DefaultShippingTypeID = (int)Enums.DeliveryTypes.Delivery;
                                            }

                                            if (shipAddr != null)
                                            {
                                                try
                                                {
                                                    using (var cont = new healthychefEntities())
                                                    {
                                                        EntityKey key          = cont.CreateEntityKey("hccAddresses", shipAddr);
                                                        object    originalItem = null;

                                                        if (cont.TryGetObjectByKey(key, out originalItem))
                                                        {
                                                            cont.hccAddresses.ApplyCurrentValues((hccAddress)originalItem);
                                                        }
                                                        else
                                                        {
                                                            cont.hccAddresses.AddObject(shipAddr);
                                                        }

                                                        cont.SaveChanges();
                                                    }
                                                    //cont.Refresh(System.Data.Objects.RefreshMode.StoreWins, shipAddr);
                                                }
                                                catch (Exception ex)
                                                {
                                                    Console.WriteLine(newUser.UserName + " =Shipping address save failed." + ex.Message + ex.StackTrace);
                                                }
                                            }

                                            if (shipAddr != null && shipAddr.AddressID > 0)
                                            {
                                                newProfile.ShippingAddressID = shipAddr.AddressID;
                                            }
                                            else
                                            {
                                                newProfile.ShippingAddressID = null;
                                            }

                                            using (var cont = new healthychefEntities())
                                            {
                                                System.Data.EntityKey upkey = cont.CreateEntityKey("hccUserProfiles", newProfile);
                                                object oldObj;

                                                if (cont.TryGetObjectByKey(upkey, out oldObj))
                                                {
                                                    cont.ApplyCurrentValues("hccUserProfiles", newProfile);
                                                }
                                                else
                                                {
                                                    cont.hccUserProfiles.AddObject(newProfile);
                                                }

                                                cont.SaveChanges();
                                            }

                                            Console.WriteLine(newUser.UserName + " Shipping address saved.");
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(newUser.UserName + " =Shipping address not created." + ex.Message + ex.StackTrace);
                                        }
                                    }
                                    else
                                    {
                                        Console.WriteLine("User Profile for user: "******" ID not created.");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine("=New user for user: "******" not created.");
                                }
                            }
                            else
                            {
                                Console.WriteLine(createResult.ToString() + " : " + impCust.Email);
                            }
                        }
                        else
                        {
                            count++; Console.WriteLine("=Customer: " + impCust.FirstName + " " + impCust.LastName + " has no email address.");
                        }
                    }
                }
                catch (Exception ex) { Console.WriteLine("=" + ex.Message + " : " + ex.StackTrace); }
            }
        }
예제 #22
0
 public QueryAll(healthychefEntities context, QueryDataObject data)
 {
     Context = context;
     Data    = data;
 }
예제 #23
0
 public QueryAlc(healthychefEntities context, QueryDataObject data) : base(context, data)
 {
 }
예제 #24
0
        private void BindPanels(Enums.MealTabItems mealTabType)
        {
            //get mealTabType from ViewState
            mealTabType = (Enums.MealTabItems)MealTabSelected;
            RemoveButtonStyle();

            try
            {
                // Get the menus available for the date
                DeliveryDate = DateTime.Parse(ddlDeliveryDate.SelectedValue);

                using (var hcc = new healthychefEntities())
                {
                    switch (mealTabType)
                    {
                    case Enums.MealTabItems.Breakfast:
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.BreakfastEntree));
                        var _breakfastSides = hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.BreakfastSide);
                        if (_unionResult == null)
                        {
                            _unionResult = _iresult;
                        }

                        MealTabRepeater.LoadAlcMenuItems(DeliveryDate, Enums.MealTypes.BreakfastEntree, _unionResult, _breakfastSides);
                        break;

                    case Enums.MealTabItems.Lunch:
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.LunchEntree));
                        var _lunchSides = hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.LunchSide);
                        if (_unionResult == null)
                        {
                            _unionResult = _iresult;
                        }

                        MealTabRepeater.LoadAlcMenuItems(DeliveryDate, Enums.MealTypes.LunchEntree, _unionResult, _lunchSides);
                        break;

                    case Enums.MealTabItems.Dinner:
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.DinnerEntree));
                        var _dinnerSides = hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.DinnerSide);
                        if (_unionResult == null)
                        {
                            _unionResult = _iresult;
                        }

                        MealTabRepeater.LoadAlcMenuItems(DeliveryDate, Enums.MealTypes.DinnerEntree, _unionResult, _dinnerSides);
                        break;

                    case Enums.MealTabItems.Child:
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.ChildEntree));
                        var _childSides = hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.ChildSide);
                        if (_unionResult == null)
                        {
                            _unionResult = _iresult;
                        }

                        MealTabRepeater.LoadAlcMenuItems(DeliveryDate, Enums.MealTypes.ChildEntree, _unionResult, _childSides);
                        break;

                    case Enums.MealTabItems.Dessert:
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Dessert));
                        if (_unionResult == null)
                        {
                            _unionResult = _iresult;
                        }

                        MealTabRepeater.LoadAlcMenuItems(DeliveryDate, Enums.MealTypes.Dessert, _unionResult);
                        break;

                    case Enums.MealTabItems.Other:
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.OtherEntree));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Soup));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Salad));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Beverage));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Goods));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Snack));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Supplement));
                        CombineDataResults(hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.Miscellaneous));
                        var _otherSides = hcc.hcc_AlcMenu2(DeliveryDate, (int)Enums.MealTypes.OtherSide);
                        if (_unionResult == null)
                        {
                            _unionResult = _iresult;
                        }

                        MealTabRepeater.LoadAlcMenuItems(DeliveryDate, Enums.MealTypes.OtherEntree, _unionResult, _otherSides);
                        break;

                    default:
                        break;
                    }
                }
                return;
            }
            catch (FormatException)
            {
            }
        }
예제 #25
0
        /// <summary>
        /// Deletes the hccCartItem object.
        /// </summary>
        /// <exception cref="System.Exception">re-thrown exception</exception>
        /// <returns>Returns void.</returns>
        public void Delete(List <hccRecurringOrder> recurringItemList)
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    System.Data.EntityKey key = cont.CreateEntityKey("hccCartItems", this);
                    object originalItem       = null;

                    if (cont.TryGetObjectByKey(key, out originalItem))
                    {
                        hccCartItem cartItem = (hccCartItem)originalItem;

                        if (((Enums.CartItemType)cartItem.ItemTypeID) == Enums.CartItemType.AlaCarte)
                        {
                            List <hccCartItemMealPreference> prefs = hccCartItemMealPreference.GetBy(cartItem.CartItemID);
                            prefs.ForEach(a => a.Delete());
                        }
                        else if (((Enums.CartItemType)cartItem.ItemTypeID) == Enums.CartItemType.DefinedPlan)
                        {
                            List <hccCartItemMealPreference> prefs = hccCartItemMealPreference.GetBy(cartItem.CartItemID);
                            prefs.ForEach(a => a.Delete());

                            List <hccCartItemCalendar> cartCals = hccCartItemCalendar.GetByCartItemID(cartItem.CartItemID);

                            cartCals.ForEach(delegate(hccCartItemCalendar cartCal)
                            {
                                List <hccCartDefaultMenuException> menuExs = hccCartDefaultMenuException.GetBy(cartCal.CartCalendarID);
                                foreach (var defaultmenu in menuExs)
                                {
                                    int defaultmenexceptionid = defaultmenu.DefaultMenuExceptID;
                                    var cartDefaultMenuExPref = hccCartDefaultMenuExPref.GetBy(defaultmenexceptionid);
                                    if (cartDefaultMenuExPref.Count() > 0)
                                    {
                                        cartDefaultMenuExPref.ForEach(a => a.Delete());
                                    }
                                }
                                menuExs.ForEach(a => a.Delete());
                            });

                            cartCals.ForEach(delegate(hccCartItemCalendar cartCal)
                            {
                                cartCal.Delete();
                            });
                        }

                        if (HttpContext.Current.Session["id"] != null && HttpContext.Current.Session["meals"] != null)
                        {
                            cartItem.CartID        = (int)HttpContext.Current.Session["id"];
                            cartItem.NumberOfMeals = (int)HttpContext.Current.Session["meals"];
                        }
                        var hcccartMenuExPrefs = hccCartMenuExPref.GetByCartItem(cartItem.CartItemID);
                        if (hcccartMenuExPrefs.Count() > 0)
                        {
                            hcccartMenuExPrefs.ForEach(a => a.Delete());
                        }
                        cont.hccCartItems.DeleteObject(cartItem);
                        cont.SaveChanges();

                        // Check for recurring items
                        if (recurringItemList != null)
                        {
                            var itemDeleted = recurringItemList.Find(x => x.CartID == this.CartID && x.CartItemID == this.CartItemID);
                            recurringItemList.Remove(itemDeleted);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #26
0
        public static List <MOTCartItem> Search_MealOrderTicketForMOT(DateTime?startDate, DateTime?endDate)
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    List <MOTCartItem> motItems = new List <MOTCartItem>();

                    List <hccCartItem> alcgc = cont.hcc_OrderFulfillSearch_ALCnGC_ByRange(startDate, endDate).Select(x => new hccCartItem
                    {
                        CartItemID              = Convert.ToInt32(x.CartItemID),
                        CartID                  = Convert.ToInt32(x.CartID),
                        UserProfileID           = Convert.ToInt32(x.UserProfileID),
                        ItemTypeID              = Convert.ToInt32(x.ItemTypeID),
                        ItemName                = x.ItemName,
                        ItemDesc                = x.ItemDesc,
                        ItemPrice               = Convert.ToDecimal(x.ItemPrice),
                        Quantity                = Convert.ToInt32(x.Quantity),
                        IsTaxable               = Convert.ToBoolean(x.IsTaxable),
                        OrderNumber             = x.OrderNumber,
                        DeliveryDate            = Convert.ToDateTime(x.DeliveryDate),
                        Gift_RedeemCode         = x.Gift_RedeemCode,
                        Gift_IssuedTo           = x.Gift_IssuedTo,
                        Gift_IssuedDate         = x.Gift_IssuedDate,
                        Gift_RedeemedBy         = x.Gift_RedeemedBy,
                        Gift_RedeemedDate       = x.Gift_RedeemedDate,
                        Gift_RecipientAddressId = x.Gift_RecipientAddressId,
                        Gift_RecipientEmail     = x.Gift_RecipientEmail,
                        Gift_RecipientMessage   = x.Gift_RecipientMessage,
                        Meal_MenuItemID         = x.Meal_MenuItemID,
                        Meal_MealSizeID         = x.Meal_MealSizeID,
                        Meal_ShippingCost       = x.Meal_ShippingCost,
                        Plan_PlanID             = x.Plan_PlanID,
                        Plan_ProgramOptionID    = x.Plan_ProgramOptionID,
                        Plan_IsAutoRenew        = x.Plan_IsAutoRenew,
                        CreatedBy               = x.CreatedBy,
                        CreatedDate             = Convert.ToDateTime(x.CreatedDate),
                        IsCompleted             = Convert.ToBoolean(x.IsCompleted),
                        IsCancelled             = Convert.ToBoolean(x.IsCancelled),
                        IsFulfilled             = Convert.ToBoolean(x.IsFulfilled),
                        DiscountPerEach         = Convert.ToDecimal(x.DiscountPerEach),
                        DiscountAdjPrice        = Convert.ToDecimal(x.DiscountAdjPrice),
                        SnapBillAddrId          = x.SnapBillAddrId,
                        SnapShipAddrId          = x.SnapShipAddrId,
                        TaxRate                 = x.TaxRate,
                        TaxableAmount           = x.TaxableAmount,
                        DiscretionaryTaxAmount  = x.DiscretionaryTaxAmount,
                        TaxRateAssigned         = x.TaxRateAssigned
                    }).ToList();

                    motItems.AddRange(MOTCartItem.GetFromRange(alcgc));

                    var progs = cont.hcc_OrderFulfillSearch_Programs_ByRange(startDate, endDate).ToList();
                    motItems.AddRange(MOTCartItem.GetFromRangeForMOT(progs));

                    return(motItems.OrderBy(a => a.DeliveryDate)
                           .ThenBy(a => a.ItemName).ThenBy(a => a.OrderNumber.Contains("ALC")).ThenBy(a => a.CustomerName).ToList());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #27
0
        //void btnSearch_Click(object sender, EventArgs e)
        //{
        //    BindlvwOrders();
        //}

        //void btnClear_Click(object sender, EventArgs e)
        //{
        //    Clear();
        //    Bind();
        //}
        void btnCreateShippingFile_Click(object sender, EventArgs e)
        {
            string lastName = null;

            if (!string.IsNullOrWhiteSpace(txtSearchLastName.Text.Trim()))
            {
                lastName = txtSearchLastName.Text.Trim();
            }

            string email = null;

            if (!string.IsNullOrWhiteSpace(txtSearchEmail.Text.Trim()))
            {
                email = txtSearchEmail.Text.Trim();
            }

            int?purchNum = null;

            if (!string.IsNullOrWhiteSpace(txtSearchPurchNum.Text.Trim()))
            {
                purchNum = int.Parse(txtSearchPurchNum.Text.Trim());
            }

            DateTime?delDate = null;

            if (ddlDelDates.SelectedIndex > 0)
            {
                delDate = DateTime.Parse(ddlDelDates.SelectedItem.Text.Trim());
            }

            List <AggrCartItem> agItems = hccCartItem.Search(lastName, email, purchNum, delDate, false, false);

            if (ddlStatus.SelectedIndex != 0)
            {
                agItems = agItems.Where(a => a.SimpleStatus == ddlStatus.SelectedItem.Text).ToList();
            }

            if (ddlTypes.SelectedIndex != 0)
            {
                agItems = agItems.Where(a => a.CartItem.ItemType == ((Enums.CartItemType)(int.Parse(ddlTypes.SelectedValue)))).ToList();
            }


            List <int> cartItemIds = (from item in agItems select item.CartItemId).ToList();

            using (healthychefEntities hce = new healthychefEntities())
            {
                var items = (from he in hce.hccCartItems where cartItemIds.Contains(he.CartItemID) && !he.IsCancelled && !he.IsFulfilled select he);

                var orders = (from ag in
                              (from agi in items
                               orderby agi.OrderNumber, agi.DeliveryDate, agi.SnapShipAddrId, agi.UserProfileID
                               select agi)
                              join up in hce.hccUserProfiles on ag.UserProfileID equals up.UserProfileID
                              join mp in hce.aspnet_Membership on up.MembershipID equals mp.UserId
                              group ag by new
                {
                    OrderNumber = ag.OrderNumber,
                    PurchaseNumber = (ag.hccCart == null ? 0 : ag.hccCart.PurchaseNumber),
                    SnapShipAddrId = ag.SnapShipAddrId,
                    Email = (mp == null ? "" : mp.Email),
                    UserProfileId = ag.UserProfileID
                }
                              into agag
                              select new { agag.Key.OrderNumber, agag.Key.SnapShipAddrId, agag.Key.PurchaseNumber, agag.Key.Email, agag.Key.UserProfileId });
                var orderDetails = (from o in orders
                                    join a in hce.hccAddresses on o.SnapShipAddrId equals a.AddressID
                                    where a != null
                                    select new ShippingLabelDetails
                {
                    OrderNumber = o.OrderNumber,
                    UserProfileId = o.UserProfileId,
                    PurchaseNum = o.PurchaseNumber,
                    Company = "",
                    Contact = a.FirstName + " " + a.LastName,
                    Address1 = (a.Address1 == null ? "" : a.Address1),
                    Address2 = (a.Address2 == null ? "" : a.Address2),
                    City = (a.City == null ? "" : a.City),
                    StateProvince = (a.State == null ? "" : a.State),
                    Country = (a.Country == null ? "" : a.Country),
                    Zip = (a.PostalCode == null ? "" : a.PostalCode),
                    Phone = (a.Phone == null ? "" : a.Phone),
                    Email = (o.Email == null ? "" : o.Email)
                }).ToList();

                List <ShippingLabelDetails> ordersRefined = orderDetails.Distinct(new ShippingLabelDetailsComparer()).ToList();

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.AppendLine("Purchase#,Company,Contact,Address1,Address2,City,State/Province,Country,Zip,Phone,Email,Delivery_Instructions");
                foreach (var detail in ordersRefined)
                {
                    string shippingNote = string.Join(";", (from n in hce.hccUserProfileNotes where n.UserProfileID == detail.UserProfileId && n.NoteTypeID == 2 select n.Note));
                    sb.AppendLine(detail.OrderNumber + ",\"" +
                                  detail.Company.Replace("\"", "\"\"") + "\",\"" + detail.Contact.Replace("\"", "\"\"") + "\",\"" +
                                  detail.Address1.Replace("\"", "\"\"") + "\",\"" + detail.Address2.Replace("\"", "\"\"") + "\",\"" +
                                  detail.City.Replace("\"", "\"\"") + "\",\"" + detail.StateProvince.Replace("\"", "\"\"") + "\",\"" +
                                  detail.Country.Replace("\"", "\"\"") + "\",\"" + detail.Zip.Replace("\"", "\"\"") + "\",\"" +
                                  detail.Phone.Replace("\"", "\"\"") + "\",\"" + detail.Email.Replace("\"", "\"\"") + "\",\"" +
                                  shippingNote.Replace("\"", "\"\"") + "\"");
                }
                HttpContext.Current.Response.Write(sb.ToString());
                HttpContext.Current.Response.ContentType = "text/csv";
                HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + "Shipping_export.csv");
                HttpContext.Current.Response.End();
            }
        }
예제 #28
0
        public static List <AggrCartItem> Search(string lastName, string email, int?purchNum, DateTime?deliveryDate, bool includeSnapshots, bool includeGiftCerts)
        {
            try
            {
                using (var cont = new healthychefEntities())
                {
                    List <AggrCartItem> aggrItems = new List <AggrCartItem>();

                    List <hccCartItem> alcgc;

                    if (includeGiftCerts)
                    {
                        alcgc = cont.hcc_OrderFulfillSearch_ALCnGC(deliveryDate, purchNum, lastName, email).Select(x => new hccCartItem
                        {
                            CartItemID              = x.CartItemID,
                            CartID                  = Convert.ToInt32(x.CartID),
                            UserProfileID           = Convert.ToInt32(x.UserProfileID),
                            ItemTypeID              = Convert.ToInt32(x.ItemTypeID),
                            ItemName                = x.ItemName,
                            ItemDesc                = x.ItemDesc,
                            ItemPrice               = Convert.ToDecimal(x.ItemPrice),
                            Quantity                = Convert.ToInt32(x.Quantity),
                            IsTaxable               = Convert.ToBoolean(x.IsTaxable),
                            OrderNumber             = x.OrderNumber,
                            DeliveryDate            = Convert.ToDateTime(x.DeliveryDate),
                            Gift_RedeemCode         = x.Gift_RedeemCode,
                            Gift_IssuedTo           = x.Gift_IssuedTo,
                            Gift_IssuedDate         = x.Gift_IssuedDate,
                            Gift_RedeemedBy         = x.Gift_RedeemedBy,
                            Gift_RedeemedDate       = x.Gift_RedeemedDate,
                            Gift_RecipientAddressId = x.Gift_RecipientAddressId,
                            Gift_RecipientEmail     = x.Gift_RecipientEmail,
                            Gift_RecipientMessage   = x.Gift_RecipientMessage,
                            Meal_MenuItemID         = x.Meal_MenuItemID,
                            Meal_MealSizeID         = x.Meal_MealSizeID,
                            Meal_ShippingCost       = x.Meal_ShippingCost,
                            Plan_PlanID             = x.Plan_PlanID,
                            Plan_ProgramOptionID    = x.Plan_ProgramOptionID,
                            Plan_IsAutoRenew        = x.Plan_IsAutoRenew,
                            CreatedBy               = x.CreatedBy,
                            CreatedDate             = Convert.ToDateTime(x.CreatedDate),
                            IsCompleted             = Convert.ToBoolean(x.IsCompleted),
                            IsCancelled             = Convert.ToBoolean(x.IsCancelled),
                            IsFulfilled             = Convert.ToBoolean(x.IsFulfilled),
                            DiscountPerEach         = Convert.ToDecimal(x.DiscountPerEach),
                            DiscountAdjPrice        = Convert.ToDecimal(x.DiscountAdjPrice),
                            SnapBillAddrId          = x.SnapBillAddrId,
                            SnapShipAddrId          = x.SnapShipAddrId,
                            TaxRate                 = x.TaxRate,
                            TaxableAmount           = x.TaxableAmount,
                            DiscretionaryTaxAmount  = x.DiscretionaryTaxAmount,
                            TaxRateAssigned         = x.TaxRateAssigned
                        }).ToList();
                    }
                    else
                    {
                        alcgc = cont.hcc_OrderFulfillSearch_ALCnGC(deliveryDate, purchNum, lastName, email).ToList().Where(a => a.ItemTypeID != Convert.ToInt32(Enums.CartItemType.GiftCard)).Select(x => new hccCartItem
                        {
                            CartItemID              = x.CartItemID,
                            CartID                  = Convert.ToInt32(x.CartID),
                            UserProfileID           = Convert.ToInt32(x.UserProfileID),
                            ItemTypeID              = Convert.ToInt32(x.ItemTypeID),
                            ItemName                = x.ItemName,
                            ItemDesc                = x.ItemDesc,
                            ItemPrice               = Convert.ToDecimal(x.ItemPrice),
                            Quantity                = Convert.ToInt32(x.Quantity),
                            IsTaxable               = Convert.ToBoolean(x.IsTaxable),
                            OrderNumber             = x.OrderNumber,
                            DeliveryDate            = Convert.ToDateTime(x.DeliveryDate),
                            Gift_RedeemCode         = x.Gift_RedeemCode,
                            Gift_IssuedTo           = x.Gift_IssuedTo,
                            Gift_IssuedDate         = x.Gift_IssuedDate,
                            Gift_RedeemedBy         = x.Gift_RedeemedBy,
                            Gift_RedeemedDate       = x.Gift_RedeemedDate,
                            Gift_RecipientAddressId = x.Gift_RecipientAddressId,
                            Gift_RecipientEmail     = x.Gift_RecipientEmail,
                            Gift_RecipientMessage   = x.Gift_RecipientMessage,
                            Meal_MenuItemID         = x.Meal_MenuItemID,
                            Meal_MealSizeID         = x.Meal_MealSizeID,
                            Meal_ShippingCost       = x.Meal_ShippingCost,
                            Plan_PlanID             = x.Plan_PlanID,
                            Plan_ProgramOptionID    = x.Plan_ProgramOptionID,
                            Plan_IsAutoRenew        = x.Plan_IsAutoRenew,
                            CreatedBy               = x.CreatedBy,
                            CreatedDate             = Convert.ToDateTime(x.CreatedDate),
                            IsCompleted             = Convert.ToBoolean(x.IsCompleted),
                            IsCancelled             = Convert.ToBoolean(x.IsCancelled),
                            IsFulfilled             = Convert.ToBoolean(x.IsFulfilled),
                            DiscountPerEach         = Convert.ToDecimal(x.DiscountPerEach),
                            DiscountAdjPrice        = Convert.ToDecimal(x.DiscountAdjPrice),
                            SnapBillAddrId          = x.SnapBillAddrId,
                            SnapShipAddrId          = x.SnapShipAddrId,
                            TaxRate                 = x.TaxRate,
                            TaxableAmount           = x.TaxableAmount,
                            DiscretionaryTaxAmount  = x.DiscretionaryTaxAmount,
                            TaxRateAssigned         = x.TaxRateAssigned
                        }).ToList();
                    }

                    aggrItems.AddRange(AggrCartItem.GetFromRange(alcgc, includeSnapshots));

                    List <hccCartItemCalendar> progs = cont.hcc_OrderFulfillSearch_Programs(deliveryDate, purchNum, lastName, email).ToList();

                    aggrItems.AddRange(AggrCartItem.GetFromRange(progs, includeSnapshots));

                    return(aggrItems);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }