Beispiel #1
0
 public Models.TOTransaction <List <TOInfReser> > GetInfoReserva(int soc_cont, int sbe_cont, short emp_codi)
 {
     try
     {
         DAOGnTerce        daoTerce = new  DAOGnTerce();
         DateTime          ahora    = DateTime.Now;
         List <TOInfReser> reservas = new List <TOInfReser>(daoReserva.GetInfoReservas(emp_codi, soc_cont, sbe_cont));
         foreach (var item in reservas)
         {
             if (item.FechaInicio < ahora)
             {
                 item.Res_vige = "N";
             }
             else
             {
                 item.Res_vige = "S";
             }
             var tercero = daoTerce.GetGnTerce(emp_codi, item.Ter_codi);
             item.Ter_foto = string.IsNullOrEmpty(tercero.Ter_foto.ToString()) ? null : tercero.Ter_foto;
             item.Ter_noco = tercero.Ter_noco;
         }
         return(new Models.TOTransaction <List <TOInfReser> >()
         {
             ObjTransaction = reservas, Retorno = 0, TxtError = ""
         });
     }
     catch (Exception ex)
     {
         return(new Models.TOTransaction <List <TOInfReser> >()
         {
             ObjTransaction = null, Retorno = 1, TxtError = ex.Message
         });
     }
 }
Beispiel #2
0
        public SevenFramework.TO.TOTransaction <Gn_Terce> GetGnTerce(string usu_codi)
        {
            DAOGnTerce dao = new DAOGnTerce();

            try
            {
                if (string.IsNullOrEmpty(emp_codi))
                {
                    throw new Exception("Código de empresa no parametrizado en api");
                }
                var result = dao.GetGnTerceByUser(int.Parse(emp_codi), usu_codi);
                if (result == null)
                {
                    throw new Exception("No se encontraron usuarios");
                }
                return(new SevenFramework.TO.TOTransaction <Gn_Terce>()
                {
                    ObjTransaction = result, Retorno = 0, TxtError = ""
                });
            }
            catch (Exception ex)
            {
                return(new SevenFramework.TO.TOTransaction <Gn_Terce>()
                {
                    ObjTransaction = null, TxtError = ex.Message, Retorno = 1
                });
            }
        }
        public TOTransaction <PqInpqrSalida> PostPqr(PqInpqr pqr)
        {
            DAOGnArbol daoArbol = new DAOGnArbol();
            DAOGnItems daoItems = new DAOGnItems();
            BOGnRadju  boRdju   = new BOGnRadju();
            DAOGnParam daoParam = new DAOGnParam();

            try
            {
                if (pqr.inp_tcli != "F")
                {
                    pqr.inp_tcli = "O";
                }
                string emp_codi = new tools.General().GetEmpCodi(pqr.emp_codi).ToString();
                if (pqr.inp_tcli == "F")
                {
                    var thirdPartie = DAOGnTerce.GetGnTerce(int.Parse(emp_codi), pqr.inp_nide);
                    if (thirdPartie == null)
                    {
                        throw new Exception(string.Format("No se encontró tercero asociado a la identificación {0}", pqr.inp_nide));
                    }
                    pqr.ter_codi = thirdPartie.ter_codi;
                }
                GnParam param       = daoParam.GetGnParam(int.Parse(emp_codi));
                string  typeRequest = daoItems.GetGnItems(327, "").Where(i => i.ite_cont == pqr.ite_tpqr).FirstOrDefault().ite_nomb;
                if (string.IsNullOrEmpty(emp_codi))
                {
                    throw new Exception("Código de empresa no parametrizado en api.");
                }
                mailHandler.uploadFile();
                pqr.emp_codi = int.Parse(emp_codi);
                pqr.inp_cont = daoPqr.GetCont("PQ_INPQR", "INP_CONT");
                if (string.IsNullOrEmpty(pqr.arb_sucu))
                {
                    pqr.arb_sucu = "0";
                }
                pqr.arb_sucu = daoArbol.GetGnArbol("2", pqr.arb_sucu, int.Parse(emp_codi))[0].arb_cont.ToString();

                List <GnItem> data = daoItems.GetGnItems(326, "3");

                if (data.Count > 0)
                {
                    pqr.ite_frec = data[0].ite_cont.ToString();
                }
                else
                {
                    pqr.ite_frec = "0";
                }

                pqr.arb_cecr = daoArbol.GetGnArbol("3", "0", int.Parse(emp_codi))[0].arb_cont.ToString();
                if (pqr.pai_codi == param.pai_codi)
                {
                    //Cuando se selecciona el país de instalación el municipio contiene también la región separada por -
                    int mun_codi = int.Parse(pqr.mun_codi.Split('-')[0]);
                    pqr.reg_codi = int.Parse(pqr.mun_codi.Split('-')[1]);
                    pqr.mun_codi = mun_codi.ToString();
                }
                else
                {
                    pqr.reg_codi = 0;
                    pqr.mun_codi = "0";
                }


                insertPqr(pqr, typeRequest);

                string cas_cont = mailHandler.createWorkFlow(pqr, typeRequest);
                if (cas_cont.AsInt() > 0)
                {
                    daoPqr.updatePqr(pqr.inp_cont, cas_cont);
                }
                string msg = mailHandler.GetDescriptionPqrMessage(pqr);

                return(new TOTransaction <PqInpqrSalida>()
                {
                    objTransaction = new PqInpqrSalida()
                    {
                        inp_cont = pqr.inp_cont, msg = msg
                    }, retorno = 0, txtRetorno = ""
                });
            }
            catch (Exception ex)
            {
                if (pqr.inp_cont > 0)
                {
                    daoPqr.deletePqr(pqr.inp_cont);
                }
                return(new TOTransaction <PqInpqrSalida>()
                {
                    objTransaction = null, retorno = 1, txtRetorno = ex.Message
                });
            }
        }