private void UnitRadButtonElement_Click(object sender, EventArgs e) { UnitRadForm _form = new UnitRadForm(); if (!isOpenForm(_form)) { _form.MdiParent = this; _form.Show(); } }
private void GetAndLoadUnitFromDB() { UnitRadForm _parent = this.parentForm as UnitRadForm; var idResult = (Int32)_parent._currentRowSelected.Cells["UnitID"].Value; _currentUnit = this._serviceUnitBL.Find(idResult); if (_currentUnit != null) { UnitDescriptionRadTextBox.Text = _currentUnit.UnitDescription; AbbreviationRadTextBox.Text = _currentUnit.Abbreviation; } }
private void RegisterRadButton_Click(object sender, EventArgs e) { RadButton currentButton = sender as RadButton; UnitRadForm unitForm = this.parentForm as UnitRadForm; switch (currentButton.Text) { case "Registrar": #region Register Category if (ValidateForm()) { try { Unit _u = new Unit() { UnitDescription = UnitDescriptionRadTextBox.Text.ToUpper(), Abbreviation = AbbreviationRadTextBox.Text.ToUpper() }; this._serviceUnitBL.Add(_u); RadMessageBox.Show(this, "Unidad de medida creada satisfactoriamente.", "JOSIAS INDUSTRIAL", MessageBoxButtons.OK, RadMessageIcon.Info); unitForm.FillUnitRadGridView(); this.Close(); return; } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Message").AppendLine(ex.Message) .AppendLine("StackTrace").AppendLine(ex.StackTrace.ToString()); RadMessageBox.Show("Error ocurrido, presione el botón para desplegarlo.", "JOSIAS INDUSTRIAL", MessageBoxButtons.OK, RadMessageIcon.Error, sb.ToString()); return; } } #endregion break; case "Actualizar": #region Update Category if (ValidateForm()) { try { _currentUnit.UnitDescription = UnitDescriptionRadTextBox.Text.ToUpper(); _currentUnit.Abbreviation = AbbreviationRadTextBox.Text.ToUpper(); this._serviceUnitBL.Update(_currentUnit); RadMessageBox.Show(this, "Unidad de medida actualizada satisfactoriamente.", "JOSIAS INDUSTRIAL", MessageBoxButtons.OK, RadMessageIcon.Info); unitForm.FillUnitRadGridView(); this.Close(); return; } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Message").AppendLine(ex.Message) .AppendLine("StackTrace").AppendLine(ex.StackTrace.ToString()); RadMessageBox.Show("Error ocurrido, presione el botón para desplegarlo.", "JOSIAS INDUSTRIAL", MessageBoxButtons.OK, RadMessageIcon.Error, sb.ToString()); return; } } #endregion break; case "Aceptar": this.Close(); break; } }