示例#1
0
        protected void btneliminarGridView_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName != "Page")
                {
                    BllTarifa.Tarifa Row = new BllTarifa.Tarifa();

                    List<BllTarifa.Tarifa> Rows = new List<BllTarifa.Tarifa>();

                    Rows = (List<BllTarifa.Tarifa>)Session["ListTarifa"];
                    Session["CodigoActividad"] = e.CommandArgument;

                    if (Rows.Exists(b => b.TariCodi.ToString() == e.CommandArgument.ToString()))
                    {
                        Row = Rows.Where(b => b.TariCodi.ToString() == e.CommandArgument.ToString()).First();

                        Row.TariEsta = false;
                        int r = Row.Desactivar();
                        if (r > 0)
                        {
                            FillTarifa();
                            Metodos.divMensaje(Constantes.Succes, Constantes.Eliminado, PnlMsg, Constantes.Ok);
                            updateGrid.Update();
                        }

                    }
                }
            }
            catch (Exception ex) { Metodos.divMensaje(Constantes.Danger, Constantes.ErrorEliminando, PnlMsg, Constantes.Fallo); }
        }
示例#2
0
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                BllTarifa.Tarifa ObjGrabar = new BllTarifa.Tarifa();
                if (TxtCodigo.Text != "") {

                    if (BllTarifa.Exist(TxtCodigo.Text) == 0)
                    {

                        ObjGrabar.TariCodi = TxtCodigo.Text;
                        ObjGrabar.TariDesc = TxtNombre.Text;
                        ObjGrabar.TariPrio = int.Parse(TxtTope.Text);
                        ObjGrabar.TariFaUt = CmbTipo.SelectedValue;
                        ObjGrabar.TariEsta = ChkActivo.Checked;
                        int r = ObjGrabar.Insert();
                        if (r > 0)
                        {
                            Metodos.divMensaje(Constantes.Succes, Constantes.Guardado, PnlMsg, Constantes.Ok);
                            FillTarifa();
                            updateGrid.Update();
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "mostrarGrid();", true);
                        }
                        else
                        {
                            Metodos.divMensaje(Constantes.Danger, Constantes.ErrorAlGuardar, PnlMsg, Constantes.Fallo);
                        }

                    }
                    else
                    {
                        if (BllTarifa.Exist(TxtCodigo.Text) == 1)
                        {

                            BllTarifa.Tarifa ObjActualizar = new BllTarifa.Tarifa();
                            ObjActualizar = BllTarifa.GetTarifa(TxtCodigo.Text);
                            ObjActualizar.TariDesc = TxtNombre.Text;
                            ObjActualizar.TariPrio = int.Parse(TxtTope.Text);
                            ObjActualizar.TariFaUt = CmbTipo.SelectedValue;
                            ObjActualizar.TariEsta = ChkActivo.Checked;
                            int r = ObjActualizar.Update();
                            if (r > 0)
                            {
                                FillTarifa();
                                Metodos.divMensaje(Constantes.Succes, Constantes.Actualizar, PnlMsg, Constantes.Ok);
                                updateGrid.Update();
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "mostrarGrid();", true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Metodos.divMensaje(Constantes.Danger, Constantes.errorGeneral, PnlMsg, Constantes.Fallo);
                Log.EscribirError(ex);
            }
        }
示例#3
0
        protected void BuscarPorcentaje(string tar)
        {
            try
            {
                //TxtPorcUtil
                ta = BllTarifa.GetTarifa(tar);
                TxtTarifa.Text = ta.TariDesc;
                TxtPorcUtil.Text = BllFactorUtilizacion.GetFactorUtilizacion(ta.TariFaUt).FaUtPorc.ToString();

                double p = (float)Math.Round((float.Parse(TxtPorcUtil.Text) / 100), 2);
                double cen = ((p * 720) * float.Parse(TxtCargaKws.Text));
                TxtestXCens.Text = Math.Ceiling(cen).ToString();

                //TxtEcdf1.Text = Math.Ceiling(cen).ToString();
                //cen = cen * 5;
                //TxtEcdf2.Text = Math.Ceiling(cen).ToString();
                CalcularValorECDF();
            }
            catch (Exception ex)
            {
                Log.EscribirError(ex);
            }
        }
示例#4
0
        protected void BtnSelect_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName != "Page")
                {
                    BllTarifa.Tarifa Row = new BllTarifa.Tarifa();

                    List<BllTarifa.Tarifa> Rows = new List<BllTarifa.Tarifa>();

                    Rows = (List<BllTarifa.Tarifa>)Session["ListTarifa"];
                    Session["CodigoActividad"] = e.CommandArgument;

                    if (Rows.Exists(b => b.TariCodi.ToString() == e.CommandArgument.ToString()))
                    {
                        Row = Rows.Where(b => b.TariCodi.ToString() == e.CommandArgument.ToString()).First();
                        TxtCodigo.Enabled = false;
                        BtnGuardar.Text = "Modificar";
                        TxtCodigo.Text = Row.TariCodi;
                        TxtNombre.Text = Row.TariDesc;
                        ChkActivo.Checked = Row.TariEsta;
                        UpdateNew.Update();
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "mostrarDatos();", true);

                    }
                }
            }
            catch (Exception ex)
            {
                Metodos.divMensaje(Constantes.Danger, Constantes.ErrorAlCargarGrid, PnlMsg, Constantes.Fallo);
                UpdateNew.Update();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "mostrarDatos();", true);
            }
        }