public List <BankBE> GetAllBank() { List <BankBE> bankList = new List <BankBE>(); using (SqlConnection conn = new SqlConnection(ConnectionData.dbCn)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_bankList", conn); cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader dr = cmd.ExecuteReader()) { BankBE b; while (dr.Read()) { b = new BankBE(); b.Id = Convert.ToInt32(dr["id"].ToString()); b.Name = dr["name"].ToString(); b.Address = dr["address"].ToString(); b.RegistrationDate = Convert.ToDateTime(dr["registration_date"]); bankList.Add(b); } } } return(bankList); }
private void tlbMenu_DeleteClick() { try { Cursor = Cursors.WaitCursor; if (XtraMessageBox.Show("Be sure to delete the record?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ValidarIngreso()) { BankBE objE_Bank = new BankBE(); objE_Bank.IdBank = int.Parse(gvBank.GetFocusedRowCellValue("IdBank").ToString()); objE_Bank.Login = Parametros.strUsuarioLogin; objE_Bank.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_Bank.IdCompany = Parametros.intEmpresaId; BankBL objBL_Bank = new BankBL(); objBL_Bank.Elimina(objE_Bank); XtraMessageBox.Show("The record was successfully deleted.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Cargar(); } } Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public BankBE Selecciona(int IdBank) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Bank_Selecciona"); db.AddInParameter(dbCommand, "pidBank", DbType.Int32, IdBank); IDataReader reader = db.ExecuteReader(dbCommand); BankBE Bank = null; while (reader.Read()) { Bank = new BankBE(); Bank.IdBank = Int32.Parse(reader["idBank"].ToString()); Bank.IdCompany = Int32.Parse(reader["IdCompany"].ToString()); Bank.Swift = reader["Swift"].ToString(); Bank.NameBank = reader["NameBank"].ToString(); Bank.IdCurrency = Int32.Parse(reader["IdCurrency"].ToString()); Bank.NameCurrency = reader["NameCurrency"].ToString(); Bank.NumberCtaCte = reader["NumberCtaCte"].ToString(); Bank.CodeAba = reader["CodeAba"].ToString(); Bank.Address = reader["Address"].ToString(); Bank.Phone = reader["Phone"].ToString(); Bank.Contac = reader["Contac"].ToString(); Bank.FlagState = Boolean.Parse(reader["FlagState"].ToString()); } reader.Close(); reader.Dispose(); return(Bank); }
private void frmManBankEdit_Load(object sender, EventArgs e) { BSUtils.LoaderLook(cboCurrency, new CurrencyBL().ListaCombo(Parametros.intEmpresaId), "NameCurrency", "IdCurrency", true); if (pOperacion == Operacion.Nuevo) { this.Text = "Bank - New"; } else if (pOperacion == Operacion.Modificar) { this.Text = "Bank - Update"; BankBE objE_Bank = null; objE_Bank = new BankBL().Selecciona(IdBank); if (objE_Bank != null) { txtSwift.Text = objE_Bank.Swift; txtDescripcion.Text = objE_Bank.NameBank.Trim(); cboCurrency.EditValue = objE_Bank.IdCurrency; txtNumberCtaCte.Text = objE_Bank.NumberCtaCte; txtCodeAba.Text = objE_Bank.CodeAba; txtAddress.Text = objE_Bank.Address; txtPhone.Text = objE_Bank.Phone; txtContact.Text = objE_Bank.Contac; } } txtDescripcion.Select(); }
public void Inserta(BankBE pItem) { try { BankDL Bank = new BankDL(); Bank.Inserta(pItem); } catch (Exception ex) { throw ex; } }
public void Elimina(BankBE pItem) { try { BankDL Bank = new BankDL(); Bank.Elimina(pItem); } catch (Exception ex) { throw ex; } }
public void Actualiza(BankBE pItem) { try { BankDL Bank = new BankDL(); Bank.Actualiza(pItem); } catch (Exception ex) { throw ex; } }
public BankBE SeleccionaDescripcion(int IdCompany, string NameBank) { try { BankDL Bank = new BankDL(); BankBE objEmp = Bank.SeleccionaDescripcion(IdCompany, NameBank); return(objEmp); } catch (Exception ex) { throw ex; } }
public BankBE Selecciona(int IdBank) { try { BankDL Bank = new BankDL(); BankBE objEmp = Bank.Selecciona(IdBank); return(objEmp); } catch (Exception ex) { throw ex; } }
public void Elimina(BankBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Bank_Elimina"); db.AddInParameter(dbCommand, "pIdBank", DbType.Int32, pItem.IdBank); db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany); db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login); db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine); db.ExecuteNonQuery(dbCommand); }
private void cboBank_EditValueChanged(object sender, EventArgs e) { if (cboBank.EditValue != null) { BankBE objE_Bank = null; objE_Bank = new BankBL().Selecciona(Convert.ToInt32(cboBank.EditValue)); if (objE_Bank != null) { txtNumberCtaCte.Text = objE_Bank.NumberCtaCte; txtSwift.Text = objE_Bank.Swift; txtCodeAba.Text = objE_Bank.CodeAba; txtAddressBank.Text = objE_Bank.Address; txtPhone.Text = objE_Bank.Phone; txtRepresentative.Text = objE_Bank.Contac; } } }
public void UpdateBank(BankBE b) { Int32 r = 0; using (SqlConnection conn = new SqlConnection(ConnectionData.dbCn)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_updateBank", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id", SqlDbType.Int).Value = b.Id; cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = b.Name; cmd.Parameters.Add("@address", SqlDbType.VarChar).Value = b.Address; r = cmd.ExecuteNonQuery(); } }
public void AddBank(BankBE b) { Int32 r = 0; using (SqlConnection conn = new SqlConnection(ConnectionData.dbCn)) { conn.Open(); SqlCommand cmd = new SqlCommand("usp_addBank", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = b.Name; cmd.Parameters.Add("@address", SqlDbType.VarChar).Value = b.Address; cmd.Parameters.Add("@registration_date", SqlDbType.DateTime).Value = b.RegistrationDate; r = cmd.ExecuteNonQuery(); } }
public ActionResult Edit(BankBE bank) { try { if (!ModelState.IsValid) { return(View(bank)); } bankRep.UpdateBank(bank); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(BankBE bank) { try { if (!ModelState.IsValid) { return(View(bank)); } bankRep.DeleteBank(bank.Id); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.Error = ex.Message; bank = bankRep.GetAllBank().Find(x => x.Id == bank.Id); return(View(bank)); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { BankBL objBL_Bank = new BankBL(); BankBE objBank = new BankBE(); objBank.IdBank = IdBank; objBank.Swift = txtSwift.Text; objBank.NameBank = txtDescripcion.Text; objBank.IdCurrency = Convert.ToInt32(cboCurrency.EditValue); objBank.NumberCtaCte = txtNumberCtaCte.Text; objBank.CodeAba = txtCodeAba.Text; objBank.Address = txtAddress.Text; objBank.Phone = txtPhone.Text; objBank.Contac = txtContact.Text; objBank.FlagState = true; objBank.Login = Parametros.strUsuarioLogin; objBank.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objBank.IdCompany = Parametros.intEmpresaId; if (pOperacion == Operacion.Nuevo) { objBL_Bank.Inserta(objBank); } else { objBL_Bank.Actualiza(objBank); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Actualiza(BankBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Bank_Actualiza"); db.AddInParameter(dbCommand, "pIdBank", DbType.Int32, pItem.IdBank); db.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany); db.AddInParameter(dbCommand, "pSwift", DbType.String, pItem.Swift); db.AddInParameter(dbCommand, "pNameBank", DbType.String, pItem.NameBank); db.AddInParameter(dbCommand, "pIdCurrency", DbType.Int32, pItem.IdCurrency); db.AddInParameter(dbCommand, "pNumberCtaCte", DbType.String, pItem.NumberCtaCte); db.AddInParameter(dbCommand, "pCodeAba", DbType.String, pItem.CodeAba); db.AddInParameter(dbCommand, "pAddress", DbType.String, pItem.Address); db.AddInParameter(dbCommand, "pPhone", DbType.String, pItem.Phone); db.AddInParameter(dbCommand, "pContac", DbType.String, pItem.Contac); db.AddInParameter(dbCommand, "pFlagState", DbType.Boolean, pItem.FlagState); db.AddInParameter(dbCommand, "pLogin", DbType.String, pItem.Login); db.AddInParameter(dbCommand, "pMachine", DbType.String, pItem.Machine); db.ExecuteNonQuery(dbCommand); }
public void InicializarModificar() { if (gvBank.RowCount > 0) { BankBE objBank = new BankBE(); objBank.IdBank = int.Parse(gvBank.GetFocusedRowCellValue("IdBank").ToString()); frmManBankEdit objManBankEdit = new frmManBankEdit(); objManBankEdit.pOperacion = frmManBankEdit.Operacion.Modificar; objManBankEdit.IdBank = objBank.IdBank; objManBankEdit.pBankBE = objBank; objManBankEdit.StartPosition = FormStartPosition.CenterParent; objManBankEdit.ShowDialog(); Cargar(); } else { MessageBox.Show("No se pudo editar"); } }
public ActionResult Create() { BankBE bank = new BankBE(); return(View(bank)); }
public ActionResult Edit(int id) { BankBE bank = bankRep.GetAllBank().Find(x => x.Id == id); return(View(bank)); }