Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }