Beispiel #1
0
        protected void btnAgregarNegocio_Click(object sender, EventArgs e)
        {
            LogicaNegocio lgNegocio = new LogicaNegocio();

            lgPath = new LogicaPath();
            csUsuario usuario = (csUsuario)Session["Usuario"];

            lgExtNegocio = new LogicaEstadoNegocio();

            if (IsValid)
            {
                if ((uploadFile1.PostedFile != null) && (uploadFile1.PostedFile.ContentLength > 0))
                {
                    try
                    {
                        string    fn           = System.IO.Path.GetFileName(uploadFile1.PostedFile.FileName);
                        string    SaveLocation = Server.MapPath("media\\img") + "\\" + fn;
                        csNegocio negocio      = new csNegocio(0, txtNombre.Text, txtDescdrip.Text, txtTelefono.Text, usuario.id_usuario, uploadFile1.FileName, hdLonft.Value, txtUbicacion.Text, hdLatFt.Value);
                        int       codNegoc     = int.Parse(lgNegocio.CrearNegocio(negocio));
                        if (codNegoc > 0)
                        {
                            uploadFile1.PostedFile.SaveAs(SaveLocation);
                            foreach (ListItem item in chekListCategoria.Items)
                            {
                                if (item.Selected)
                                {
                                    estNegocio = new csEstadoNegocio(0, int.Parse(item.Value.ToString()), codNegoc);
                                    lgExtNegocio.CrearEstadoNegocio(estNegocio);
                                }
                            }

                            Button2_ModalPopupExtender.Show();
                        }
                        else
                        {
                            ltRepuesta.Text = @"<div class='alert alert-danger'>
                             <strong>Danger!</strong> no guardor el registro.
                             </div>";
                        }
                    }
                    catch (Exception ex)
                    {
                        ltRepuesta.Text = @"<div class='alert alert-danger'>
                    <strong>Advertencia</strong> " + ex.Message + "</div>";
                    }
                }
                else
                {
                    ltRepuesta.Text = @"<div class='alert alert-danger'>
                    <strong>Danger!</strong> No cargo la Foto.
                    </div>";
                }
            }
        }
Beispiel #2
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow fila = GridView1.SelectedRow;

            Label1.Text    = fila.Cells[3].Text;
            Label2.Text    = fila.Cells[4].Text;
            TextBox2.Text  = fila.Cells[6].Text;
            Totalprod      = fila.Cells[6].Text;
            precio         = fila.Cells[5].Text;
            idStock        = fila.Cells[9].Text;
            IDdetalleVenta = fila.Cells[8].Text;
            Button2_ModalPopupExtender.Show();
        }
Beispiel #3
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>";
     }
 }
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow fila = GridView1.SelectedRow;

            Label1.Text            = fila.Cells[3].Text;
            Label2.Text            = fila.Cells[4].Text;
            TextBox2.Text          = fila.Cells[6].Text;
            Totalprod              = fila.Cells[6].Text;
            precio                 = fila.Cells[5].Text;
            idStock                = fila.Cells[9].Text;
            IDdetalleVenta         = fila.Cells[8].Text;
            idCredito              = fila.Cells[10].Text;
            totalDirecto           = fila.Cells[7].Text;
            precioProdConDescuento = Convert.ToDecimal(totalDirecto) / Convert.ToDecimal(Totalprod);
            Button2_ModalPopupExtender.Show();
        }
        protected void btnAgregarNegocio_Click(object sender, EventArgs e)
        {
            LogicaNegocio lgNegocio = new LogicaNegocio();

            lgPath = new LogicaPath();



            if ((uploadFile1.PostedFile != null) && (uploadFile1.PostedFile.ContentLength > 0))
            {
                try
                {
                    string    fn           = System.IO.Path.GetFileName(uploadFile1.PostedFile.FileName);
                    string    SaveLocation = Server.MapPath("media\\img") + "\\" + fn;
                    csNegocio negocio      = new csNegocio(0, txtNombre.Text, txtDescdrip.Text, txtTelefono.Text, int.Parse(Request.Params["perfil"]), uploadFile1.FileName, hdLonft.Value, txtUbicacion.Text, hdLatFt.Value);
                    int       codNegoc     = int.Parse(lgNegocio.CrearNegocio(negocio));
                    if (codNegoc > 0)
                    {
                        uploadFile1.PostedFile.SaveAs(SaveLocation);
                        Button2_ModalPopupExtender.Show();
                    }
                    else
                    {
                        ltRepuesta.Text = @"<div class='alert alert-danger'>
                             <strong>Danger!</strong> no guardor el registro.
                             </div>";
                    }
                }
                catch (Exception ex)
                {
                    ltRepuesta.Text = @"<div class='alert alert-danger'>
                    <strong>Advertencia</strong> " + ex.Message + "</div>";
                }
            }
            else
            {
                ltRepuesta.Text = @"<div class='alert alert-danger'>
                    <strong>Danger!</strong> No cargo la Foto.
                    </div>";
            }
        }
Beispiel #6
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>";
     }
 }
Beispiel #7
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            try
            {
                if (IsValid)
                {
                    LogicaNegocio lgNegocio = new LogicaNegocio();
                    lgPath = new LogicaPath();
                    csUsuario usuario  = (csUsuario)Session["Usuario"];
                    int       codNegoc = int.Parse(Request.Params["negocio"]);
                    lgEstaNegocio = new LogicaEstadoNegocio();
                    if ((uploadFile1.PostedFile != null) && (uploadFile1.PostedFile.ContentLength > 0))
                    {
                        string    fn           = System.IO.Path.GetFileName(uploadFile1.PostedFile.FileName);
                        string    SaveLocation = Server.MapPath("media/img") + "/" + fn;
                        csNegocio negocio      = new csNegocio(int.Parse(hdCodNegocio.Value), txtNombre.Text, txtDescdrip.Text, txtTelefono.Text, usuario.id_usuario, uploadFile1.FileName, hdLonft.Value, txtUbicacion.Text, hdLatFt.Value);

                        if (lgNegocio.ModificarNegocio(negocio))
                        {
                            foreach (ListItem item in chekListCategoria.Items)
                            {
                                if (item.Selected)
                                {
                                    if (lgEstaNegocio.validarEstadNegocio(int.Parse(item.Value.ToString()), codNegoc) == false)
                                    {
                                        estNegocio = new csEstadoNegocio(0, int.Parse(item.Value.ToString()), codNegoc);
                                        lgEstaNegocio.CrearEstadoNegocio(estNegocio);
                                    }
                                }
                                if (item.Selected == false)
                                {
                                    if (lgEstaNegocio.validarEstadNegocio(int.Parse(item.Value.ToString()), codNegoc))
                                    {
                                        lgEstaNegocio.EliminarEstadoNegocio(int.Parse(item.Value.ToString()));
                                    }
                                }
                            }
                            uploadFile1.PostedFile.SaveAs(SaveLocation);
                            Button2_ModalPopupExtender.Show();
                        }
                        else
                        {
                            ltRepuesta.Text = @"<div class='alert alert-danger'>
                             <strong>Danger!</strong> no guardor el registro.
                             </div>";
                        }
                    }
                    else
                    {
                        //string fn = System.IO.Path.GetFileName(uploadFile1.PostedFile.FileName);
                        //string SaveLocation = Server.MapPath("media/img") + "/" + fn;
                        csNegocio negocio = new csNegocio(int.Parse(hdCodNegocio.Value), txtNombre.Text, txtDescdrip.Text, txtTelefono.Text, usuario.id_usuario, "", hdLonft.Value, txtUbicacion.Text, hdLatFt.Value);

                        if (lgNegocio.ModificarNegocio2(negocio))
                        {
                            foreach (ListItem item in chekListCategoria.Items)
                            {
                                if (item.Selected)
                                {
                                    if (lgEstaNegocio.validarEstadNegocio(int.Parse(item.Value.ToString()), codNegoc) == false)
                                    {
                                        estNegocio = new csEstadoNegocio(0, int.Parse(item.Value.ToString()), codNegoc);
                                        lgEstaNegocio.CrearEstadoNegocio(estNegocio);
                                    }
                                }
                                if (item.Selected == false)
                                {
                                    if (lgEstaNegocio.validarEstadNegocio(int.Parse(item.Value.ToString()), codNegoc))
                                    {
                                        lgEstaNegocio.EliminarEstadoNegocio(int.Parse(item.Value.ToString()));
                                    }
                                }
                            }
                            //uploadFile1.PostedFile.SaveAs(SaveLocation);
                            Button2_ModalPopupExtender.Show();
                        }
                        else
                        {
                            ltRepuesta.Text = @"<div class='alert alert-danger'>
                             <strong>Danger!</strong> no guardor el registro.
                             </div>";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ltRepuesta.Text = @"<div class='alert alert-danger alert-dismissable'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>
<strong>Error! </strong> " + ex.Message + "</div>";
            }
        }