示例#1
0
        public ActionResult EliminarSMDROrigen(SMDROrigen _SMDROrigen)
        {
            try
            {
                SqlConnection SqlCnn;
                SqlCnn = Base.AbrirConexion();
                SqlCommand SqlCmd = new SqlCommand("Proc_SMDROrigen_Delete", SqlCnn);
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@idllamada", _SMDROrigen.idllamada);

                SqlCmd.ExecuteNonQuery();
                Base.CerrarConexion(SqlCnn);
                return(Ok("Operacion realizada correctamente"));
            }
            catch (SqlException XcpSQL)
            {
                foreach (SqlError se in XcpSQL.Errors)
                {
                    if (se.Number <= 50000)
                    {
                        return(BadRequest(se.Message));
                    }
                    else
                    {
                        return(BadRequest("Error en Operacion de Eliminacion de Datos"));
                    }
                }
            }
            catch (Exception Ex)
            {
                return(BadRequest(Ex.Message));
            }
            return(Ok(""));
        }
示例#2
0
        public IEnumerable <SMDROrigen> ConsultarSMDROrigen()
        {
            List <SMDROrigen> lstSMDROrigen = new List <SMDROrigen>();

            try
            {
                SqlConnection SqlCnn;
                SqlCnn = Base.AbrirConexion();
                SqlCommand SqlCmd = new SqlCommand("Proc_SMDROrigen_Select", SqlCnn);
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader rdr = SqlCmd.ExecuteReader();
                while (rdr.Read())
                {
                    SMDROrigen _SMDROrigen = new SMDROrigen();
                    _SMDROrigen.idllamada = (System.Guid)rdr["idllamada"];
                    _SMDROrigen.idestado  = (System.Int32)rdr["idestado"];
                    _SMDROrigen.trama     = !rdr.IsDBNull(2) ? (System.String)rdr["trama"] : "";
                    lstSMDROrigen.Add(_SMDROrigen);
                }
                Base.CerrarConexion(SqlCnn);
                return(lstSMDROrigen);
            }
            catch (SqlException XcpSQL)
            {
                foreach (SqlError se in XcpSQL.Errors)
                {
                    if (se.Number <= 50000)
                    {
                        throw new Exception(se.Message);
                    }
                    else
                    {
                        throw new Exception("Error en Operacion de Consulta de Datos");
                    }
                }
                return(lstSMDROrigen);
            }
            catch (Exception Ex)
            {
                throw new Exception(Ex.Message);
            }
        }
示例#3
0
        public SMDROrigen BuscarSMDROrigen(System.Guid idllamada)
        {
            SMDROrigen _SMDROrigen = new SMDROrigen();

            try
            {
                SqlConnection SqlCnn;
                SqlCnn = Base.AbrirConexion();
                SqlCommand SqlCmd = new SqlCommand("Proc_SMDROrigen_Search", SqlCnn);
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@idllamada", idllamada);
                SqlDataReader rdr = SqlCmd.ExecuteReader();
                while (rdr.Read())
                {
                    _SMDROrigen.idllamada = (System.Guid)rdr["idllamada"];
                    _SMDROrigen.idestado  = (System.Int32)rdr["idestado"];
                    _SMDROrigen.trama     = !rdr.IsDBNull(2) ? (System.String)rdr["trama"] : "";
                }
                Base.CerrarConexion(SqlCnn);
                return(_SMDROrigen);
            }
            catch (SqlException XcpSQL)
            {
                foreach (SqlError se in XcpSQL.Errors)
                {
                    if (se.Number <= 50000)
                    {
                        throw new Exception(se.Message);
                    }
                    else
                    {
                        throw new Exception("Error en Operacion en Busqueda de Datos");
                    }
                }
                return(_SMDROrigen);
            }
            catch (Exception Ex)
            {
                throw new Exception(Ex.Message);
            }
        }
示例#4
0
 public ActionResult EliminarSMDROrigen([FromBody] SMDROrigen data)
 {
     return(objSMDROrigen.EliminarSMDROrigen(data));
 }
示例#5
0
 public ActionResult ActualizarSMDROrigen([FromBody] SMDROrigen data)
 {
     return(objSMDROrigen.ActualizarSMDROrigen(data));
 }
示例#6
0
 public ActionResult InsertarSMDROrigen([FromBody] SMDROrigen data)
 {
     return(objSMDROrigen.InsertarSMDROrigen(data));
 }