Example #1
0
        public JsonResult agrega_contactos(Contacto cont, Cliente client)
        {
            var t = cont;
            var y = client;


            string           validacion = "fail";
            Fecha            fecha      = new Fecha();
            Cliente_Contacto entidad    = new Cliente_Contacto();

            entidad.ESTADO           = 1;
            entidad.FECHA_CREACION   = fecha.fecha();
            entidad.USUARIO_CREACION = (string)(Session["User"]);
            entidad.FK_ID_CLIENTE    = 2;
            entidad.FK_ID_CONTACTO   = t.ID_CONTACTO;


            int result = dao_contrato.AgregarCliente_Contacto(entidad);

            if (result == 1)
            {
                List <Contacto> list = dao1.listaContactoscliente(2);

                string sJSONResponse = JsonConvert.SerializeObject(list, Formatting.Indented);
                return(Json(sJSONResponse, JsonRequestBehavior.AllowGet));
            }
            return(Json(validacion, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public string agrega_contactos(Contacto cont, string user)
        {
            var t = cont;

            string           validacion = "fail";
            Fecha            fecha      = new Fecha();
            Cliente_Contacto entidad    = new Cliente_Contacto();

            entidad.ESTADO           = 1;
            entidad.FECHA_CREACION   = fecha.fecha();
            entidad.USUARIO_CREACION = (user);
            entidad.FK_ID_CLIENTE    = int.Parse(t.ENCARGADO);
            entidad.FK_ID_CONTACTO   = t.ID_CONTACTO;


            int result = dao_contrato.AgregarCliente_Contacto(entidad);

            if (result == 1)
            {
                List <Contacto> list = dao1.listaContactoscliente(int.Parse(t.ENCARGADO));

                string sJSONResponse = JsonConvert.SerializeObject(list, Formatting.Indented);
                return(sJSONResponse);
            }
            return(validacion);
        }
Example #3
0
        public int AgregarCliente_Contacto(Cliente_Contacto cliente)
        {
            int        result  = 0;
            SqlCommand comando = new SqlCommand();

            comando.Connection  = conexion;
            comando.CommandText = "execute PA_MAN_AGREGAR_CLIENTE_CONTACTO @ESTADO, @USUARIO_CREACION, @FECHA_CREACION,@FK_ID_CLIENTE, @FK_ID_CONTACTO";
            comando.Parameters.AddWithValue("@ESTADO", cliente.ESTADO);;
            comando.Parameters.AddWithValue("@USUARIO_CREACION", cliente.USUARIO_CREACION);
            comando.Parameters.AddWithValue("@FECHA_CREACION", cliente.FECHA_CREACION);
            comando.Parameters.AddWithValue("@FK_ID_CLIENTE", cliente.FK_ID_CLIENTE);
            comando.Parameters.AddWithValue("@FK_ID_CONTACTO", cliente.FK_ID_CONTACTO);


            result = comando.ExecuteNonQuery();

            return(result);
        }