public DataSet GetAll2(string empresaid, tb_me_planillacomision BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMePlanillacomisionDet_SEARCH_mensual", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio;
                 cmd.Parameters.Add("@perimes", SqlDbType.Char, 2).Value = BE.perimes;
                 cmd.Parameters.Add("@cateplanid", SqlDbType.Char, 1).Value = BE.cateplanid;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Delete(string empresaid, tb_me_planillacomision BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 //cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 //cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Update(string empresaid, tb_me_planillacomision BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_me_planillacomision BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetOne(string empresaid, tb_me_planillacomision BE)
 {
     return tablaDA.GetOne(empresaid, BE);
 }
 public DataSet GetAll_paginacion(string empresaid, tb_me_planillacomision BE)
 {
     return tablaDA.GetAll_paginacion(empresaid, BE);
 }
        private void Data_TablaPlanillaComision()
        {
            try
            {
                TablaPlanillaComision = new DataTable();

                if (TablaPlanillaComision.Rows.Count > 0)
                {
                    TablaPlanillaComision.Rows.Clear();
                }
                var BL = new tb_me_planillacomisionBL();
                var BE = new tb_me_planillacomision();

                if (cmb_perianio.SelectedIndex != -1 && chk_anio.Checked == true)
                {
                    BE.perianio = cmb_perianio.SelectedValue.ToString();
                }
                if (cmb_perimes2.SelectedIndex != -1 && chk_mes.Checked == true)
                {
                    BE.perimes = cmb_perimes2.SelectedValue.ToString();
                }
                if (cmb_categoria.SelectedIndex != -1 && chk_cargo.Checked == true)
                {
                    BE.cateplanid = cmb_categoria.SelectedValue.ToString();
                }

                TablaPlanillaComision = BL.GetAll2(EmpresaID, BE).Tables[0];
                if (TablaPlanillaComision.Rows.Count > 0)
                {
                    MDI_dgb_planillacomision.DataSource = TablaPlanillaComision;
                }
                else
                {
                    MDI_dgb_planillacomision.DataSource = TablaPlanillaComision;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public bool Update(string empresaid, tb_me_planillacomision BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("", cnx))
                {

                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        //cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                        //cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid;
                        //cmd.Parameters.Add("@lineaname", SqlDbType.VarChar, 20).Value = BE.lineaname;
                        //cmd.Parameters.Add("@estructuraid", SqlDbType.Char, 1).Value = BE.estructuraid;
                        //cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
                        //cmd.Parameters.Add("@nostock", SqlDbType.Bit).Value = BE.nostock;
                    }
                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    finally
                    {
                        cnx.Close();
                    }
                }
            }
        }
        public DataSet GetOne(string empresaid, tb_me_planillacomision 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("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid;
                    }

                    try
                    {
                        cnx.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }