Example #1
0
        public string GuardarProveedor(string tipoDocumento, string numeroDocumento, string razonSocial, string direccion, string telefono, string contacto, string estado, string idproveedor)
        {
            Usuario user = (Usuario)System.Web.HttpContext.Current.Session[Constant.nameUser];

            blCompras   bl          = new blCompras();
            Transaction transaction = Common.InitTransaction();
            int         result      = 0;

            if (estado == "../Content/images/uncheck.png")
            {
                estado = "INA";
            }
            else if (estado == "../Content/images/check.png")
            {
                estado = "ACT";
            }
            else
            {
                estado = "";
            }
            if (idproveedor == "")
            {
                result = bl.GeneraProovedor(razonSocial, direccion, tipoDocumento, numeroDocumento, telefono, contacto, estado, out transaction);
            }
            else
            {
                result = bl.ActualizarProveedor(idproveedor, direccion, razonSocial, tipoDocumento, numeroDocumento, telefono, contacto, estado, out transaction);
            }
            if (transaction.type == TypeTransaction.OK)
            {
                return(Common.InvokeTextHTML(string.Format("showSuccess(\"{0}\");$('#ProveedorModal').modal('hide');getProveedores();", transaction.message)));
            }
            else
            {
                return(Common.InvokeTextHTML(string.Format("showError(\"{0}\");", transaction.message)));
            }
        }