Exemplo n.º 1
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int id = textboxId.Text.ToInt();

            if (id < 0)
            {
                Utils.ShowToastr(this, "Id invalido", "Advertencia", "warning");
                return;
            }
            BLL.RepositorioBase <Cobro> repositorio = new BLL.RepositorioBase <Cobro>();
            if (repositorio.Get(id) == null)
            {
                Utils.ShowToastr(this, "Registro no encontrado", "Advertencia", "warning");
                return;
            }

            bool paso = repositorio.Delete(id);

            if (!paso)
            {
                Utils.ShowToastr(this, "Error al intentar eliminar el registro", "Error", "error");
                return;
            }

            Utils.ShowToastr(this, "Registro eliminado correctamente!", "exito", "success");
            return;
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utils.VerificarAccesoEmpresa(this);
            LabelFecha.Text         = DateTime.Now.Date.ToString("dd/MM/yy");
            this.textboxId.ReadOnly = true;
            if (!IsPostBack)
            {
                ViewState["data"] = new Cliente();
                int id = Request.QueryString["id"].ToInt();
                if (id > 0)
                {
                    BLL.RepositorioBase <Cliente> repositorio = new BLL.RepositorioBase <Cliente>();
                    Cliente data = repositorio.Get(id);
                    if (data == null)
                    {
                        Utils.ShowToastr(this, "Cliente no encontrado!", "Advertencia", "warning");
                        return;
                    }

                    LlenaCampos(data);
                    Utils.ShowToastr(this, "Cliente Encontrada", "Exito!");
                    textboxId.ReadOnly = true;
                }
            }
            else
            {
                Cliente data = (Cliente)ViewState["data"];
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utils.VerificarAccesoEmpresa(this);
            LabelFecha.Text         = DateTime.Now.Date.ToString("dd/MM/yy");
            this.textboxId.ReadOnly = true;
            if (!IsPostBack)
            {
                System.Linq.Expressions.Expression <Func <Cliente, bool> > filtro = x => true;
                Utils.LlenarDropDownList <Cliente>(dropdownlistClientes, new BLL.RepositorioBase <Cliente>(), filtro, "Id_Cliente", "Nombre");
                ViewState["data"] = new Cobro();
                int id = Request.QueryString["id"].ToInt();
                if (id > 0)
                {
                    BLL.RepositorioBase <Cobro> repositorio = new BLL.RepositorioBase <Cobro>();
                    Cobro data = repositorio.Get(id);
                    if (data == null)
                    {
                        Utils.ShowToastr(this, "Cobro no encontrado!", "Advertencia", "warning");
                        return;
                    }

                    LlenaCampos(data);
                    Utils.ShowToastr(this, "Cobro Encontrada", "Exito!");
                    textboxId.ReadOnly = true;
                }
            }
            else
            {
                Cobro data = (Cobro)ViewState["data"];
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LabelFecha.Text         = DateTime.Now.Date.ToString("dd/MM/yy");
            this.textboxId.ReadOnly = true;
            if (!IsPostBack)
            {
                if (Utils.ToInt(Request.QueryString["requerido"]) == 1)
                {
                    Utils.ShowToastr(this, "Debe crear una empresa antes de operar en el sistema!", "Registro de Empresa Requerido", "warning");
                }
                ViewState["empresa"] = new Empresa();
                int id = Request.QueryString["id"].ToInt();
                if (id > 0)
                {
                    BLL.RepositorioBase <Empresa> repositorio = new BLL.RepositorioBase <Empresa>();
                    Empresa empresa = repositorio.Get(id);
                    if (empresa == null)
                    {
                        Utils.ShowToastr(this, "Empresa no encontrada!", "Advertencia", "warning");
                        return;
                    }

                    LlenaCampos(empresa);
                    Utils.ShowToastr(this, "Empresa Encontrada", "Exito!");
                    textboxId.ReadOnly = true;
                }
            }
            else
            {
                Empresa empresa = (Empresa)ViewState["empresa"];
            }
        }