public DataSet GetAll(string empresaid, tb_pp_hojacostodet BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPpHojacostodet_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@articid", SqlDbType.Char, 4).Value = BE.articid;
                 cmd.Parameters.Add("@version", SqlDbType.Char, 3).Value = BE.version;
             }
             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_pp_hojacostodet BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPpHojacostocab_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@articid", SqlDbType.Char, 4).Value = BE.articid;
                 cmd.Parameters.Add("@version", SqlDbType.Char, 3).Value = BE.version;
             }
             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_pp_hojacostodet BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_pp_hojacostodet BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetAll(string empresaid, tb_pp_hojacostodet BE)
 {
     return tablaDA.GetAll(empresaid, BE);
 }
 private void CargarDetalle()
 {
     var BL = new tb_pp_hojacostodetBL();
     var BE = new tb_pp_hojacostodet();
     TablaprecioslistDet = new DataTable();
     BE.articid = articid.Text.Trim();
     BE.version = version.Text.Trim();
     TablaprecioslistDet = BL.GetAll(EmpresaID, BE).Tables[0];
     if (TablaprecioslistDet.Rows.Count > 0)
     {
         dgb_dethojacosto.DataSource = TablaprecioslistDet;
     }
     else
     {
         dgb_dethojacosto.DataSource = TablaprecioslistDet;
     }
 }
 public bool Update(string empresaid, tb_pp_hojacostodet BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@articid", SqlDbType.Char, 4).Value = BE.articid;
                 cmd.Parameters.Add("@version", SqlDbType.Char, 3).Value = BE.version;
                 cmd.Parameters.Add("@rubroid", SqlDbType.Char, 2).Value = BE.rubroid;
                 cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid;
                 cmd.Parameters.Add("@valor", SqlDbType.Decimal).Value = BE.valor;
                 cmd.Parameters.Add("@consumo", SqlDbType.Decimal).Value = BE.consumo;
                 cmd.Parameters.Add("@unmed", SqlDbType.Char, 3).Value = BE.unmed;
                 cmd.Parameters.Add("@importe", SqlDbType.Decimal).Value = BE.importe;
                 cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status;
                 cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }