public DataSet GetAll_paginacion(string empresaid, tb_me_tiendalistitem BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeSubgrupo_SEARCH_paginacion", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tiendalist", SqlDbType.Int).Value = BE.tiendalist;
                 cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status;
                 cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
                 cmd.Parameters.Add("@feact", SqlDbType.DateTime).Value = BE.feact;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll(string empresaid, tb_me_tiendalistitem BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMetiendalistitem_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tiendalist", SqlDbType.Int).Value = BE.tiendalist;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 7).Value = BE.localid;
                 cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
             }
             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_tiendalistitem BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeTiendalistitem_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tiendalist", SqlDbType.Int).Value = BE.tiendalist;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.localid;
             }
             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_tiendalistitem BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_me_tiendalistitem BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetReport(string empresaid, tb_me_tiendalistitem BE)
 {
     return tablaDA.GetReport(empresaid, BE);
 }
 public DataSet GetAll_paginacion(string empresaid, tb_me_tiendalistitem BE)
 {
     return tablaDA.GetAll_paginacion(empresaid, BE);
 }
        private void RecibeLocal(String xlocal, String xlocalname, String resultado4, String resultado5, String otro)
        {
            if (xlocal.Trim().Length > 0)
            {
                tiendaid.Text = xlocal.Trim();
                tiendaname.Text = xlocalname.Trim();
                var BL = new tb_me_tiendalistitemBL();
                var BE = new tb_me_tiendalistitem();

                BE.tiendalist = Convert.ToInt32(tiendalistid.Text.Trim());
                BE.localid = tiendaid.Text.Trim();
                BE.usuar = VariablesPublicas.Usuar.Trim();
                BE.status = "0";
                BE.feact = DateTime.Today;

                if (BL.Insert(EmpresaID, BE))
                {
                    data_Tablatiendalistitem();
                }
            }
        }
        private void btn_del_Click(object sender, EventArgs e)
        {
            if ((dgv_tiendalistitem.RowCount != null))
            {
                var BL = new tb_me_tiendalistitemBL();
                var BE = new tb_me_tiendalistitem();
                BE.tiendalist = Convert.ToInt32(tiendalistid.Text.Trim());
                BE.localid = tiendaid.Text.Trim();

                if (BL.Delete(EmpresaID, BE))
                {
                    data_Tablatiendalistitem();
                    tiendaid.Text = string.Empty;
                    tiendaname.Text = string.Empty;
                }
            }
        }