public JsonResult CreatePQR(FormCreatePQR input)
        {
            var usr = (Login)System.Web.HttpContext.Current.Session["usr"];

            if (usr == null)
            {
                RedirectToAction("Index", "Home");
                return(null);
            }
            InCreatePQR pqr = new InCreatePQR()
            {
                company     = 1,
                customerID  = usr.userName,
                description = input.Observaciones,
                executiveID = usr.userName,
                flowType    = decimal.Parse(input.TipoFlujo),
                reason      = decimal.Parse(input.TipoJustificacion),
                loanNumber  = string.IsNullOrEmpty(input.NumeroCredito) ? 0 : decimal.Parse(input.NumeroCredito)
            };

            var create = new ManagerPQR().CreatePQR(pqr);

            return(new JsonResult
            {
                Data = create,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#2
0
        public Response CreatePQR(InCreatePQR input)
        {
            Response response = new Response();

            try
            {
                PqrDAO dao = new PqrDAO();
                response = dao.CreatePQR(input);
            }
            catch (Exception ex)
            {
                //escribir en el log
                LogHelper.WriteLog("Models", "ManagerPQR", "CreatePQR", ex, "");
            }
            return(response);
        }
示例#3
0
        public Response CreatePQR(InCreatePQR input)
        {
            string   connectionString = DataBaseHelper.GetConnectionString("DLG");
            var      ora         = new OracleServer(connectionString);
            Response response    = new Response();
            string   esNuloError = string.Empty;

            try
            {
                var pi_company = new OracleParameter("fa_empresa", OracleDbType.Double, input.company, ParameterDirection.Input);
                ora.AddParameter(pi_company);

                var pi_flowType = new OracleParameter("fa_tipo_flujo", OracleDbType.Double, input.flowType, ParameterDirection.Input);
                ora.AddParameter(pi_flowType);

                var pi_reason = new OracleParameter("fa_motivo", OracleDbType.Double, input.reason, ParameterDirection.Input);
                ora.AddParameter(pi_reason);

                var pi_executiveID = new OracleParameter("fa_cedula_asesor", OracleDbType.Varchar2, input.executiveID, ParameterDirection.Input);
                ora.AddParameter(pi_executiveID);

                var pi_customerID = new OracleParameter("fa_cedula_cliente", OracleDbType.Varchar2, input.customerID, ParameterDirection.Input);
                ora.AddParameter(pi_customerID);

                var pi_description = new OracleParameter("fa_breve_descripcion", OracleDbType.Varchar2, input.description, ParameterDirection.Input);
                ora.AddParameter(pi_description);

                var pi_loanNumber = new OracleParameter("fa_numero_credito", OracleDbType.Varchar2, input.loanNumber, ParameterDirection.Input);
                ora.AddParameter(pi_loanNumber);


                var pi_PQRnumber    = new OracleParameter("fa_numero_pqrs", OracleDbType.Double, ParameterDirection.Output);
                var po_ErrorCode    = new OracleParameter("fa_Error", OracleDbType.Double, ParameterDirection.Output);
                var po_ErrorMessage = new OracleParameter("fa_Descripcion_Error", OracleDbType.Varchar2, ParameterDirection.Output);

                po_ErrorMessage.Size = 100;

                ora.AddParameter(pi_PQRnumber);
                ora.AddParameter(po_ErrorCode);
                ora.AddParameter(po_ErrorMessage);

                ora.ExecuteProcedureNonQuery("BBS_PQRS_F_CREAR_CASO");



                if (ora.GetParameter("fa_Error") == null)
                {
                    esNuloError = "fa_error es nulo";
                }
                else
                {
                    response.errorCode = ora.GetParameter("fa_Error").ToString();
                }

                if (ora.GetParameter("fa_Descripcion_Error") == null)
                {
                    esNuloError = esNuloError + "fa_descripcion_error es nulo";
                }
                else
                {
                    response.errorMessage = ora.GetParameter("fa_Descripcion_Error").ToString();
                }



                if (ora.GetParameter("fa_numero_pqrs") == null)
                {
                    esNuloError = esNuloError + "fa_numero_pqrs es nulo";
                }
                else
                {
                    response.errorMessage = "Se ha creado el PQR con identificador: " + ora.GetParameter("fa_numero_pqrs").ToString();
                }
                ora.Dispose();
            }
            catch (Exception ex)
            {
                //response.errorMessage = ex.InnerException.ToString();
                //throw new Exception("ExecutiveDAO.UpdateExecutive", ex);
                LogHelper.WriteLog("Models", "ManagerPQR", "CreatePQR" + esNuloError, ex, "");
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }