public bool Delete(string empresaid, tb_t1_tarjeta BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbT1Tarjeta_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tarjetaid", SqlDbType.Int).Value = BE.tarjetaid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll2(string empresaid, tb_t1_tarjeta BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbT1Tarjeta_SEARCH2", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tarjetaid", SqlDbType.Int).Value = BE.tarjetaid;
                 cmd.Parameters.Add("@tarjetaname", SqlDbType.VarChar, 50).Value = BE.tarjetaname;
                 cmd.Parameters.Add("@filtro", SqlDbType.Char, 1).Value = BE.filtro;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public String GetNextCod(string empresaid, tb_t1_tarjeta BE)
 {
     return tablaDA.GetNextCod(empresaid, BE);
 }
 public DataSet GetAll_direc(string empresaid, tb_t1_tarjeta BE)
 {
     return tablaDA.GetAll_direc(empresaid, BE);
 }
 public bool Delete(string empresaid, tb_t1_tarjeta BE)
 {
     return tablaDA.Delete(empresaid, BE);
 }
Ejemplo n.º 6
0
        private void Delete()
        {
            try
            {
                if (tarjetaid.Text.Trim() == "" )
                {
                    MessageBox.Show("Falta Codigo Tarjeta !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_t1_tarjetaBL BL = new tb_t1_tarjetaBL();
                    tb_t1_tarjeta BE = new tb_t1_tarjeta();

                    BE.tarjetaid = Convert.ToInt32(tarjetaid.Text.Trim());

                    if (BL.Delete(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("E");
                        MessageBox.Show("Datos Eliminados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        NIVEL_FORMS();
                        form_bloqueado(false);
                        data_TablaTarjeta();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public bool Insert(string empresaid, tb_t1_tarjeta BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbT1Tarjeta_INSERT", cnx))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@tarjetaname", SqlDbType.Char,50).Value = BE.tarjetaname;
             cmd.Parameters.Add("@tarjetalogo", SqlDbType.Image).Value = BE.tarjetalogo;
             //cmd.Parameters.Add("@esnuestro", SqlDbType.Bit).Value = BE.esnuestro;
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
Ejemplo n.º 8
0
        private void Cargar_ComboTarjeta()
        {
            try
            {
                var BL = new tb_t1_tarjetaBL();
                var BE = new tb_t1_tarjeta();
                var ds = new DataSet();
                BE.filtro = "2";
                ds = BL.GetAll2(VariablesPublicas.EmpresaID, BE);

                var dvm = new DataViewManager(ds);

                DataView dvDropDown;
                dvDropDown = dvm.CreateDataView(ds.Tables[0]);

                glueTarjeta.Properties.View.OptionsBehavior.AutoPopulateColumns = false;
                glueTarjeta.Properties.DataSource = dvDropDown;
                glueTarjeta.Properties.DisplayMember = "tarjetaname";
                glueTarjeta.Properties.ValueMember = "tarjetaid";

                var col1 = glueTarjeta.Properties.View.Columns.AddField("tarjetalogo");
                col1.VisibleIndex = 0;
                col1.Caption = "logo";
                col1.Width = 20;

                var col2 = glueTarjeta.Properties.View.Columns.AddField("tarjetaname");
                col2.VisibleIndex = 1;
                col2.Caption = "Nombre de Tarjeta";
                col2.Width = 100;

               glueTarjeta.Properties.PopupFormWidth = 1;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public DataSet GetAll_direc(string empresaid, tb_t1_tarjeta BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbCliente_SEARCH_direc", cnx))
                {
                    DataSet ds = new DataSet();
                    {
                        //cmd.CommandType = CommandType.StoredProcedure;
                        //cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte;
                        //cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 70).Value = BE.ctactename;
                        //cmd.Parameters.Add("@docuidentid", SqlDbType.Char, 1).Value = BE.docuidentid;
                        //cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.nmruc;
                        //cmd.Parameters.Add("@tpperson", SqlDbType.Char, 2).Value = BE.tpperson;
                        //cmd.Parameters.Add("@agerent", SqlDbType.Bit).Value = BE.agerent;
                        //cmd.Parameters.Add("@appat", SqlDbType.VarChar, 20).Value = BE.appat;

                    }
                    try
                    {
                        cnx.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void CargarTarjetas()
        {
            try
            {
                var BE = new tb_t1_tarjeta();
                var BL = new tb_t1_tarjetaBL();
                var table = BL.GetAll(EmpresaID, BE).Tables[0];

                lstTarjGroup.DataSource = table;
                lstTarjGroup.ValueMember = "tarjgrupoid";
                lstTarjGroup.DisplayMember = "tarjgruponame";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 11
0
        private void RecibeDatosTarj(DataTable Datos)
        {
            try
            {
                foreach (DataRow fila in Datos.Rows)
                {
                    var BL = new tb_t1_tarjetaBL();
                    var BE = new tb_t1_tarjeta();
                    var dt = new DataTable();

                    BE.filtro = "2";
                    BE.tarjetaid = Convert.ToInt32(fila["tarjetaid"].ToString());

                    dt = BL.GetAll2(VariablesPublicas.EmpresaID, BE).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        row = TablaTarjetas.NewRow();
                        row["tarjetaid"] = Datos.Rows[0]["tarjetaid"].ToString();
                        row["tarjetaimpo"] = Datos.Rows[0]["tarjetaimpo"].ToString();
                        row["tarjetanume"] = Datos.Rows[0]["tarjetanume"].ToString();
                        row["tarjetaname"] = dt.Rows[0]["tarjetaname"].ToString();
                        row["tarjetalogo"] = dt.Rows[0]["tarjetalogo"];
                        row["ddnni"] = Datos.Rows[0]["ddnni"].ToString();
                    }

                    TablaTarjetas.Rows.Add(row);
                }
                dgbtarjetas.DataSource = TablaTarjetas;

                if (TablaTarjetas != null)
                {
                    if (TablaTarjetas.Rows.Count != 0)
                    {
                        importtarj.Text = Convert.ToDecimal(TablaTarjetas.Compute("sum(tarjetaimpo)", string.Empty)).ToString("##,###,##0.00");
                    }
                    else
                    {
                        importtarj.Text = "0";
                    }
                }
                else
                {
                    importtarj.Text = "0";
                }

                //calcularVuelto();

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 12
0
        private void Update()
        {
            try
            {
                if (tarjetaid.Text.Trim() == "")
                {
                    MessageBox.Show("Falta Codigo Tarjeta !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else if (tarjetaname.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Ingrese Nombre de línea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_t1_tarjetaBL BL = new tb_t1_tarjetaBL();
                    tb_t1_tarjeta BE = new tb_t1_tarjeta();

                    BE.tarjetaid = Convert.ToInt32(tarjetaid.Text.Trim());
                    BE.tarjetaname = tarjetaname.Text.ToUpper();

                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    if (go_foto.Image != null)
                    {
                        go_foto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    }
                    BE.tarjetalogo = ms.GetBuffer();

                    if (BL.Update(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("M");
                        MessageBox.Show("Datos Modificado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 13
0
        private void Insert()
        {
            try
            {
                 if (tarjetaname.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Ingrese nombre de Tarjeta", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_t1_tarjetaBL BL = new tb_t1_tarjetaBL();
                    tb_t1_tarjeta BE = new tb_t1_tarjeta();

                    BE.tarjetaname = tarjetaname.Text.ToUpper();

                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    if (go_foto.Image != null)
                    {
                        go_foto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    }
                    BE.tarjetalogo = ms.GetBuffer();

                    if (BL.Insert(EmpresaID, BE))
                    {
                        MessageBox.Show("Datos Grabados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 14
0
        private void form_cargar_datos(String posicion)
        {
            try
            {
                tb_t1_tarjetaBL BL = new tb_t1_tarjetaBL();
                tb_t1_tarjeta BE = new tb_t1_tarjeta();
                DataTable dt = new DataTable();

                //BE.moduloid = modulo;
                //if (tarjetaid.Text.Trim().Length > 0)
                //{
                //    BE.Tarjetaid = tarjetaid.Text.Trim().PadLeft(3, '0');
                //}
                //BE.posicion = posicion.Trim();

                //dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0];

                //if (dt.Rows.Count > 0)
                //{
                //    limpiar_documento();
                //    ssModo = "EDIT";

                //    tarjetaid.Text = dt.Rows[0]["Tarjetaid"].ToString().Trim();
                //    tarjetaname.Text = dt.Rows[0]["Tarjetaname"].ToString().Trim();

                //    btn_editar.Enabled = true;
                //    btn_eliminar.Enabled = true;
                //    btn_imprimir.Enabled = true;

                //    btn_primero.Enabled = true;
                //    btn_anterior.Enabled = true;
                //    btn_siguiente.Enabled = true;
                //    btn_ultimo.Enabled = true;

                //    btn_log.Enabled = true;
                //    btn_salir.Enabled = true;
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public bool Insert(string empresaid, tb_t1_tarjeta BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
        public String GetNextCod(string empresaid, tb_t1_tarjeta BE)
        {
            String newcod = "";

            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbCliente_SEARCH_nextcod", cnx))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    try
                    {
                        cnx.Open();
                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.Read())
                        {
                            newcod = Convert.ToString(reader["nextcod"]);
                        }
                        return newcod;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
 public bool Update(string empresaid, tb_t1_tarjeta BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
Ejemplo n.º 18
0
        private void data_TablaTarjeta()
        {
            try
            {
                if (TablaTarjeta.Rows.Count > 0)
                    TablaTarjeta.Rows.Clear();
                tb_t1_tarjetaBL BL = new tb_t1_tarjetaBL();
                tb_t1_tarjeta BE = new tb_t1_tarjeta();

                BE.tarjetaname = txt_criterio.Text.Trim().ToUpper();

                TablaTarjeta = BL.GetAll2(EmpresaID, BE).Tables[0];
                if (TablaTarjeta.Rows.Count > 0)
                {
                    btn_imprimir.Enabled = true;
                    gridTarjeta.DataSource = TablaTarjeta;
                    gridTarjeta.Rows[0].Selected = false;
                    gridTarjeta.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }