Пример #1
0
        //private void CargarList()
        //{
        //    lgTpServicios = new LogicaTipoServicio();
        //    dpListServicios.DataSource = lgTpServicios.dtTpServicio();
        //    dpListServicios.DataTextField = "tipo_servicio";
        //    dpListServicios.DataValueField = "id_tipo_servicio";
        //    dpListServicios.DataBind();

        //}
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["show"] == null)
                {
                    Response.Redirect("IndexPropietario.aspx");
                }
                else
                {
                    try
                    {
                        util       = new csUtilidades();
                        lgServicio = new LogicaServicio();
                        servicio   = lgServicio.SessionServicio(int.Parse(Request.Params["service"].ToString()));
                        bntRegresar.NavigateUrl  = "IndexNegocioPropietario.aspx?show=" + Request.Params["show"];
                        bntRegresar2.NavigateUrl = "IndexNegocioPropietario.aspx?show=" + Request.Params["show"];
                        //CargarList();
                        txtNombre.Text           = servicio.nombre;
                        txtDescripcion.Text      = servicio.descripcion;
                        txtValor.Text            = servicio.valor.ToString();
                        lbImagen.Text            = servicio.imagen;
                        ViewState["codServicio"] = servicio.id_servicio;
                    }
                    catch (Exception ex)
                    {
                        ltError.Text = @"<div class='alert alert-danger'><strong>Error!</strong> " + ex.Message + ".</div>";
                    }
                }
            }
        }
Пример #2
0
        private void CargarGrid()
        {
            LogicaServicio lgServicio = new LogicaServicio();

            dtServicio.DataSource = lgServicio.ListarSErvicio();
            dtServicio.DataBind();
        }
        protected void gvServicio_SelectedIndexChanged(object sender, EventArgs e)
        {
            int codServicio = int.Parse(gvServicio.SelectedDataKey.Values[0].ToString());

            lgServicio = new LogicaServicio();
            Application["SessionServicio"] = lgServicio.SessionServicio(codServicio);
            Response.Redirect("ModificarServicioPropietario.aspx");
        }
        private void CargarGrid()
        {
            csUtilidades util       = new csUtilidades();
            int          codNegocio = int.Parse(util.desencriptar(Request.Params["show"]));

            lgServicio            = new LogicaServicio();
            gvServicio.DataSource = lgServicio.ListarSErvicio(codNegocio);
            gvServicio.DataBind();
        }
Пример #5
0
        private void FilterGrid1()
        {
            LogicaServicio lgServicio = new LogicaServicio();
            string         filter     = "";

            filter = "where nombre_servicio LIKE '" + txtBuscar.Text + "%'  order by  valor " + rdListOrdenar.SelectedValue.ToString();
            //dtServicio.DataSource = lgServicio.FiltroSErvicio(txtMin.Text, txtMax.Text, rdListOrdenar.SelectedValue.ToString());
            dtServicio.DataSource = lgServicio.FiltroSErvicio(filter);
            dtServicio.DataBind();
        }
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            lgServicio = new LogicaServicio();
            int codServicio = int.Parse(ViewState["codServicio"].ToString());

            if (lgServicio.EliminarServicio(codServicio))
            {
                negocio = (csNegocio)Session["Negocio"];
                CargarGrid(negocio);
            }
        }
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            csUtilidades util = new csUtilidades();

            lgServicio = new LogicaServicio();
            int codServicio = int.Parse(ViewState["codServicio"].ToString());

            if (lgServicio.EliminarServicio(codServicio))
            {
                CargarGrid();
            }
        }
Пример #8
0
 protected void btnAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         lgServicio = new LogicaServicio();
         HttpFileCollection file = Request.Files;
         util = new csUtilidades();
         for (int i = 0; i <= file.Count - 1; i++)
         {
             HttpPostedFile postefile = file[i];
             String[]       nombres   = new String[file.Count - 1];
             if (postefile.ContentLength > 0)
             {
                 int codService = int.Parse(ViewState["codServicio"].ToString());
                 int codNegocio = int.Parse(util.desencriptar(Request.Params["show"].ToString()));
                 postefile.SaveAs(Server.MapPath(@"media\img\") + Path.GetFileName(postefile.FileName));
                 servicio = new csServicio(codService, txtNombre.Text, txtDescripcion.Text, postefile.FileName.ToString(), "", "", int.Parse(txtValor.Text), codNegocio);
                 if (lgServicio.ModificarServicio(servicio))
                 {
                     Button2_ModalPopupExtender.Show();
                 }
                 else
                 {
                     ltError.Text = @"<div class='alert alert-danger'>
                   <strong>Error!</strong> " + "Servicio Modificado" + ".</div>";
                 }
             }
             else
             {
                 int codService = int.Parse(ViewState["codServicio"].ToString());
                 int codNegocio = int.Parse(util.desencriptar(Request.Params["show"].ToString()));
                 servicio = new csServicio(codService, txtNombre.Text, txtDescripcion.Text, "", "", "", int.Parse(txtValor.Text), codNegocio);
                 if (lgServicio.ModificarServicio2(servicio))
                 {
                     Button2_ModalPopupExtender.Show();
                 }
                 else
                 {
                     ltError.Text = @"<div class='alert alert-danger'>
                   <strong>Error!</strong> " + "Servicio Modificado" + ".</div>";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ltError.Text = @"<div class='alert alert-danger'>
                   <strong>Error!</strong> " + ex.Message + ".</div>";
     }
 }
Пример #9
0
 protected void btnAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         util = new csUtilidades();
         int codnegocio = int.Parse(util.desencriptar(Request.Params["show"]));
         lgServicio = new LogicaServicio();
         DateTime time  = DateTime.Now;
         string   fecha = time.Date.ToString("yyyy-MM-dd");
         //string hora = time.TimeOfDay.ToString("HH:mm");
         string             hora = "14:05:12";
         HttpFileCollection file = Request.Files;
         for (int i = 0; i <= file.Count - 1; i++)
         {
             HttpPostedFile postefile = file[i];
             String[]       nombres   = new String[file.Count - 1];
             if (postefile.ContentLength > 0)
             {
                 postefile.SaveAs(Server.MapPath(@"media\img\") + Path.GetFileName(postefile.FileName));
                 servicio = new csServicio(0, txtNombre.Text, txtDescripcion.Text, postefile.FileName.ToString(), fecha, hora, int.Parse(txtValor.Text), codnegocio);
                 if (lgServicio.CrearServicio(servicio))
                 {
                     Button2_ModalPopupExtender.Show();
                 }
                 else
                 {
                     ltError.Text = @"<div class='alert alert-danger'>
                   <strong>Error!</strong> " + "Servicio no creado" + ".</div>";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ltError.Text = @"<div class='alert alert-danger'>
                   <strong>Error!</strong> " + ex.Message + ".</div>";
     }
 }
 private void CargarGrid(csNegocio negocio)
 {
     lgServicio            = new LogicaServicio();
     gvServicio.DataSource = lgServicio.ListarSErvicio(negocio.id_negocio);
     gvServicio.DataBind();
 }
 public ServicioController(LogicaServicio logicaServicio)
 {
     _logicaServicio = logicaServicio;
 }