Beispiel #1
0
        public string CambioEstadoReclamo(string stObj)
        {
            JArray             Jarr;
            Historial          objHistorial;
            clsHistorial       objClsHistorial;
            EnviarEmail        objEmail;
            clsReclamo         objClsReclamo;
            List <EnviarEmail> lstReclamo;

            try
            {
                Jarr            = JArray.Parse(stObj);
                objClsHistorial = new clsHistorial();
                objClsReclamo   = new clsReclamo();
                lstReclamo      = new List <EnviarEmail>();

                foreach (var item in Jarr)
                {
                    objHistorial = new Historial();
                    objHistorial.his_fechaIngreso  = item["his_fechaIngreso"].ToString();
                    objHistorial.his_horaIngreso   = item["his_horaIngreso"].ToString();
                    objHistorial.his_observaciones = item["his_observaciones"].ToString();
                    objHistorial.his_IDEstado      = Convert.ToInt32(item["his_IDEstado"]);
                    objHistorial.his_IDReclamo     = Convert.ToInt64(item["his_IDReclamo"]);

                    objClsHistorial.RegistrarHistorial(objHistorial);

                    /* Se añade el objeto a lstReclamo para después cuando el método devuelve esta lista, se hace el envío de emails correspondientes informando
                     * el cambio de estado del reclamo a estado "En Proceso" */
                    objEmail = objClsReclamo.SelectDatosEmail(objHistorial.his_IDReclamo, objHistorial.his_IDEstado);
                    lstReclamo.Add(objEmail);
                }

                return(JsonConvert.SerializeObject(lstReclamo));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Jarr            = null;
                objHistorial    = null;
                objClsHistorial = null;
                objEmail        = null;
                objClsReclamo   = null;
                lstReclamo      = null;
            }
        }
Beispiel #2
0
        public string SelectHistorial(string stObj)
        {
            JObject      Jobj;
            clsHistorial objClsHistorial;

            try
            {
                Jobj            = JObject.Parse(stObj);
                objClsHistorial = new clsHistorial();
                return(JsonConvert.SerializeObject(objClsHistorial.SelectHistorial(Convert.ToInt64(Jobj["rec_IDReclamo"]))));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
            finally
            {
                Jobj            = null;
                objClsHistorial = null;
            }
        }
Beispiel #3
0
        public List <EnviarEmail> RegistrarDetalleOrdenServicio([FromBody] List <DetalleOrdServ> lstDetalle)
        {
            clsReclamo                  objClsReclamo;
            Reclamo                     objRec;
            EnviarEmail                 objEmail;
            List <EnviarEmail>          lstReclamo;
            Historial                   objHis;
            clsHistorial                objClsHistorial;
            PersonalPorOrdenServicio    objPerOrd;
            clsPersonalPorOrdenServicio objClsPerOrd;
            VerificarReclamoOrden       objVerificar;

            try
            {
                lstReclamo    = new List <EnviarEmail>();
                objClsReclamo = new clsReclamo();

                foreach (var itemDetalle in lstDetalle)
                {
                    // Se valida que el reclamo no posea una orden de servicio
                    objVerificar = objClsReclamo.VerificarReclamoOrden(itemDetalle.ordServ_IDReclamo);

                    if (objVerificar.rec_IDOrdenServicio == null)
                    {
                        // Se actualiza el reclamo asignandole el IDOrdenServicio
                        objRec = objClsReclamo.SelectReclamoPorID(itemDetalle.ordServ_IDReclamo);
                        objRec.rec_IDOrdenServicio = itemDetalle.ordServ_IDOrdenServicio;

                        // Se actualiza el estado del reclamo a "Pendiente" luego de haberse generado la orden de servicio
                        objClsReclamo.ActualizarReclamo(objRec);

                        // Se genera y registra un historial indicando generación de orden de servicio
                        objHis = new Historial();
                        objHis.his_fechaIngreso  = DateTime.Now.ToShortDateString();
                        objHis.his_horaIngreso   = DateTime.Now.ToString("HH:mm");
                        objHis.his_observaciones = "Generación de Orden de Servicio";
                        objHis.his_IDReclamo     = itemDetalle.ordServ_IDReclamo;
                        objHis.his_IDEstado      = 2;

                        objClsHistorial = new clsHistorial();
                        objClsHistorial.RegistrarHistorial(objHis);

                        /* Se añade el objeto a lstReclamo para después cuando el método devuelve esta lista, se hace el envío de emails correspondientes informando
                         * el cambio de estado del reclamo a estado "Pendiente" */
                        objEmail = objClsReclamo.SelectDatosEmail(itemDetalle.ordServ_IDReclamo, 2);
                        lstReclamo.Add(objEmail);
                    }

                    // Se registra el personal que va a trabajar sobre la orden de servicio
                    objPerOrd = new PersonalPorOrdenServicio();
                    objPerOrd.perOrd_numeroOrdenServicio      = itemDetalle.ordServ_numero;
                    objPerOrd.perOrd_fechaInicioOrdenServicio = null;
                    objPerOrd.perOrd_fechaFinOrdenServicio    = null;
                    objPerOrd.perOrd_IDOrdenServicio          = itemDetalle.ordServ_IDOrdenServicio;
                    objPerOrd.perOrd_IDPersonal = itemDetalle.ordServ_IDPersonal;
                    objPerOrd.perOrd_IDUsuario  = itemDetalle.ordServ_IDUsuario;

                    objClsPerOrd = new clsPersonalPorOrdenServicio();
                    objClsPerOrd.RegistrarPersonalOrdenServicio(objPerOrd);
                }

                return(lstReclamo);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objClsReclamo   = null;
                objRec          = null;
                lstReclamo      = null;
                objHis          = null;
                objClsHistorial = null;
                objPerOrd       = null;
                objClsPerOrd    = null;
            }
        }
Beispiel #4
0
        public string RegistrarReclamo(string stObj)
        {
            string            stSplit;
            JObject           JRec;
            CallePorBarrio    objCalBar;
            CallePorBarrioV   objCalBarV;
            Reclamo           objReclamo;
            Usuario           objUsuario;
            Historial         objHistorial;
            EnviarEmail       objEmail;
            clsCallePorBarrio objClsCallePorBarrio;
            clsReclamo        objClsReclamo;
            clsUsuario        objClsUsuario;
            clsHistorial      objClsHistorial;

            try
            {
                // Se instancian todos los objetos de las clases para llamar a los métodos
                objClsCallePorBarrio = new clsCallePorBarrio();
                objClsReclamo        = new clsReclamo();
                objClsHistorial      = new clsHistorial();

                JRec = JObject.Parse(stObj);

                // Se hace el select al campo IDCallePorBarrio pasando IDBarrio y IDCalle
                objCalBar = new CallePorBarrio();
                objCalBar.calBar_IDCalle  = Convert.ToInt32(JRec["cal_IDCalle"]);
                objCalBar.calBar_IDBarrio = Convert.ToInt32(JRec["bar_IDBarrio"]);
                objCalBarV = objClsCallePorBarrio.SelectCallePorBarrio(objCalBar.calBar_IDCalle, objCalBar.calBar_IDBarrio);

                // Se crea y registra el objeto Reclamo
                objReclamo = new Reclamo();
                objReclamo.rec_fechaAlta        = JRec["rec_fechaAlta"].ToString();
                objReclamo.rec_altura           = Convert.ToInt32(JRec["rec_altura"]);
                objReclamo.rec_observaciones    = JRec["rec_observaciones"].ToString();
                objReclamo.rec_IDOrdenServicio  = null;
                objReclamo.rec_IDTipoReclamo    = Convert.ToInt64(JRec["rec_IDTipoReclamo"]);
                objReclamo.rec_IDCallePorBarrio = objCalBarV.calBar_IDCallePorBarrio;
                objReclamo.rec_IDCanal          = Convert.ToInt32(JRec["rec_IDCanal"]);

                if (Convert.ToBoolean(JRec["usu_boExiste"]).Equals(false))
                {
                    objUsuario = new Usuario();
                    objUsuario.usu_username = JRec["usu_username"].ToString();
                    objUsuario.usu_password = JRec["usu_password"].ToString();
                    objUsuario.usu_DNI      = Convert.ToInt32(JRec["usu_dni"]);
                    objUsuario.usu_nombre   = JRec["usu_nombre"].ToString();
                    objUsuario.usu_apellido = JRec["usu_apellido"].ToString();
                    objUsuario.usu_telefono = Convert.ToInt64(JRec["usu_telefono"]);
                    objUsuario.usu_email    = JRec["usu_email"].ToString();
                    objUsuario.usu_IDRol    = 1;

                    objClsUsuario            = new clsUsuario();
                    objReclamo.rec_IDUsuario = objClsUsuario.RegistrarUsuario(objUsuario);
                }
                else
                {
                    objReclamo.rec_IDUsuario = Convert.ToInt64(JRec["rec_IDUsuario"]);
                }

                if (JRec["rec_Foto"] != null)
                {
                    objReclamo.rec_Foto = JRec["rec_Foto"].ToString();
                }

                stSplit = objClsReclamo.RegistrarReclamo(objReclamo);
                String[] separator = { ";" }; int count = 2;
                String[] stList = stSplit.Split(separator, count, StringSplitOptions.RemoveEmptyEntries);

                // Creación y registro de objeto Historial
                objHistorial = new Historial();
                objHistorial.his_fechaIngreso  = JRec["rec_fechaAlta"].ToString();
                objHistorial.his_horaIngreso   = JRec["his_horaIngreso"].ToString();
                objHistorial.his_observaciones = "Notificado en Area de Servicio";
                objHistorial.his_IDEstado      = 1;
                objHistorial.his_IDReclamo     = Convert.ToInt64(stList[0]);
                objClsHistorial.RegistrarHistorial(objHistorial);

                // Se crea el objeto email y se pasa al método para enviar email con el código del Reclamo
                objEmail               = new EnviarEmail();
                objEmail.rec_codigo    = Convert.ToInt64(stList[1]);
                objEmail.rec_fechaAlta = JRec["rec_fechaAlta"].ToString();
                objEmail.tipRec_nombre = JRec["tipRec_nombre"].ToString();
                objEmail.usu_nombre    = JRec["usu_nombre"].ToString();
                objEmail.usu_email     = JRec["usu_email"].ToString();
                objEmail.boExiste      = Convert.ToBoolean(JRec["usu_boExiste"]);

                EnviarEmailReclamo(objEmail);

                return(objEmail.rec_codigo.ToString());
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
            finally
            {
                stSplit              = null;
                JRec                 = null;
                objCalBar            = null;
                objCalBarV           = null;
                objReclamo           = null;
                objHistorial         = null;
                objEmail             = null;
                objClsCallePorBarrio = null;
                objClsReclamo        = null;
                objClsHistorial      = null;
            }
        }