private void eliminarVendorAddressToolStripMenuItem_Click(object sender, EventArgs e) { try { int IdVendorAddress = 0; if (gvVendorAddress.GetFocusedRowCellValue("IdVendorAddress") != null) { IdVendorAddress = int.Parse(gvVendorAddress.GetFocusedRowCellValue("IdVendorAddress").ToString()); } VendorAddressBE objBE_VendorAddress = new VendorAddressBE(); objBE_VendorAddress.IdVendorAddress = IdVendorAddress; objBE_VendorAddress.IdCompany = Parametros.intEmpresaId; objBE_VendorAddress.Login = Parametros.strUsuarioLogin; objBE_VendorAddress.Machine = WindowsIdentity.GetCurrent().Name.ToString(); VendorAddressBL objBL_VendorAddress = new VendorAddressBL(); objBL_VendorAddress.Elimina(objBE_VendorAddress); gvVendorAddress.DeleteRow(gvVendorAddress.FocusedRowHandle); gvVendorAddress.RefreshData(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Actualiza(VendorAddressBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_VendorAddress_Actualiza"); db.AddInParameter(dbCommand, "pIdVendorAddress", DbType.Int32, pItem.IdVendorAddress); db.AddInParameter(dbCommand, "pIdVendor", DbType.Int32, pItem.IdVendor); db.AddInParameter(dbCommand, "pIdType", DbType.Int32, pItem.IdType); db.AddInParameter(dbCommand, "pEmail", DbType.String, pItem.Email); db.AddInParameter(dbCommand, "pWebPage", DbType.String, pItem.WebPage); db.AddInParameter(dbCommand, "pAddress", DbType.String, pItem.Address); db.AddInParameter(dbCommand, "pIdUbigeo", DbType.String, pItem.IdUbigeo); db.AddInParameter(dbCommand, "pCity", DbType.String, pItem.City); db.AddInParameter(dbCommand, "pState", DbType.String, pItem.State); db.AddInParameter(dbCommand, "pIdCountry", DbType.Int32, pItem.IdCountry); db.AddInParameter(dbCommand, "pPhone1", DbType.String, pItem.Phone1); db.AddInParameter(dbCommand, "pPhone2", DbType.String, pItem.Phone2); db.AddInParameter(dbCommand, "pFax", DbType.String, pItem.Fax); db.AddInParameter(dbCommand, "pReference", DbType.String, pItem.Reference); 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.AddInParameter(dbCommand, "pIdCompany", DbType.Int32, pItem.IdCompany); db.ExecuteNonQuery(dbCommand); }
public void Elimina(VendorAddressBE pItem) { try { VendorAddressDL VendorAddress = new VendorAddressDL(); VendorAddress.Elimina(pItem); } catch (Exception ex) { throw ex; } }
public void Actualiza(VendorAddressBE pItem) { try { VendorAddressDL VendorAddress = new VendorAddressDL(); VendorAddress.Actualiza(pItem); } catch (Exception ex) { throw ex; } }
public VendorAddressBE Selecciona(int IdVendorAddress) { try { VendorAddressDL VendorAddress = new VendorAddressDL(); VendorAddressBE objEmp = VendorAddress.Selecciona(IdVendorAddress); return(objEmp); } catch (Exception ex) { throw ex; } }
public void Elimina(VendorAddressBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_VendorAddress_Elimina"); db.AddInParameter(dbCommand, "pIdVendorAddress", DbType.Int32, pItem.IdVendorAddress); 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); }
public List <VendorAddressBE> ListaTodosActivo(int IdVendor) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_VendorAddress_ListaTodosActivo"); db.AddInParameter(dbCommand, "pIdVendor", DbType.Int32, IdVendor); IDataReader reader = db.ExecuteReader(dbCommand); List <VendorAddressBE> VendorAddresslist = new List <VendorAddressBE>(); VendorAddressBE VendorAddress; while (reader.Read()) { VendorAddress = new VendorAddressBE(); VendorAddress.IdCompany = Int32.Parse(reader["IdCompany"].ToString()); VendorAddress.IdVendor = Int32.Parse(reader["IdVendor"].ToString()); VendorAddress.IdVendorAddress = Int32.Parse(reader["idVendorAddress"].ToString()); VendorAddress.IdType = Int32.Parse(reader["IdType"].ToString()); VendorAddress.NameType = reader["NameType"].ToString(); VendorAddress.Email = reader["Email"].ToString(); VendorAddress.WebPage = reader["WebPage"].ToString(); VendorAddress.Address = reader["Address"].ToString(); VendorAddress.IdUbigeo = reader["IdUbigeo"].ToString(); VendorAddress.NomUbigeo = reader["NomUbigeo"].ToString(); VendorAddress.City = reader["City"].ToString(); VendorAddress.State = reader["State"].ToString(); VendorAddress.IdCountry = Int32.Parse(reader["IdCountry"].ToString()); VendorAddress.NameCountry = reader["NameCountry"].ToString(); VendorAddress.Phone1 = reader["Phone1"].ToString(); VendorAddress.Phone2 = reader["Phone2"].ToString(); VendorAddress.Fax = reader["Fax"].ToString(); VendorAddress.Reference = reader["Reference"].ToString(); VendorAddress.FlagState = Boolean.Parse(reader["FlagState"].ToString()); VendorAddress.TipoOper = 4; //CONSULTAR VendorAddresslist.Add(VendorAddress); } reader.Close(); reader.Dispose(); return(VendorAddresslist); }
public VendorAddressBE Selecciona(int IdVendorAddress) { Database db = DatabaseFactory.CreateDatabase("cnERPBD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_VendorAddress_Selecciona"); db.AddInParameter(dbCommand, "pidVendorAddress", DbType.Int32, IdVendorAddress); IDataReader reader = db.ExecuteReader(dbCommand); VendorAddressBE VendorAddress = null; while (reader.Read()) { VendorAddress = new VendorAddressBE(); VendorAddress.IdCompany = Int32.Parse(reader["IdCompany"].ToString()); VendorAddress.IdVendor = Int32.Parse(reader["IdVendor"].ToString()); VendorAddress.IdVendorAddress = Int32.Parse(reader["idVendorAddress"].ToString()); VendorAddress.IdType = Int32.Parse(reader["IdType"].ToString()); VendorAddress.NameType = reader["NameType"].ToString(); VendorAddress.Email = reader["Email"].ToString(); VendorAddress.WebPage = reader["WebPage"].ToString(); VendorAddress.Address = reader["Address"].ToString(); VendorAddress.IdUbigeo = reader["IdUbigeo"].ToString(); VendorAddress.NomUbigeo = reader["NomUbigeo"].ToString(); VendorAddress.City = reader["City"].ToString(); VendorAddress.State = reader["State"].ToString(); VendorAddress.IdCountry = Int32.Parse(reader["IdCountry"].ToString()); VendorAddress.NameCountry = reader["NameCountry"].ToString(); VendorAddress.Phone1 = reader["Phone1"].ToString(); VendorAddress.Phone2 = reader["Phone2"].ToString(); VendorAddress.Fax = reader["Fax"].ToString(); VendorAddress.Reference = reader["Reference"].ToString(); VendorAddress.FlagState = Boolean.Parse(reader["FlagState"].ToString()); } reader.Close(); reader.Dispose(); return(VendorAddress); }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { VendorBE objVendor = new VendorBE(); VendorBL objBL_Vendor = new VendorBL(); objVendor.IdVendor = IdVendor; objVendor.NameVendor = txtNameVendor.Text; objVendor.FlagNational = (chkNational.Checked) ? true : false; objVendor.FlagForeigner = (chkForeigner.Checked) ? true : false; objVendor.RevenueDate = Convert.ToDateTime(deRevenueDate.DateTime.ToShortDateString()); objVendor.IdStatus = (int)cboStatus.EditValue; objVendor.Ruc = txtRuc.Text; objVendor.NameVendor = txtNameVendor.Text; objVendor.IdEvaluation = (int)cboEvaluation.EditValue; objVendor.Code = txtVendorCode.Text; objVendor.Corporation = txtCorporation.Text; objVendor.Capacity = Convert.ToDecimal(txtCapacity.EditValue); objVendor.Representative = txtRepresentative.Text; objVendor.NumberEmployees = Convert.ToInt32(txtNumberEmployees.EditValue); objVendor.FlagState = true; objVendor.Login = Parametros.strUsuarioLogin; objVendor.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objVendor.IdCompany = Parametros.intEmpresaId; //Vendor ADDRESS List <VendorAddressBE> lstVendorAddress = new List <VendorAddressBE>(); foreach (var item in mListaVendorAddressOrigen) { VendorAddressBE objE_VendorAddress = new VendorAddressBE(); objE_VendorAddress.IdCompany = Parametros.intEmpresaId; objE_VendorAddress.IdVendor = IdVendor; objE_VendorAddress.IdVendorAddress = item.IdVendorAddress; objE_VendorAddress.IdType = item.IdType; objE_VendorAddress.Email = item.Email; objE_VendorAddress.WebPage = item.WebPage; objE_VendorAddress.Address = item.Address; objE_VendorAddress.IdUbigeo = item.IdUbigeo; objE_VendorAddress.City = item.City; objE_VendorAddress.State = item.State; objE_VendorAddress.IdCountry = item.IdCountry; objE_VendorAddress.Phone1 = item.Phone1; objE_VendorAddress.Phone2 = item.Phone2; objE_VendorAddress.Fax = item.Fax; objE_VendorAddress.Reference = item.Reference; objE_VendorAddress.FlagState = true; objE_VendorAddress.Login = Parametros.strUsuarioLogin; objE_VendorAddress.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_VendorAddress.TipoOper = item.TipoOper; lstVendorAddress.Add(objE_VendorAddress); } //Vendor CONTACT List <VendorContactBE> lstVendorContact = new List <VendorContactBE>(); foreach (var item in mListaVendorContactOrigen) { VendorContactBE objE_VendorContact = new VendorContactBE(); objE_VendorContact.IdCompany = Parametros.intEmpresaId; objE_VendorContact.IdVendor = IdVendor; objE_VendorContact.IdVendorContact = item.IdVendorContact; objE_VendorContact.Name = item.Name; objE_VendorContact.FirstName = item.FirtsName; objE_VendorContact.Company = item.Company; objE_VendorContact.Occupation = item.Occupation; objE_VendorContact.IdDestination = item.IdDestination; objE_VendorContact.Phone1 = item.Phone1; objE_VendorContact.Phone2 = item.Phone2; objE_VendorContact.CelPhone = item.CelPhone; objE_VendorContact.Fax = item.Fax; objE_VendorContact.Email = item.Email; objE_VendorContact.InformationAdditional = item.InformationAdditional; objE_VendorContact.FlagState = true; objE_VendorContact.Login = Parametros.strUsuarioLogin; objE_VendorContact.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_VendorContact.TipoOper = item.TipoOper; lstVendorContact.Add(objE_VendorContact); } //Vendor Classification List <VendorClassificationBE> lstVendorClassification = new List <VendorClassificationBE>(); foreach (var item in mListaVendorClassificationOrigen) { VendorClassificationBE objE_VendorClassification = new VendorClassificationBE(); objE_VendorClassification.IdCompany = Parametros.intEmpresaId; objE_VendorClassification.IdVendor = IdVendor; objE_VendorClassification.IdVendorClassification = item.IdVendorClassification; objE_VendorClassification.IdClassification = item.IdClassification; objE_VendorClassification.NameClassification = item.NameClassification; objE_VendorClassification.FlagActive = item.FlagActive; objE_VendorClassification.FlagState = true; objE_VendorClassification.Login = Parametros.strUsuarioLogin; objE_VendorClassification.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objE_VendorClassification.TipoOper = item.TipoOper; lstVendorClassification.Add(objE_VendorClassification); } if (pOperacion == Operacion.Nuevo) { objBL_Vendor.Inserta(objVendor, lstVendorAddress, lstVendorContact, lstVendorClassification); XtraMessageBox.Show("the vendor record was created.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { objBL_Vendor.Actualiza(objVendor, lstVendorAddress, lstVendorContact, lstVendorClassification); XtraMessageBox.Show("the vendor record was updated.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }