コード例 #1
0
        private void Update()
        {
            try
            {
                if (U_Validacion())
                {
                    var BL = new tb_me_vendedorBL();
                    var BE = new tb_me_vendedor();

                    BE.vendorid = txt_vendorid.Text.Trim();
                    BE.vendorname = txt_vendorname.Text.Trim().ToUpper();
                    BE.appat = txt_apepat.Text.ToUpper();
                    BE.apmat = txt_apemat.Text.ToUpper();
                    BE.nombre = txt_nombre.Text.ToUpper();
                    BE.ddnni = txt_dni.Text.Trim();
                    BE.direcc = txt_direcc.Text.Trim();
                    if (txt_fechnac.Text.Length > 0)
                        BE.fechnac = Convert.ToDateTime(txt_fechnac.Text);
                    BE.local = txt_local.Text.Trim();
                    if (txt_fechini.Text.Length > 0)
                        BE.fechini = Convert.ToDateTime(txt_fechini.Text);
                    if (txt_fechcese.Text.Length > 0)
                        BE.fechcese = Convert.ToDateTime(txt_fechcese.Text);
                    BE.telefono = txt_telefono.Text;
                    BE.remunebas = Convert.ToDecimal(txt_remunebas.Text);
                    BE.cargoid = txt_cargoid.Text.Trim();
                    if (txt_fechasig.Text.Length > 0)
                        BE.fechasig = Convert.ToDateTime(txt_fechasig.Text);
                    BE.sexo = rb_sexo.EditValue.ToString();
                    BE.conhijos = chk_conhijos.Checked;
                    BE.comisiona = chk_comisiona.Checked;
                    BE.observac = txt_observ.Text.Trim();
                    BE.status = "0";
                    BE.usuar = VariablesPublicas.Usuar.Trim().ToUpper();

                    String xxMessage ="";
                    if (BL.Update(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("M");
                        xxMessage = " 1";

                        // Verificamos en el Datapi Si Existe un Personal con el Dni
                        if (SearchWebDNI() > 0)
                        {
                            if (UpdateWeb())
                            {
                                xxMessage = xxMessage + " / 2";
                            }
                        }
                        else
                        {
                            if (InsertWeb())
                            {
                                xxMessage = xxMessage + " / 2";
                            }
                        }

                        MessageBox.Show("Datos " + xxMessage + " Modificados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }