Пример #1
0
        public static List <ApplicationSettingsItem> GetAll(entitiesEvolveCentral ctx)
        {
            var items = new List <ApplicationSettingsItem>();

            items = (from i in ctx.ApplicationSettingsItems select i).ToList();
            return(items);
        }
Пример #2
0
        public static ServiceTypeItem GetByCode(entitiesEvolveCentral ctx, string code)
        {
            var item = new ServiceTypeItem();

            item = (from i in ctx.ServiceTypeItems where i.Code == code orderby i.Name ascending select i).FirstOrDefault();
            return(item);
        }
Пример #3
0
        public static ApplicationSettingsItem GetByCode(entitiesEvolveCentral ctx, string code)
        {
            var item = new ApplicationSettingsItem();

            item = (from i in ctx.ApplicationSettingsItems where i.Code == code select i).FirstOrDefault();
            return(item);
        }
        public static List <ServiceCrmEvolutionDetailItem> GetByService(entitiesEvolveCentral ctx, int id)
        {
            var items = new List <ServiceCrmEvolutionDetailItem>();

            items = (from i in ctx.ServiceCrmEvolutionDetailItems where i.ServiceCrmEvolutionId == id orderby i.Sequence ascending select i).ToList();
            return(items);
        }
        public static SyncLogCrmEvolutionDetailItem Get(entitiesEvolveCentral ctx, int id)
        {
            var item = new SyncLogCrmEvolutionDetailItem();

            item = (from i in ctx.SyncLogCrmEvolutionDetailItems where i.Id == id orderby i.CreateDate descending select i).FirstOrDefault();
            return(item);
        }
        public static ServiceCrmEvolutionItem GetByCode(entitiesEvolveCentral ctx, string servicecode)
        {
            var item = new ServiceCrmEvolutionItem();

            item = (from i in ctx.ServiceCrmEvolutionItems where i.Code == servicecode where i.IsActive == true select i).FirstOrDefault();
            return(item);
        }
        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);
        }
        public static bool IsCodeAvailable(entitiesEvolveCentral ctx, string value, int?id)
        {
            bool retval = true;

            try
            {
                DAL.ServiceCrmEvolutionItem item = (from i in ctx.ServiceCrmEvolutionItems where i.Code.ToUpper() == value.ToUpper() select i).FirstOrDefault();
                if (item != null)
                {
                    if (id == null)
                    {
                        retval = false;
                    }

                    if (id != null && item.Id != id)
                    {
                        retval = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceCrmEvolution.IsCodeAvailable(entitiesEvolveCentral ctx, string value, int? id)", ex.Message);
                retval = false;
            }

            return(retval);;
        }
        public static List <ServiceCrmEvolutionItem> GetAll(entitiesEvolveCentral ctx)
        {
            var items = new List <ServiceCrmEvolutionItem>();

            items = (from i in ctx.ServiceCrmEvolutionItems orderby i.Name ascending select i).ToList();
            return(items);
        }
        //public static ServiceItem GetByCode(entitiesEvolveCentral ctx, string clientcode,string servicetypecode)
        //{
        //    var item = new ServiceItem();
        //    item = (from i in ctx.ServiceItems where i.ClientItem.Code  == clientcode && i.ServiceTypeItem.Code == servicetypecode orderby i.Name ascending select i).FirstOrDefault();
        //    return item;
        //}

        public static ServiceCrmEvolutionItem Get(entitiesEvolveCentral ctx, int id)
        {
            var item = new ServiceCrmEvolutionItem();

            item = (from i in ctx.ServiceCrmEvolutionItems where i.Id == id orderby i.Name ascending select i).FirstOrDefault();
            return(item);
        }
        public static List <SyncLogCrmEvolutionDetailItem> GetByLog(entitiesEvolveCentral ctx, int id)
        {
            var items = new List <SyncLogCrmEvolutionDetailItem>();

            items = (from i in ctx.SyncLogCrmEvolutionDetailItems where i.SyncLogCrmEvolutionId == id orderby i.CreateDate descending select i).ToList();
            return(items);
        }
        public static List <SyncLogCrmEvolutionItem> GetAll(entitiesEvolveCentral ctx)
        {
            var items = new List <SyncLogCrmEvolutionItem>();

            items = (from i in ctx.SyncLogCrmEvolutionItems orderby i.CreateDate descending select i).ToList();
            return(items);
        }
Пример #13
0
        public static List <ServiceTemplateCrmEvolutionDetailItem> GetByService(entitiesEvolveCentral ctx, int id)
        {
            var items = new List <ServiceTemplateCrmEvolutionDetailItem>();

            try
            {
                items = (from i in ctx.ServiceTemplateCrmEvolutionDetailItems where i.ServiceTemplateCrmEvolutionId == id orderby i.Sequence ascending select i).ToList();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceTemplateCrmEvolutionDetail.GetByService(entitiesEvolveCentral ctx, int id)", ex.Message);
                items = null;
            }
            return(items);
        }
Пример #14
0
        public static ServiceTemplateCrmEvolutionItem Get(entitiesEvolveCentral ctx, int id)
        {
            var item = new ServiceTemplateCrmEvolutionItem();

            try
            {
                item = (from i in ctx.ServiceTemplateCrmEvolutionItems where i.Id == id orderby i.Name ascending select i).FirstOrDefault();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceTemplateCrmEvolution.Get(entitiesEvolveCentral ctx, int id)", ex.Message);
                item = null;
            }
            return(item);
        }
Пример #15
0
        public static List <ApplicationLogItem> GetAll(entitiesEvolveCentral ctx)
        {
            var items = new List <ApplicationLogItem>();

            try
            {
                items = (from i in ctx.ApplicationLogItems orderby i.CreatedOn descending select i).ToList();
            }
            catch (Exception ex)
            {
                items = null;
            }

            return(items);
        }
Пример #16
0
        public static ApplicationLogItem Get(entitiesEvolveCentral ctx, int itemid)
        {
            var item = new ApplicationLogItem();

            try
            {
                item = (from i in ctx.ApplicationLogItems where i.Id == itemid select i).FirstOrDefault();
            }
            catch (Exception ex)
            {
                item = null;
            }

            return(item);
        }
Пример #17
0
        public static ServiceTemplateCrmEvolutionDetailItem GetByCode(entitiesEvolveCentral ctx, string code, int servicetemplateid)
        {
            var item = new ServiceTemplateCrmEvolutionDetailItem();

            try
            {
                item = (from i in ctx.ServiceTemplateCrmEvolutionDetailItems where i.Code == code && i.ServiceTemplateCrmEvolutionId == servicetemplateid orderby i.Name ascending select i).FirstOrDefault();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceTemplateCrmEvolutionDetail.GetByCode(entitiesEvolveCentral ctx, string code, int servicetemplateid)", ex.Message);
                item = null;
            }
            return(item);
        }
Пример #18
0
        public static List <AdministratorAccountItem> GetAll(entitiesEvolveCentral ctx)
        {
            var items = new List <AdministratorAccountItem>();

            try
            {
                items = (from i in ctx.AdministratorAccountItems orderby i.FirstName ascending, i.LastName ascending select i).ToList();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.AdministratorAccount.GetAll(entitiesEvolveCentral ctx)", ex.Message);
                items = null;
            }

            return(items);
        }
Пример #19
0
        public static AdministratorAccountItem Get(entitiesEvolveCentral ctx, int itemid)
        {
            var item = new AdministratorAccountItem();

            try
            {
                item = (from i in ctx.AdministratorAccountItems where i.Id == itemid select i).FirstOrDefault();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.AdministratorAccount.Get(entitiesEvolveCentral ctx, int itemid)", ex.Message);
                item = null;
            }

            return(item);
        }
Пример #20
0
        public static AdministratorAccountItem Login(entitiesEvolveCentral ctx, string email, string password)
        {
            var item = new AdministratorAccountItem();

            try
            {
                item = (from i in ctx.AdministratorAccountItems where i.Email == email && i.Password == password select i).FirstOrDefault();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.AdministratorAccount.Login(entitiesEvolveCentral ctx, string email,string password)", ex.Message);
                item = null;
            }

            return(item);
        }
        public static List <AdministratorPermissionItem> GetSelectable(entitiesEvolveCentral ctx)
        {
            var items = new List <AdministratorPermissionItem>();

            try
            {
                items = (from i in ctx.AdministratorPermissionItems where i.IsSelectable == true orderby i.Name ascending select i).ToList();
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.GetSelectable(entitiesEvolveCentral ctx)", ex.Message);
                items = null;
            }

            return(items);
        }
Пример #22
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);
        }
Пример #23
0
        public static List <ServiceTemplateCrmEvolutionItem> GetAll(entitiesEvolveCentral ctx)
        {
            var items = new List <ServiceTemplateCrmEvolutionItem>();

            try
            {
                items = (from i in ctx.ServiceTemplateCrmEvolutionItems orderby i.Name ascending select i).ToList();
                return(items);
            }
            catch (Exception ex)
            {
                ApplicationLog.Log(ctx, "DAL.ServiceTemplateCrmEvolution.GetAll(entitiesEvolveCentral ctx)", ex.Message);
                items = null;
            }
            return(items);
        }
Пример #24
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);
        }
Пример #25
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);
        }
Пример #26
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);
        }
        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);
        }
        public static bool Revert(entitiesEvolveCentral ctx, int id)
        {
            var item = new ServiceCrmEvolutionItem();

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

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

                DAL.ServiceCrmEvolutionDetail.DeleteByService(ctx, id, false);



                DateTime cdate = DateTime.Now;

                foreach (DAL.ServiceTemplateCrmEvolutionDetailItem i in stitem.ServiceTemplateCrmEvolutionDetailItems)
                {
                    DAL.ServiceCrmEvolutionDetailItem newitem = new DAL.ServiceCrmEvolutionDetailItem();
                    newitem.IsActive    = i.IsActive;
                    newitem.Code        = i.Code;
                    newitem.Command     = i.Command;
                    newitem.IsUnique    = false;
                    newitem.CommandType = i.CommandType;

                    newitem.Description      = i.Description;
                    newitem.DestinationTable = i.DestinationTable;

                    newitem.Name     = i.Name;
                    newitem.Sequence = i.Sequence;
                    newitem.ServiceCrmEvolutionId = sitem.Id;
                    newitem.SourceTable           = i.SourceTable;

                    if (DAL.ServiceCrmEvolutionDetail.GetByServiceAndCode(ctx, Convert.ToInt32(newitem.ServiceCrmEvolutionId), newitem.Code).Count == 0)
                    {
                        DAL.ServiceCrmEvolutionDetail.Save(ctx, newitem);
                    }
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Пример #29
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 Revert(entitiesEvolveCentral ctx, int detailid)
        {
            try
            {
                //DAL.ServiceCrmEvolutionDetailItem detailitem = GetByID(ctx, detailid);

                //DAL.ServiceCrmEvolutionItem serviceitem = DAL.ServiceCrmEvolution.GetByID(ctx, Convert.ToInt32(detailitem.ServiceCrmEvolutionId));

                //DAL.ServiceTemplateCrmEvolutionItem servicetemplateitem = DAL.ServiceTemplateCrmEvolution.GetByID(ctx, Convert.ToInt32(serviceitem.ServiceTemplateCrmEvolutionId));

                //DAL.ServiceTemplateCrmEvolutionDetailItem servicetemplatedetailitem = DAL.ServiceTemplateCrmEvolutionDetail.GetByCode(ctx, detailitem.Code, servicetemplateitem.Id);
                //if(servicetemplatedetailitem != null)
                //{
                //Delete(ctx, detailid);



                //DateTime cdate = DateTime.Now;

                //DAL.ServiceCrmEvolutionDetailItem newitem = new DAL.ServiceCrmEvolutionDetailItem();
                //    newitem.IsActive = servicetemplatedetailitem.IsActive;
                //    newitem.Code = servicetemplatedetailitem.Code;
                //    newitem.Command = servicetemplatedetailitem.Command;
                //    newitem.IsUnique = false;
                //    newitem.CommandType = servicetemplatedetailitem.CommandType;

                //    newitem.Description = servicetemplatedetailitem.Description;
                //    newitem.DestinationTable = servicetemplatedetailitem.DestinationTable;

                //    newitem.Name = servicetemplatedetailitem.Name;
                //    newitem.Sequence = servicetemplatedetailitem.Sequence;
                //    newitem.ServiceCrmEvolutionId = serviceitem.Id;
                //    newitem.SourceTable = servicetemplatedetailitem.SourceTable;
                //    DAL.ServiceCrmEvolutionDetail.Save(ctx, newitem);


                //}
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }