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); } }
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); } }
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; } }
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); } }
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); } }
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); } }
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); } }
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); } }