public static bool DeleteByService(entitiesEvolveCentral ctx, int id, bool deleteUnique)
        {
            var item = new ServiceCrmEvolutionDetailItem();

            try
            {
                DAL.ServiceCrmEvolutionItem sitem = DAL.ServiceCrmEvolution.Get(ctx, id);

                DAL.ServiceTemplateCrmEvolutionItem stitem = DAL.ServiceTemplateCrmEvolution.Get(ctx, Convert.ToInt32(sitem.ServiceTemplateCrmEvolutionId));

                List <DAL.ServiceCrmEvolutionDetailItem> detailitems = DAL.ServiceCrmEvolutionDetail.GetByService(ctx, id);
                for (int i = 0; i < detailitems.Count; i++)
                {
                    int detailid = detailitems[i].Id;
                    DAL.ServiceCrmEvolutionDetailItem sditem = ctx.ServiceCrmEvolutionDetailItems.Find(detailid);
                    if (deleteUnique)
                    {
                        ctx.ServiceCrmEvolutionDetailItems.Remove(sditem);
                    }
                    else
                    {
                        if (!Convert.ToBoolean(sditem.IsUnique))
                        {
                            ctx.ServiceCrmEvolutionDetailItems.Remove(sditem);
                        }
                    }
                }
                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public static bool Delete(entitiesEvolveCentral ctx, ApplicationLogItem item)
        {
            bool retval = true;

            try
            {
                ctx.ApplicationLogItems.Remove(item);
                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                retval = false;
            }

            return(retval);
        }
Beispiel #3
0
        public static bool Delete(entitiesEvolveCentral ctx, ServiceTemplateCrmEvolutionDetailItem item)
        {
            bool retval = true;

            try
            {
                ctx.ServiceTemplateCrmEvolutionDetailItems.Remove(item);
                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceTemplateCrmEvolution.Delete(entitiesEvolveCentral ctx, ServiceTemplateCrmEvolutionDetailItem item)", ex.Message);
                retval = false;
            }

            return(retval);
        }
        public static bool Save(entitiesEvolveCentral ctx, ServiceCrmEvolutionItem item)
        {
            try
            {
                if (item.Id == 0)
                {
                    ctx.ServiceCrmEvolutionItems.Add(item);
                }

                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Beispiel #5
0
        public static bool Delete(entitiesEvolveCentral ctx, AdministratorAccountItem item)
        {
            bool retval = true;

            try
            {
                ctx.AdministratorAccountItems.Remove(item);
                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.AdministratorAccount.Delete(entitiesEvolveCentral ctx, AdministratorAccountItem item)", ex.Message);
                retval = false;
            }

            return(retval);
        }
Beispiel #6
0
        public static bool RemoveAllPermissions(entitiesEvolveCentral ctx, AdministratorRoleItem item)
        {
            bool retval = true;

            try
            {
                item.AdministratorPermissionItems.Clear();
                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.RemoveAllPermissions(entitiesEvolveCentral ctx, AdministratorRoleItem item)", ex.Message);
                retval = false;
            }

            return(retval);
        }
Beispiel #7
0
        public static bool Save(entitiesEvolveCentral ctx, ServiceTemplateCrmEvolutionDetailItem item)
        {
            try
            {
                if (item.Id == 0)
                {
                    ctx.ServiceTemplateCrmEvolutionDetailItems.Add(item);
                }

                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceTemplateCrmEvolutionDetail.Save(entitiesEvolveCentral ctx, ServiceTemplateCrmEvolutionDetailItem item)", ex.Message);
                return(false);
            }
            return(true);
        }
 public static bool DeleteByLog(entitiesEvolveCentral ctx, int id)
 {
     try
     {
         List <DAL.SyncLogCrmEvolutionDetailItem> logdetailitems = DAL.SyncLogCrmEvolutionDetail.GetByLog(ctx, id);
         for (int i = 0; i < logdetailitems.Count; i++)
         {
             int logdetailid = logdetailitems[i].Id;
             DAL.SyncLogCrmEvolutionDetailItem lditem = ctx.SyncLogCrmEvolutionDetailItems.Find(logdetailid);
             ctx.SyncLogCrmEvolutionDetailItems.Remove(lditem);
         }
         ctx.SaveChanges();
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
Beispiel #9
0
        public static bool Save(entitiesEvolveCentral ctx, ApplicationLogItem item)
        {
            bool retval = true;

            try
            {
                if (item.Id == 0)
                {
                    ctx.ApplicationLogItems.Add(item);
                }

                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                retval = false;
            }

            return(retval);
        }
        public static bool Save(entitiesEvolveCentral ctx, AdministratorPermissionItem item)
        {
            bool retval = true;

            try
            {
                if (item.Id == 0)
                {
                    ctx.AdministratorPermissionItems.Add(item);
                }

                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.AdministratorPermission.Save(entitiesEvolveCentral ctx, AdministratorRoleItem item)", ex.Message);
                retval = false;
            }

            return(retval);
        }
Beispiel #11
0
        public static bool Save(entitiesEvolveCentral ctx, MemberAccountItem item)
        {
            bool retval = true;

            try
            {
                if (item.Id == 0)
                {
                    ctx.MemberAccountItems.Add(item);
                }

                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.MemberAccount.Save(entitiesEvolveCentral ctx, MemberAccountItem item)", ex.Message);
                retval = false;
            }

            return(retval);
        }
Beispiel #12
0
        public static bool AddPermissions(entitiesEvolveCentral ctx, AdministratorRoleItem item, List <int> permission_ids)
        {
            bool retval = true;

            try
            {
                foreach (int i in permission_ids)
                {
                    DAL.AdministratorPermissionItem pitem = DAL.AdministratorPermission.Get(ctx, i);
                    item.AdministratorPermissionItems.Add(pitem);
                }

                ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.AddPermissions(entitiesEvolveCentral ctx, AdministratorRoleItem item,List<DAL.AdministratorPermissionItem> permissions)", ex.Message);
                retval = false;
            }

            return(retval);
        }