public bool Copiar(string empresaid, tb_plla_afectacionesafp BE) { //return tablaDA.Update(empresaid, BE); bool zreturn = tablaDA.Copiar(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public bool Delete(string empresaid, tb_plla_afectacionesafp BE) { //return tablaDA.Delete(empresaid, BE); bool zreturn = tablaDA.Delete(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public bool Delete(string empresaid, tb_plla_afectacionesafp BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosafectacionesAFP_DELETE", cnx)) { { 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("@tipoplla", SqlDbType.Char, 1).Value = BE.tipoplla; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public bool Copiar(string empresaid, tb_plla_afectacionesafp BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosingreso_CopiarRubros", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipoplanillaorigen", SqlDbType.Char, 1).Value = BE.tipoplanillaorigen; cmd.Parameters.Add("@tipoplanilladestino", SqlDbType.Char, 1).Value = BE.tipoplanilladestino; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public DataSet GetMAX_CODIGORUBROPLANILLA(string empresaid, tb_plla_afectacionesafp BE) { //return tablaDA.GetAll_CONSULTA(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetMAX_CODIGORUBROPLANILLA(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public DataSet GetAll_IR(string empresaid, tb_plla_afectacionesafp BE) { //return tablaDA.GetAll_IR(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_IR(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
private void save() { if (u_Validate()) { if (Examinar.IsCurrentCellInEditMode) { Examinar.CommitEdit(DataGridViewDataErrorContexts.Commit); } Tabla.AcceptChanges(); for (lc_cont = 0; lc_cont <= Tabla.Rows.Count - 1; lc_cont++) { Tabla.Rows[lc_cont]["perianio"] = spnperiodo.Value.ToString(); Tabla.Rows[lc_cont]["perimes"] = cboMes.SelectedValue; Tabla.Rows[lc_cont]["tipoplla"] = cboTipoplanilla.SelectedValue; } Tabla.AcceptChanges(); var BL = new tb_plla_afectacionesafpBL(); var BE = new tb_plla_afectacionesafp(); BE.perianio = spnperiodo.Value.ToString(); BE.perimes = cboMes.SelectedValue.ToString(); BE.tipoplla = cboTipoplanilla.SelectedValue.ToString(); if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, Tabla)) { U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } }
private void CargaDatos() { var xcodmes = "99"; var xtipoplanilla = "."; var sorted = default(SortOrder); var xnomcolumna = string.Empty; if (cboMes.SelectedValue != null) { xcodmes = cboMes.SelectedValue.ToString(); } if (cboTipoplanilla.SelectedValue != null) { xtipoplanilla = cboTipoplanilla.SelectedValue.ToString(); } if (Examinar.SortedColumn != null) { xnomcolumna = Examinar.Columns[Examinar.SortedColumn.Index].Name; sorted = Examinar.SortOrder; } var BL = new tb_plla_afectacionesafpBL(); var BE = new tb_plla_afectacionesafp(); BE.perianio = spnperiodo.Value.ToString(); BE.perimes = xcodmes; BE.tipoplla = xtipoplanilla; Tabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; Examinar.AutoGenerateColumns = false; Examinar.DataSource = Tabla; }
public bool Insert_Update(string empresaid, tb_plla_afectacionesafp BE, DataTable TablaDatos) { //return tablaDA.Insert(empresaid, BE); bool zreturn = tablaDA.Insert_Update(empresaid, BE, TablaDatos); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public bool Insert_Update(string empresaid, tb_plla_afectacionesafp BE, DataTable TablaDatos) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { bool xreturn = true; int lcont = 0; using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosafectacionesAFP_Eliminar", cnx)) { 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("@tipoplla", SqlDbType.Char, 1).Value = BE.tipoplla; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { xreturn = true; } else { xreturn = false; } cnx.Close(); } catch (Exception ex) { Sql_Error = ex.Message; //throw new Exception(ex.Message); xreturn = false; cnx.Close(); } } for (lcont = 0; lcont <= TablaDatos.Rows.Count - 1; lcont++) { using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosafectacionesAFP_InsertUpdate", cnx)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = TablaDatos.Rows[lcont]["tipoplla"]; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = TablaDatos.Rows[lcont]["perianio"]; cmd.Parameters.Add("@perimes", SqlDbType.Char, 2).Value = TablaDatos.Rows[lcont]["perimes"]; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 3).Value = TablaDatos.Rows[lcont]["rubroid"]; cmd.Parameters.Add("@afecto", SqlDbType.Decimal).Value = TablaDatos.Rows[lcont]["afecto"]; //cmd.Parameters.Add("@status", SqlDbType.Decimal).Value = TablaDatos.Rows[lcont]["status"]; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { xreturn = true; } else { xreturn = false; } cnx.Close(); } catch (Exception ex) { Sql_Error = ex.Message; //throw new Exception(ex.Message); xreturn = false; cnx.Close(); } } } return xreturn; } }
public DataSet GetOne(string empresaid, tb_plla_afectacionesafp BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosafectacionesAFP_SELECT", 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("@tipoplla", SqlDbType.Char, 1).Value = BE.tipoplla; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public DataSet GetAll_IR(string empresaid, tb_plla_afectacionesafp BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosingreso_IR", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public DataSet GetAll_CONSULTA1(string empresaid, tb_plla_afectacionesafp BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrosafectacionesAFP_CONSULTA1", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 3).Value = BE.rubroid; cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.tipoplla; cmd.Parameters.Add("@descriplike1", SqlDbType.VarChar, 60).Value = BE.descriplike1; cmd.Parameters.Add("@descriplike2", SqlDbType.VarChar, 60).Value = BE.descriplike2; cmd.Parameters.Add("@descriplike3", SqlDbType.VarChar, 60).Value = BE.descriplike3; cmd.Parameters.Add("@norden", SqlDbType.Int).Value = BE.norden; cmd.Parameters.Add("@incluir_blanco", SqlDbType.Int).Value = BE.incluir_blanco; cmd.Parameters.Add("@nestado", SqlDbType.Int).Value = BE.nestado; cmd.Parameters.Add("@descartarrubros", SqlDbType.VarChar, 50).Value = BE.descartarrubros; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }