Exemplo n.º 1
0
        public TOTransaction <CtPropo> GetInfoCtPropo(int emp_codi, int rev_cont)
        {
            DAOCtConsu daoCtConsu = new DAOCtConsu();

            try
            {
                CtPropo result = new CtPropo();
                result = daoCtConsu.getctpropo(emp_codi, rev_cont);

                if (result == null)
                {
                    throw new Exception("No se encontraron datos con los parámetros especificados");
                }

                return(new TOTransaction <CtPropo>()
                {
                    objTransaction = result, retorno = 0, txtRetorno = ""
                });
            }
            catch (Exception ex)
            {
                return(new TOTransaction <CtPropo>()
                {
                    objTransaction = null, retorno = 1, txtRetorno = ex.Message
                });
            }
        }
Exemplo n.º 2
0
        public TOTransaction setInfoCtPropo(int emp_codi, int rev_cont, List <CtRevdo> ctrevdo)
        {
            SCtPropo.SCtPropoDMR ws = new SCtPropo.SCtPropoDMR();
            ws.loginAlias(usuario, password, alias);
            DAOCtConsu  daoCtConsu  = new DAOCtConsu();
            DAOGnInsta  daoInsta    = new DAOGnInsta();
            mailHandler mailHandler = new mailHandler();
            CtPropo     propo       = new CtPropo();

            try
            {
                int procont = 0;
                ws.emp_codi = emp_codi;
                ws.GenerarProCont();

                string subject = ConfigurationManager.AppSettings["asuntoAprobacion"].ToString();
                string body    = ConfigurationManager.AppSettings["cuerpoAprobacion"].ToString();
                body = string.Format("{0}{1}{2}", "<p style = 'text-align: justify;'>", body, "</p>");

                if (ws.txtError != null)
                {
                    throw new Exception(ws.txtError);
                }
                else
                {
                    procont = Convert.ToInt32(ws.pro_cont);
                }

                daoCtConsu.insertCtPropo(rev_cont, procont, emp_codi);
                daoCtConsu.insertCtDtrda(rev_cont, procont, emp_codi);
                daoCtConsu.insertCtAcxpr(rev_cont, procont, emp_codi);
                daoCtConsu.insertCtDocpr(rev_cont, procont, emp_codi, ctrevdo);
                daoCtConsu.setCtpropo(emp_codi, rev_cont, "A");
                propo = daoCtConsu.getctpropo(emp_codi, rev_cont);

                Mail    mail  = mailHandler.generateMailCtPropo(propo.pro_mail, subject, body);
                GnInsta insta = daoInsta.GetGnInsta();
                mailHandler.sendMail(mail, insta);

                ws.loginAlias(usuario, password, alias);
                ws.emp_codi = propo.emp_codi;
                ws.pro_coal = propo.pro_codi;
                ws.pro_dive = propo.pro_dive;
                ws.tip_codi = propo.tip_codi;
                ws.pro_nomb = propo.pro_nomb;
                ws.pro_apel = propo.pro_apel;
                ws.pro_clap = propo.pro_clap;
                ws.pro_nroe = propo.pro_nroe;
                ws.pro_fesc = propo.pro_fesc;
                ws.pro_nomr = propo.pro_nomr;
                ws.pro_nror = propo.pro_nror;
                ws.pvr_clad = propo.pro_clad; // clasificacion DIAN
                ws.pvr_riva = propo.pro_riva; // Regimen IVA
                ws.pvd_clad = propo.pro_claf; // clasificacion
                ws.pro_ntel = propo.pro_ntel;
                ws.pro_mail = propo.pro_mail;
                ws.pro_nfax = propo.pro_nfax;
                ws.pro_pais = propo.pro_pais;
                ws.pro_regi = propo.pro_regi;
                ws.pro_depa = propo.pro_depa;
                ws.pro_muni = propo.pro_muni;
                ws.InsertarProveedor();

                return(new TOTransaction()
                {
                    retorno = 0, txtRetorno = ""
                });
            }
            catch (Exception ex)
            {
                return(new TOTransaction()
                {
                    retorno = 1, txtRetorno = ex.Message
                });
            }
        }