Exemplo n.º 1
0
        public static void ExcludeGroupModal(int idGroupModal)
        {
            using (var context = new Entity.OiWeb())
            {
                var dataGroupModalPages = context.GroupModalPages.Where(p => p.idGroupModal == idGroupModal).ToList();
                if (dataGroupModalPages != null)
                {
                    context.GroupModalPages.RemoveRange(dataGroupModalPages);
                    context.SaveChanges();
                }

                var dataGroupModalCities = context.GroupModalCities.Where(p => p.idGroupModal == idGroupModal).ToList();
                if (dataGroupModalCities != null)
                {
                    context.GroupModalCities.RemoveRange(dataGroupModalCities);
                    context.SaveChanges();
                }

                var data = context.GroupModals.Find(idGroupModal);
                if (data != null)
                {
                    context.GroupModals.Remove(data);
                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 2
0
        public static void Delete(int idPlan, int idPriceGroup)
        {
            using (var context = new Entity.OiWeb())
            {
                var deletePrices =
                    from prices in context.Prices
                    where prices.idPlan == idPlan &&
                    prices.idPriceGroup == idPriceGroup
                    select prices;

                foreach (var price in deletePrices)
                {
                    context.Prices.Remove(price);
                }

                context.SaveChanges();

                var deletePlanGroup =
                    from planGroup in context.PlanGroups
                    where planGroup.idPlan == idPlan &&
                    planGroup.idPriceGroup == idPriceGroup
                    select planGroup;

                foreach (var planGroups in deletePlanGroup)
                {
                    context.PlanGroups.Remove(planGroups);
                }

                context.SaveChanges();
            }
        }
Exemplo n.º 3
0
        public static void Delete(int idPage)
        {
            using (var context = new Entity.OiWeb())
            {
                var dataGroupCustomDataPages = context.GroupCustomDataPages.Where(p => p.idPage == idPage).ToList();
                if (dataGroupCustomDataPages != null)
                {
                    context.GroupCustomDataPages.RemoveRange(dataGroupCustomDataPages);
                    context.SaveChanges();
                }

                var dataGroupModalPages = context.GroupModalPages.Where(p => p.idPage == idPage).ToList();
                if (dataGroupModalPages != null)
                {
                    context.GroupModalPages.RemoveRange(dataGroupModalPages);
                    context.SaveChanges();
                }

                var dataPage = context.Pages.Find(idPage);
                if (dataPage != null)
                {
                    context.Pages.Remove(dataPage);
                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 4
0
        public static void UpdateUser(Entity.CMS_Account account)
        {
            if (account.password != null)
            {
                var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(account.password);
                account.password = System.Convert.ToBase64String(plainTextBytes);
            }
            using (var context = new Entity.OiWeb())
            {
                var query = (from c in context.CMS_Account
                             where c.idAccount == account.idAccount
                             select c).First();


                query.name = account.name;
                if (account.password == "" || account.password == null)
                {
                    account.password = query.password;
                }
                query.password = account.password;
                query.email    = account.email;
                query.isActive = account.isActive;
                context.SaveChanges();
            }
        }
Exemplo n.º 5
0
 public static void Insert(List <PriceGroupCity> datas)
 {
     using (var context = new Entity.OiWeb())
     {
         context.PriceGroupCities.AddRange(datas);
         context.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public static void Insert(Entity.GroupCustomDataPage data)
 {
     using (var context = new Entity.OiWeb())
     {
         context.GroupCustomDataPages.Add(data);
         context.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public static void Insert(List <Entity.GroupCustomDataPage> datas)
 {
     using (var context = new Entity.OiWeb())
     {
         context.GroupCustomDataPages.AddRange(datas);
         context.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public static void Create(Entity.PlanProduct planProduct)
 {
     using (var context = new Entity.OiWeb())
     {
         context.PlanProducts.Add(planProduct);
         context.SaveChanges();
     }
 }
Exemplo n.º 9
0
 public static void Insert(Entity.PlanRegulation data)
 {
     using (var context = new Entity.OiWeb())
     {
         context.PlanRegulations.Add(data);
         context.SaveChanges();
     }
 }
Exemplo n.º 10
0
 public static void Create(Entity.CMS_AccountLoginLog accountLoginLog)
 {
     using (var context = new Entity.OiWeb())
     {
         context.CMS_AccountLoginLog.Add(accountLoginLog);
         context.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public static void Insert(PriceGroupCity data)
 {
     using (var context = new Entity.OiWeb())
     {
         context.PriceGroupCities.Add(data);
         context.SaveChanges();
     }
 }
Exemplo n.º 12
0
 public static void CreatePlanGroup(Entity.PlanGroup planGroup)
 {
     using (var context = new Entity.OiWeb())
     {
         context.PlanGroups.Add(planGroup);
         context.SaveChanges();
     }
 }
Exemplo n.º 13
0
 public static void Save(Entity.PriceGroup group)
 {
     using (var context = new Entity.OiWeb())
     {
         context.PriceGroups.Add(group);
         context.SaveChanges();
     }
 }
Exemplo n.º 14
0
 public static void Create(Entity.Page page)
 {
     using (var context = new Entity.OiWeb())
     {
         context.Pages.Add(page);
         context.SaveChanges();
     }
 }
Exemplo n.º 15
0
        public static void RemoveByIdPriceGroup(int id)
        {
            using (var context = new Entity.OiWeb())
            {
                var datas = context.PriceGroupCities.Where(w => w.idPriceGroup == id).ToList();

                context.PriceGroupCities.RemoveRange(datas);
                context.SaveChanges();
            }
        }
Exemplo n.º 16
0
        public static void RemoveByIdGroupAndPage(int idGroup, int idPage)
        {
            using (var context = new Entity.OiWeb())
            {
                var datas = context.GroupCustomDataPages.Where(w => w.idGroup == idGroup && w.idPage == idPage).ToList();

                context.GroupCustomDataPages.RemoveRange(datas);
                context.SaveChanges();
            }
        }
Exemplo n.º 17
0
        public static void ExcludeCustomData(int idGroup)
        {
            using (var context = new Entity.OiWeb())
            {
                var dataGroupCustomDataPages = context.GroupCustomDataPages.Where(p => p.idGroup == idGroup).ToList();
                if (dataGroupCustomDataPages != null)
                {
                    context.GroupCustomDataPages.RemoveRange(dataGroupCustomDataPages);
                    context.SaveChanges();
                }

                var dataGroupCustomData = context.GroupCustomDatas.Find(idGroup);
                if (dataGroupCustomData != null)
                {
                    context.GroupCustomDatas.Remove(dataGroupCustomData);
                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 18
0
 public static void Create(Entity.GroupCustomData groupCustomData)
 {
     using (var context = new Entity.OiWeb())
     {
         groupCustomData.isActive = true;
         groupCustomData.dtCreate = DateTime.Now;
         context.GroupCustomDatas.Add(groupCustomData);
         context.SaveChanges();
     }
 }
Exemplo n.º 19
0
        public static void InsertGroupModal(Entity.GroupModal entity)
        {
            entity.dtCreate = DateTime.Now;

            using (var context = new Entity.OiWeb())
            {
                context.GroupModals.Add(entity);
                context.SaveChanges();
            }
        }
Exemplo n.º 20
0
 public static void SaveUser(Entity.CMS_Account account)
 {
     using (var context = new Entity.OiWeb())
     {
         account.dtCreate = DateTime.Now;
         var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(account.password);
         account.password = System.Convert.ToBase64String(plainTextBytes);
         context.CMS_Account.Add(account);
         context.SaveChanges();
     }
 }
Exemplo n.º 21
0
 public static void DesvinculaGroupPage(int idGroup, int idPage)
 {
     using (var context = new Entity.OiWeb())
     {
         var dataGroupCustomDataPages = context.GroupCustomDataPages.Where(p => p.idGroup == idGroup && p.idPage == idPage).ToList();
         if (dataGroupCustomDataPages != null)
         {
             context.GroupCustomDataPages.RemoveRange(dataGroupCustomDataPages);
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 22
0
 public static void Remove(int idPlanRegulation)
 {
     using (var context = new Entity.OiWeb())
     {
         var data = context.PlanRegulations.Find(idPlanRegulation);
         if (data != null)
         {
             context.PlanRegulations.Remove(data);
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 23
0
 public static void DesvincularGroup(int idModal, int idGroupModal)
 {
     using (var context = new Entity.OiWeb())
     {
         var dataGroupModalPages = context.GroupModalPages.Where(p => p.idModal == idModal && p.idGroupModal == idGroupModal).ToList();
         if (dataGroupModalPages != null)
         {
             context.GroupModalPages.RemoveRange(dataGroupModalPages);
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 24
0
        public static void Update(Entity.GroupCustomData groupCustomData)
        {
            using (var context = new Entity.OiWeb())
            {
                var query = (from c in context.GroupCustomDatas
                             where c.idGroup == groupCustomData.idGroup
                             select c).First();

                query.name        = groupCustomData.name;
                query.description = groupCustomData.description;

                context.SaveChanges();
            }
        }
Exemplo n.º 25
0
        public static void Update(Entity.Page page)
        {
            using (var context = new Entity.OiWeb())
            {
                var query = (from c in context.Pages
                             where c.idPage == page.idPage
                             select c).First();

                query.name        = page.name;
                query.description = page.description;
                query.isCommon    = page.isCommon;
                query.isActive    = page.isActive;
                context.SaveChanges();
            }
        }
Exemplo n.º 26
0
        public static void Update(Entity.PlanProduct planProduct)
        {
            using (var context = new Entity.OiWeb())
            {
                var query = (from c in context.PlanProducts
                             where c.idPlan == planProduct.idPlan
                             select c).First();

                query.isVisible     = planProduct.isVisible;
                query.linkEcommerce = planProduct.linkEcommerce;
                query.name          = planProduct.name;
                query.defaultSKU    = planProduct.defaultSKU;
                query.description   = planProduct.description;
                context.SaveChanges();
            }
        }
Exemplo n.º 27
0
        public static void Update(Entity.PlanRegulation data)
        {
            using (var context = new Entity.OiWeb())
            {
                var planregulation = context.PlanRegulations.Find(data.idPlanRegulation);

                if (planregulation != null)
                {
                    context.PlanRegulations.Attach(planregulation);
                    var entry = context.Entry(planregulation);
                    entry.Property(e => e.name).IsModified = true;
                    entry.Property(e => e.link).IsModified = true;
                    entry.Property(e => e.type).IsModified = true;

                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 28
0
        public static void UpdateModal(Entity.Modal data)
        {
            using (var context = new Entity.OiWeb())
            {
                var modal = context.Modals.Find(data.idModal);

                if (modal != null)
                {
                    modal.name        = data.name;
                    modal.description = data.description;

                    context.Modals.Attach(modal);
                    var entry = context.Entry(modal);
                    entry.Property(e => e.name).IsModified        = true;
                    entry.Property(e => e.description).IsModified = true;

                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 29
0
        public static void Update(Entity.Price price)
        {
            using (var context = new Entity.OiWeb())
            {
                var query = (from c in context.Prices
                             where c.idPlan == price.idPlan &&
                             c.idPriceGroup == price.idPriceGroup &&
                             c.idPriceLoyalty == price.idPriceLoyalty
                             select c).FirstOrDefault();

                if (query == null)
                {
                    context.Prices.Add(price);
                }
                else
                {
                    query.value      = price.value;
                    query.valueCombo = price.valueCombo;
                }
                context.SaveChanges();
            }
        }