コード例 #1
0
 public bool Delete(string empresaid, tb_me_vendedor BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeVendedor_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #2
0
 public DataSet GetAll(string empresaid, tb_me_vendedor BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeVendedor_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid;
                 cmd.Parameters.Add("@vendorname", SqlDbType.VarChar, 50).Value = BE.vendorname;
                 cmd.Parameters.Add("@appat", SqlDbType.VarChar, 20).Value = BE.appat;
                 cmd.Parameters.Add("@apmat", SqlDbType.VarChar, 20).Value = BE.apmat;
                 cmd.Parameters.Add("@nombre", SqlDbType.VarChar, 30).Value = BE.nombre;
                 cmd.Parameters.Add("@ddnni", SqlDbType.Char, 8).Value = BE.ddnni;
                 cmd.Parameters.Add("@direcc", SqlDbType.VarChar, 100).Value = BE.direcc;
                 cmd.Parameters.Add("@fechnac", SqlDbType.DateTime).Value = BE.fechnac;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local;
                 cmd.Parameters.Add("@fechini", SqlDbType.DateTime).Value = BE.fechini;
                 cmd.Parameters.Add("@fechcese", SqlDbType.DateTime).Value = BE.fechcese;
                 cmd.Parameters.Add("@telefono", SqlDbType.Char, 15).Value = BE.telefono;
                 cmd.Parameters.Add("@remunebas", SqlDbType.Decimal).Value = BE.remunebas;
                 cmd.Parameters.Add("@porccomic", SqlDbType.Decimal).Value = BE.porccomic;
                 cmd.Parameters.Add("@cargoid", SqlDbType.Char, 3).Value = BE.cargoid;
                 cmd.Parameters.Add("@fechasig", SqlDbType.DateTime).Value = BE.fechasig;
                 cmd.Parameters.Add("@sexo", SqlDbType.Char).Value = BE.sexo;
                 cmd.Parameters.Add("@conhijos", SqlDbType.Bit).Value = BE.conhijos;
                 cmd.Parameters.Add("@observac", SqlDbType.VarChar, 50).Value = BE.observac;
                 cmd.Parameters.Add("@status", SqlDbType.Char).Value = BE.status;
                 //cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
                 //cmd.Parameters.Add("@comisiona", SqlDbType.Bit).Value = BE.comisiona;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #3
0
 //
 public DataSet GetAll_History(string empresaid, tb_me_vendedor BE)
 {
     return tablaDA.GetAll_History(empresaid, BE);
 }
コード例 #4
0
 public bool Delete(string empresaid, tb_me_vendedor BE)
 {
     return tablaDA.Delete(empresaid, BE);
 }
コード例 #5
0
        private void Insert()
        {
            try
            {
                if (U_Validacion())
                {
                    // CLASES PARA LA INSERCION DE VENDEDORES
                    var BL = new tb_me_vendedorBL();
                    var BE = new tb_me_vendedor();

                    // CLASES PARA EL LLAMADO DEL INSERCION DE RRHH
                    rrhh_personalBL BLR = new rrhh_personalBL();
                    tb_rrhh_personal BER = new tb_rrhh_personal();

                    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.Insert(EmpresaID, BE))
                    {
                        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 + " Grabados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
        private void Delete()
        {
            try
            {
                if (U_Validacion())
                {
                    var BL = new tb_me_vendedorBL();
                    var BE = new tb_me_vendedor();

                    BE.vendorid = txt_vendorid.Text.Trim();

                    if (BL.Delete(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("E");

                        MessageBox.Show("Datos Eliminado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        NIVEL_FORMS();
                        limpiar_documento();
                        form_bloqueado(false);
                        data_TablaVendedor();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        private void data_TablaVendedor()
        {
            try
            {
                if (TablaVendedor.Rows.Count > 0)
                {
                    TablaVendedor.Rows.Clear();
                }
                var BL = new tb_me_vendedorBL();
                var BE = new tb_me_vendedor();

                BE.parameters = txt_busqueda.Text.Trim();
                BE.activo = Convert.ToBoolean(rb_tipo.EditValue);

                TablaVendedor = BL.GetAll2(EmpresaID, BE).Tables[0];
                if (TablaVendedor.Rows.Count > 0)
                {
                    btn_imprimir.Enabled = true;
                    Mdi_dgv_vendedor.DataSource = TablaVendedor;
                    lbl_num.Text = Convert.ToInt32(TablaVendedor.Compute("sum(id)", string.Empty)).ToString();
                }
                else
                {
                    Mdi_dgv_vendedor.DataSource = TablaVendedor;
                    lbl_num.Text = "0";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
 public bool Insert_Freeze(string empresaid, tb_me_vendedor BE)
 {
     return tablaDA.Insert_Freeze(empresaid, BE);
 }
コード例 #9
0
        void ValidaVendedor(String xcodvendor)
        {
            tb_me_vendedorBL BL = new tb_me_vendedorBL();
            tb_me_vendedor BE = new tb_me_vendedor();
            DataTable dt = new DataTable();
            BE.vendorid = xcodvendor.ToString();
            dt = BL.GetAll(EmpresaID, BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                txt_vendorid.Text = dt.Rows[0]["vendorid"].ToString();
                txt_vendorname.Text = dt.Rows[0]["vendorname"].ToString();
                txt_apepat.Text = dt.Rows[0]["appat"].ToString();
                txt_apemat.Text = dt.Rows[0]["apmat"].ToString();
                txt_nombre.Text = dt.Rows[0]["nombre"].ToString();
                txt_dni.Text = dt.Rows[0]["ddnni"].ToString();
                txt_direcc.Text = dt.Rows[0]["direcc"].ToString();

                if (dt.Rows[0]["fechnac"].ToString().Length > 0)
                    txt_fechnac.Text = dt.Rows[0]["fechnac"].ToString().Substring(0,10);
                txt_local.Text = dt.Rows[0]["local"].ToString();
                txt_localname.Text = dt.Rows[0]["localname"].ToString();
                txt_fechini.Text = dt.Rows[0]["fechini"].ToString().Substring(0,10);
                if (dt.Rows[0]["fechcese"].ToString().Length > 0)
                    txt_fechcese.Text = dt.Rows[0]["fechcese"].ToString().Substring(0,10);
                txt_telefono.Text = dt.Rows[0]["telefono"].ToString();
                txt_remunebas.Text = dt.Rows[0]["remunebas"].ToString();

                //txt_vendorid.Text = dt.Rows[0]["porccomic"].ToString();
                txt_cargoid.Text = dt.Rows[0]["cargoid"].ToString();
                txt_cargoname.Text = dt.Rows[0]["cargoname"].ToString();
                if (dt.Rows[0]["fechasig"].ToString().Length > 0)
                    txt_fechasig.Text = dt.Rows[0]["fechasig"].ToString().Substring(0,10);
                rb_sexo.EditValue = dt.Rows[0]["sexo"].ToString();

                chk_conhijos.Checked = Convert.ToBoolean(dt.Rows[0]["conhijos"].ToString());
                chk_comisiona.Checked = Convert.ToBoolean(dt.Rows[0]["comisiona"].ToString());
                txt_observ.Text = dt.Rows[0]["observac"].ToString();

             }

            btn_nuevo.Enabled = true;
            btn_editar.Enabled = true;
            btn_eliminar.Enabled = true;
            btn_imprimir.Enabled = true;
            btn_log.Enabled = true;
            btn_salir.Enabled = true;
        }
コード例 #10
0
 public bool Update(string empresaid, tb_me_vendedor BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeVendedor_UPDATE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid;
                 cmd.Parameters.Add("@vendorname", SqlDbType.VarChar, 50).Value = BE.vendorname;
                 cmd.Parameters.Add("@appat", SqlDbType.VarChar, 20).Value = BE.appat;
                 cmd.Parameters.Add("@apmat", SqlDbType.VarChar, 20).Value = BE.apmat;
                 cmd.Parameters.Add("@nombre", SqlDbType.VarChar, 30).Value = BE.nombre;
                 cmd.Parameters.Add("@ddnni", SqlDbType.Char, 8).Value = BE.ddnni;
                 cmd.Parameters.Add("@direcc", SqlDbType.VarChar, 100).Value = BE.direcc;
                 cmd.Parameters.Add("@fechnac", SqlDbType.DateTime).Value = BE.fechnac;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local;
                 cmd.Parameters.Add("@fechini", SqlDbType.DateTime).Value = BE.fechini;
                 cmd.Parameters.Add("@fechcese", SqlDbType.DateTime).Value = BE.fechcese;
                 cmd.Parameters.Add("@telefono", SqlDbType.Char, 15).Value = BE.telefono;
                 cmd.Parameters.Add("@remunebas", SqlDbType.Decimal).Value = BE.remunebas;
                 cmd.Parameters.Add("@porccomic", SqlDbType.Decimal).Value = BE.porccomic;
                 cmd.Parameters.Add("@cargoid", SqlDbType.Char, 3).Value = BE.cargoid;
                 cmd.Parameters.Add("@fechasig", SqlDbType.DateTime).Value = BE.fechasig;
                 cmd.Parameters.Add("@sexo", SqlDbType.Char).Value = BE.sexo;
                 cmd.Parameters.Add("@conhijos", SqlDbType.Bit).Value = BE.conhijos;
                 cmd.Parameters.Add("@observac", SqlDbType.VarChar, 50).Value = BE.observac;
                 cmd.Parameters.Add("@status", SqlDbType.Char).Value = BE.status;
                 cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
                 cmd.Parameters.Add("@comisiona", SqlDbType.Bit).Value = BE.comisiona;
             }
             try
             {
                 cnx.Open();
                 String newProdID = (String)cmd.ExecuteScalar();
                 if (newProdID.Length == 4)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #11
0
        // CLASE DE TB_ME_VENDEDORFREEZE
        public bool Insert_Freeze(string empresaid, tb_me_vendedor BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbMeVendedorfreeze_INSERT", cnx))
                {
                    try
                    {
                        cnx.Open();

                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
コード例 #12
0
        public DataSet GetReport(string empresaid, tb_me_vendedor BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("", cnx))
                {
                    DataSet ds = new DataSet();
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                    }
                    try
                    {
                        cnx.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
コード例 #13
0
        public DataSet GetOne(string empresaid, tb_me_vendedor BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("", cnx))
                {
                    DataSet ds = new DataSet();
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        //cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                        //cmd.Parameters.Add("@productid", SqlDbType.Char, 13).Value = BE.productid;
                    }

                    try
                    {
                        cnx.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
コード例 #14
0
 public DataSet GetAll_paginacion(string empresaid, tb_me_vendedor BE)
 {
     return tablaDA.GetAll_paginacion(empresaid, BE);
 }
コード例 #15
0
 private void btn_act_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     tb_me_vendedorBL BL = new tb_me_vendedorBL();
     tb_me_vendedor BE = new tb_me_vendedor();
     if (BL.Insert_Freeze(EmpresaID, BE))
     {
         MessageBox.Show("Proceso Terminado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #16
0
 public DataSet GetReport(string empresaid, tb_me_vendedor BE)
 {
     return tablaDA.GetReport(empresaid, BE);
 }
コード例 #17
0
        void CargarCargoVendedor(String xcod)
        {
            TablaVendedorDet = new DataTable();
            TablaVendedorDet.Columns.Add("fechasig", typeof(DateTime));
            TablaVendedorDet.Columns.Add("local", typeof(String));
            TablaVendedorDet.Columns.Add("localname", typeof(String));
            TablaVendedorDet.Columns.Add("cargoid", typeof(String));
            TablaVendedorDet.Columns.Add("cargoname", typeof(String));
            TablaVendedorDet.Columns.Add("observac", typeof(String));

            tb_me_vendedorBL BL = new tb_me_vendedorBL();
            tb_me_vendedor BE = new tb_me_vendedor();
            BE.vendorid = xcod.ToString();
            TablaVendedorDet = BL.GetAll_History(EmpresaID, BE).Tables[0];
            MDI_dgb_vendorcargo.DataSource = TablaVendedorDet;
        }
コード例 #18
0
 public bool Update(string empresaid, tb_me_vendedor BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
コード例 #19
0
 // CLASE DE TB_ME_VENDEDORHISTORY
 public DataSet GetAll_History(string empresaid, tb_me_vendedor BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeVendedorhistory_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@vendorid", SqlDbType.VarChar).Value = BE.vendorid;
                 //cmd.Parameters.Add("@activo", SqlDbType.Bit).Value = BE.activo;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }