private void CheckURLParameter() { if (Request["edt"] != null && ModeField.Value == "None") { ModeField.Value = "Edit"; int t_idSupplier = int.Parse(Request["edt"].ToString()); Data2.Class.Struct_Supplier t_SP = new Data2.Class.Struct_Supplier(UserId, t_idSupplier); if (t_SP.Id != 0) { SupplierIdField.Value = t_SP.Id.ToString(); txtNombre.Text = t_SP.Nombre; txtNombreFantasia.Text = t_SP.NombreFantasia; Static.CmbController.SelectValue(cmbPais, t_SP.Pais.ToString()); Static.CmbController.SelectValue(cmbProvincia, t_SP.Provincia.ToString()); txtLocalidad.Text = t_SP.Localidad; txtDomicilio.Text = t_SP.Domicilio; txtTelefono1.Text = t_SP.Telefono1; txtTelefono2.Text = t_SP.Telefono2; txtMailContacto.Text = t_SP.MailContacto; txtMailPedidos.Text = t_SP.MailPedidos; Static.CmbController.SelectValue(cmbCategoríaAFIP, t_SP.IdCategoriaAfip.ToString()); txtIngresosBrutos.Text = t_SP.IngresosBrutos; Static.CmbController.SelectValue(cmbTipoDocumento, t_SP.IdTipoDocumento.ToString()); txtNumeroDocumento.Text = t_SP.NroDocumento; } } if (Request["del"] != null) { int t_idSupplier = int.Parse(Request["del"].ToString()); Data2.Class.Struct_Supplier t_SP = new Data2.Class.Struct_Supplier(UserId, t_idSupplier); t_SP.Borrar(UserId); RedirectToBase(); } }
protected void btnGuardar_Click(object sender, EventArgs e) { if (ModeField.Value == "New") { Data2.Class.Struct_Supplier t_Supplier = new Data2.Class.Struct_Supplier( Conversion.ObtenerLocal(UserId), txtNombre.Text, txtNombreFantasia.Text, int.Parse(cmbPais.SelectedValue), int.Parse(cmbProvincia.SelectedValue), txtLocalidad.Text, txtDomicilio.Text, txtTelefono1.Text, txtTelefono2.Text, txtMailContacto.Text, txtMailPedidos.Text, int.Parse(cmbCategoríaAFIP.SelectedValue), txtIngresosBrutos.Text, int.Parse(cmbTipoDocumento.SelectedValue), txtNumeroDocumento.Text, txtDetalle.Text); t_Supplier.Guardar(); RedirectToBase(); } if (ModeField.Value == "Edit") { Data2.Class.Struct_Supplier t_SP = new Data2.Class.Struct_Supplier(Conversion.ObtenerLocal(UserId), int.Parse(SupplierIdField.Value)); t_SP.Nombre = txtNombre.Text; t_SP.NombreFantasia = txtNombreFantasia.Text; t_SP.Pais = int.Parse(cmbPais.SelectedValue); t_SP.Provincia = int.Parse(cmbProvincia.SelectedValue); t_SP.Localidad = txtLocalidad.Text; t_SP.Domicilio = txtDomicilio.Text; t_SP.Telefono1 = txtTelefono1.Text; t_SP.Telefono2 = txtTelefono2.Text; t_SP.MailContacto = txtMailContacto.Text; t_SP.MailPedidos = txtMailPedidos.Text; t_SP.IdCategoriaAfip = int.Parse(cmbCategoríaAFIP.SelectedValue); t_SP.IngresosBrutos = txtIngresosBrutos.Text; t_SP.IdTipoDocumento = int.Parse(cmbTipoDocumento.SelectedValue); t_SP.NroDocumento = txtNumeroDocumento.Text; t_SP.Detalle = txtDetalle.Text; t_SP.Actualizar(Conversion.ObtenerLocal(UserId)); ModeField.Value = "None"; SupplierIdField.Value = "0"; RedirectToBase(); } }