public bool Insert(string empresaid, tb_plla_tipocontrato BE) { //return tablaDA.Insert(empresaid, BE); bool zreturn = tablaDA.Insert(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public bool Delete(string empresaid, tb_plla_tipocontrato BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllatipocontrato_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipocontratoid", SqlDbType.Char, 2).Value = BE.tipocontratoid; } 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 GetOne(string empresaid, tb_plla_tipocontrato BE) { //return tablaDA.GetOne(empresaid, tipoplla); DataSet xreturn = null; xreturn = tablaDA.GetOne(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public DataSet GetAll_MaxCodigo(string empresaid, tb_plla_tipocontrato BE) { //return tablaDA.GetAll_MaxRubro(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_MaxCodigo(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public DataSet GetAll_CONSULTAIR(string empresaid, tb_plla_tipocontrato BE) { //return tablaDA.GetAll_CONSULTAIR(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_CONSULTAIR(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public bool Insert_Update(string empresaid, tb_plla_tipocontrato BE, DataTable Detalle) { //return tablaDA.Insert(empresaid, BE); bool zreturn = tablaDA.Insert_Update(empresaid, BE, Detalle); Sql_Error = tablaDA.Sql_Error; return zreturn; }
private void ModalidadContrato() { cmb_tipocontrato.ValueMember = "tipocontratoid"; cmb_tipocontrato.DisplayMember = "tipocontratoname"; var BL = new tb_plla_tipocontratoBL(); var BE = new tb_plla_tipocontrato(); cmb_tipocontrato.DataSource = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; }
public DataSet GetAll(string empresaid, tb_plla_tipocontrato BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllatipocontrato_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipocontratoid", SqlDbType.Char, 2).Value = BE.tipocontratoid; cmd.Parameters.Add("@tipocontratoname", SqlDbType.VarChar, 80).Value = BE.tipocontratoname; //cmd.Parameters.Add("@status", SqlDbType.Int).Value = BE.status; cmd.Parameters.Add("@pdttipocontrato", SqlDbType.Char, 2).Value = BE.pdttipocontrato; cmd.Parameters.Add("@formatocontrato", SqlDbType.Char, 2).Value = BE.formatocontrato; } 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 bool Update(string empresaid, tb_plla_tipocontrato BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllatipocontrato_UPDATE", cnx)) { { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipocontratoid", SqlDbType.Char, 2).Value = BE.tipocontratoid; cmd.Parameters.Add("@tipocontratoname", SqlDbType.VarChar, 80).Value = BE.tipocontratoname; cmd.Parameters.Add("@status", SqlDbType.Int).Value = BE.status; cmd.Parameters.Add("@pdttipocontrato", SqlDbType.Char, 2).Value = BE.pdttipocontrato; cmd.Parameters.Add("@formatocontrato", SqlDbType.Char, 2).Value = BE.formatocontrato; } 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 Insert_Update(string empresaid, tb_plla_tipocontrato BE, DataTable Detalle) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { bool xreturn = true; int lcont = 0; for (lcont = 0; lcont <= Detalle.Rows.Count - 1; lcont++) { using (SqlCommand cmd = new SqlCommand("gspTbPllatipocontrato_InsertUpdate", cnx)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@tipocontratoid", SqlDbType.Char, 2).Value = Detalle.Rows[lcont]["tipocontratoid"]; cmd.Parameters.Add("@tipocontratoname", SqlDbType.VarChar, 80).Value = Detalle.Rows[lcont]["tipocontratoname"]; cmd.Parameters.Add("@status", SqlDbType.Int).Value = Detalle.Rows[lcont]["status"]; cmd.Parameters.Add("@pdttipocontrato", SqlDbType.Char, 2).Value = Detalle.Rows[lcont]["pdttipocontrato"]; cmd.Parameters.Add("@formatocontrato", SqlDbType.Char, 2).Value = Detalle.Rows[lcont]["formatocontrato"]; 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 GetAll_CONSULTACCOSTO(string empresaid, tb_plla_plantilla_contratos BE) //{ // using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) // { // using (SqlCommand cmd = new SqlCommand("gspTbPllaCcostogen_CONSULTASelectAll", cnx)) // { // DataSet ds = new DataSet(); // { // cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.AddWithValue("@empresaid", string.IsNullOrEmpty(BE.empresaid) ? (object)DBNull.Value : BE.empresaid); // cmd.Parameters.AddWithValue("@nomlike1", string.IsNullOrEmpty(BE.nomlike1) ? (object)DBNull.Value : BE.nomlike1); // cmd.Parameters.AddWithValue("@nomlike2", string.IsNullOrEmpty(BE.nomlike2) ? (object)DBNull.Value : BE.nomlike2); // cmd.Parameters.AddWithValue("@nomlike3", string.IsNullOrEmpty(BE.nomlike3) ? (object)DBNull.Value : BE.nomlike3); // cmd.Parameters.AddWithValue("@ccostodescartar", string.IsNullOrEmpty(BE.ccostodescartar) ? (object)DBNull.Value : BE.ccostodescartar); // } // 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_MaxCodigo(string empresaid, tb_plla_tipocontrato BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllatipocontrato_MAXCODIGO", 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) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public DataSet GetAll_CONSULTAIR(string empresaid, tb_plla_tipocontrato BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllatipocontrato_IR", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@tipocontratoid", string.IsNullOrEmpty(BE.tipocontratoid) ? (object)DBNull.Value : BE.tipocontratoid); } 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); } } } }
private void Accion(int naccion) { switch (naccion) { case 1: u_n_opsel = 1; U_RefrescaControles(); Blanquear(); tb_plla_tipocontratoBL BL = new tb_plla_tipocontratoBL(); tb_plla_tipocontrato BE = new tb_plla_tipocontrato(); txtcodigo.Text = BL.GetAll_MaxCodigo(VariablesPublicas.EmpresaID, BE).Tables[0].Rows[0]["maximo_codigo"].ToString(); if (Examinar.CurrentRow != null) { Examinar.CurrentRow.Selected = false; } break; case 2: POnedatos(); u_n_opsel = 2; U_RefrescaControles(); Examinar.CurrentRow.Selected = true; break; case 3: xnomcampo = ""; if ((Examinar.CurrentRow != null)) { tb_plla_tipocontratoBL BLIR = new tb_plla_tipocontratoBL(); tb_plla_tipocontrato BEIR = new tb_plla_tipocontrato(); BEIR.tipocontratoid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipocontratoid"].Value.ToString(); //tmpcursor = BLIR.GetAll_CONSULTAIR(VariablesPublicas.EmpresaID, BEIR).Tables[0]; //tmpcursor = ocapa.IR_PAG1500(GlobalVars.GetInstance.Company, Examinar.Rows(Examinar.CurrentRow.Index).Cells("tipocontratoid").Value); if (BLIR.Sql_Error.Length > 0) { xnomcampo = BLIR.Sql_Error; Frm_Class.ShowError(BLIR.Sql_Error, this); } else { if (tmpcursor.Rows.Count == 0) { } else { for (lc_cont = 0; lc_cont <= tmpcursor.Rows.Count - 1; lc_cont++) { xnomcampo = xnomcampo + tmpcursor.Rows[lc_cont]["relacion"] + "\r"; if (lc_cont + 1 == 10) { break; } } } } } if (xnomcampo.Length == 0) { if (MessageBox.Show("Desea Eliminar Registro ..?", "Mensaje del Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { tb_plla_tipocontratoBL BLCO = new tb_plla_tipocontratoBL(); tb_plla_tipocontrato BECO = new tb_plla_tipocontrato(); BECO.tipocontratoid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipocontratoid"].Value.ToString(); BECO.norden = 1; BECO.ver_blanco = 0; tmpcursor = BLCO.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BECO).Tables[0]; if (BLCO.Sql_Error.Length == 0) { if (BLCO.Eliminar(VariablesPublicas.EmpresaID, tmpcursor)) { for (lc_cont = 0; lc_cont <= Tabla.Rows.Count - 1; lc_cont++) { if (Tabla.Rows[lc_cont]["tipocontratoid"] == Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipocontratoid"].Value) { Tabla.Rows[lc_cont].Delete(); Tabla.AcceptChanges(); break; } } Examinar.Refresh(); } else { Frm_Class.ShowError(BLCO.Sql_Error, this); } } else { Frm_Class.ShowError(BLCO.Sql_Error, this); } } } else { MessageBox.Show(xnomcampo, "Imposible Eliminar Registro"); } break; } }
private void save() { if (u_Validate()) { tmpcursor = null; tb_plla_tipocontratoBL BL = new tb_plla_tipocontratoBL(); tb_plla_tipocontrato BE = new tb_plla_tipocontrato(); BE.norden = 1; BE.ver_blanco = 0; tmpcursor = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; DataRow ofila = tmpcursor.NewRow(); ofila = VariablesPublicas.InsertIntoTable(tmpcursor); if (u_n_opsel == 1) { tmptabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; if (tmptabla.Rows.Count > 0) { ofila["tipocontratoid"] = BL.GetAll_MaxCodigo(VariablesPublicas.EmpresaID, BE).Tables[0].Rows[0]["maximo_codigo"].ToString(); } else { ofila["tipocontratoid"] = txtcodigo.Text; } ofila["status"] = 1; } else { ofila["tipocontratoid"] = Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipocontratoid"].Value; for (lc_cont = 0; lc_cont <= Examinar.ColumnCount - 1; lc_cont++) { xnomcampo = Examinar.Columns[lc_cont].Name; ofila[xnomcampo] = Examinar.Rows[Examinar.CurrentRow.Index].Cells[lc_cont].Value; } } ofila["tipocontratoid"] = txtcodigo.Text; ofila["tipocontratoname"] = txtDescripcion.Text; if ((cmbtipcontrato.SelectedValue != null)) { ofila["pdttipocontrato"] = cmbtipcontrato.SelectedValue; } if ((cmbformatocontrato.SelectedValue != null)) { ofila["formatocontrato"] = cmbformatocontrato.SelectedValue; } tmpcursor.Rows.Add(ofila); if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, tmpcursor)) { U_CancelarEdicion(0); } else { Frm_Class.ShowError(BL.Sql_Error, this); } } }
private void CargaDatos() { SortOrder sorted = default(SortOrder); string xnomcolumna = ""; if (Examinar.SortedColumn != null) { xnomcolumna = Examinar.Columns[Examinar.SortedColumn.Index].Name; sorted = Examinar.SortOrder; } tb_plla_tipocontratoBL BL = new tb_plla_tipocontratoBL(); tb_plla_tipocontrato BE = new tb_plla_tipocontrato(); BE.norden = 1; BE.ver_blanco = 0; Tabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0]; Examinar.AutoGenerateColumns = false; Examinar.DataSource = Tabla; VariablesPublicas.PintaEncabezados(Examinar); if (xnomcolumna.Trim().Length > 0) { if (sorted == SortOrder.Ascending) { Examinar.Sort(Examinar.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Ascending); } else { Examinar.Sort(Examinar.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Descending); } } else { Examinar.Sort(Examinar.Columns["tipocontratoid"], System.ComponentModel.ListSortDirection.Ascending); } }