Пример #1
0
 public tercerosDto Get(string identificacion)
 {
     if (identificacion == "admin")
     {
         tercerosDto t = new tercerosDto();
         t.identificacion = "admin";
         t.nombre = "ADMINISTRADOR";
         t.ocupacion = "ADMINISTRADOR";
         return t;
     }
     else
     {
         mTerceros o = new mTerceros();
         return o.GetIdentificacion(identificacion);
     }
 }
Пример #2
0
 public ByARpt Update(tercerosDto Reg)
 {
     cmdUpdate o = new cmdUpdate();
     o.oDto = Reg;
     return o.Enviar();
 }
Пример #3
0
        public rptNewTercero InsertSinIdentificacion(ieEntities ctx, tercerosDto Reg, int idult_ter, int idult_tip_ter, List<string> tipos_tercero)
        {
            rptNewTercero rpt = new rptNewTercero();
            terceros tercero;
            idult_ter++;
            Reg.id = idult_ter;
            tercero = new terceros();
            Mapper.Map(Reg, tercero);

            foreach (string tipo_tercero in tipos_tercero)
            {
                idult_tip_ter++;
                detalles_tipos_tercero tp_ter = new detalles_tipos_tercero();
                tp_ter.id = idult_tip_ter;
                tp_ter.id_tercero = tercero.id;
                tp_ter.nombre_tipo = tipo_tercero;
                tercero.detalles_tipos_tercero.Add(tp_ter);
            }

            rpt.tercero = tercero;
            rpt.ultid_ter = idult_ter;
            rpt.ultid_tip_ter = idult_tip_ter;
            return rpt;
        }
Пример #4
0
        public rptNewTercero InsertOrUpdateXId(ieEntities ctx, tercerosDto Reg, int idult_ter, int idult_tip_ter, List<string> tipos_tercero)
        {
            rptNewTercero rpt = new rptNewTercero();
            terceros tercero;
            if (Reg.id == 0)
            {
                idult_ter++;
                Reg.id = idult_ter;
                tercero = new terceros();
                Mapper.Map(Reg, tercero);

                foreach (string tipo_tercero in tipos_tercero)
                {
                    idult_tip_ter++;
                    detalles_tipos_tercero tp_ter = new detalles_tipos_tercero();
                    tp_ter.id = idult_tip_ter;
                    tp_ter.id_tercero = tercero.id;
                    tp_ter.nombre_tipo = tipo_tercero;
                    tercero.detalles_tipos_tercero.Add(tp_ter);
                }

                rpt.tercero = tercero;
                rpt.ultid_ter = idult_ter;
                rpt.ultid_tip_ter = idult_tip_ter;

                return rpt;
            }else{
                tercero = ctx.terceros.Where(t => t.id == Reg.id).FirstOrDefault();
                Reg.id = tercero.id;
                Mapper.Map(Reg, tercero);

                foreach (string tipo_tercero in tipos_tercero)
                {
                    detalles_tipos_tercero tipo = tercero.detalles_tipos_tercero.Where(t => t.nombre_tipo == tipo_tercero).FirstOrDefault();
                    if (tipo == null)
                    {
                        idult_tip_ter++;
                        detalles_tipos_tercero tp_ter = new detalles_tipos_tercero();
                        tp_ter.id = idult_tip_ter;
                        tp_ter.id_tercero = tercero.id;
                        tp_ter.nombre_tipo = tipo_tercero;
                        tercero.detalles_tipos_tercero.Add(tp_ter);
                    }
                }
                rpt.tercero = tercero;
                rpt.ultid_ter = idult_ter;
                rpt.ultid_tip_ter = idult_tip_ter;

                return rpt;
            }
        }
Пример #5
0
        public ByARpt InsertOrUpdate(tercerosDto Reg)
        {
            using (ctx = new ieEntities())
            {

                terceros tercero = ctx.terceros.Where(t => t.identificacion == Reg.identificacion).FirstOrDefault();
                if (tercero == null)
                {
                    cmdInsert o = new cmdInsert();
                    o.oDto = Reg;
                    return o.Enviar();
                }
                else
                {
                    cmdUpdate o = new cmdUpdate();
                    o.oDto = Reg;
                    return o.Enviar();
                }
            }
        }
Пример #6
0
 public ByARpt Insert(tercerosDto Reg)
 {
     cmdInsert o = new cmdInsert();
     o.oDto = Reg;
     return o.Enviar();
 }
Пример #7
0
 public tercerosDto idTercero(string identificacion)
 {
     using (ctx = new ieEntities())
     {
         tercerosDto terceDto = new tercerosDto();
         terceros terce = ctx.terceros.Where(t => t.identificacion == identificacion).FirstOrDefault();
         Mapper.Map(terce, terceDto);
         return terceDto;
     }
 }
Пример #8
0
 public tercerosDto GetIdentificacion(string Id)
 {
     using (ctx = new ieEntities())
     {
         tercerosDto r = new tercerosDto();
         terceros o = ctx.terceros.Where(t => t.identificacion == Id).FirstOrDefault();
         if (o != null) Mapper.Map(o, r);
         else r = null;
         return r;
     }
 }
Пример #9
0
 public tercerosDto GetId(int Id)
 {
     using (ctx = new ieEntities())
     {
         tercerosDto r = new tercerosDto();
         terceros o = ctx.terceros.Where(t => t.id == Id).FirstOrDefault();
         Mapper.Map(o, r);
         return r;
     }
 }
Пример #10
0
 public ByARpt Put(tercerosDto Reg)
 {
     mTerceros o = new mTerceros();
     return o.Update(Reg);
 }
Пример #11
0
 public ByARpt Post(tercerosDto Reg)
 {
     mTerceros o = new mTerceros();
     return o.Insert(Reg);
 }