/// <summary> /// Function to update values in accountGrroupTable /// </summary> public void EditFunction() { try { AccountGroupInfo infoAccountGroup = new AccountGroupInfo(); AccountGroupSP spAccountGroup = new AccountGroupSP(); infoAccountGroup.AccountName = txtAccountName.Text.Trim(); infoAccountGroup.AccountGroup = cmbAccountGroup.SelectedItem.ToString(); infoAccountGroup.AccountSubGroup = txtAccountSubGroup.Text.Trim(); infoAccountGroup.AccountCode = txtAccountCode.Text.Trim(); infoAccountGroup.Affects = cmbAffects.SelectedItem.ToString(); infoAccountGroup.IsDefault = false; infoAccountGroup.Narration = string.Empty; infoAccountGroup.Extra1 = string.Empty; infoAccountGroup.Extra2 = string.Empty; infoAccountGroup.AccountId = accountId; spAccountGroup.AccountGroupUpdate(infoAccountGroup); Messages.UpdatedMessage(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="infoAccountGroup"></param> /// <returns></returns> public bool AccountGroupUpdate(AccountGroupInfo infoAccountGroup) { bool isEdit = false; try { isEdit = spAccountGroup.AccountGroupUpdate(infoAccountGroup); } catch (Exception ex) { MessageBox.Show("AG5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isEdit); }
/// <summary> /// Function to save and edit account group /// </summary> public void SaveOrEdit() { try { strAccountGroupName = btnSave.Text == "Save" ? string.Empty : strAccountGroupName; if (CheckExistanceOfGroupName() == false) { if (txtAccountGroupName.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter account group name"); txtAccountGroupName.Focus(); } else if (cmbGroupUnder.SelectedIndex == -1) { Messages.InformationMessage("Select under"); cmbGroupUnder.Focus(); } else if (cmbNature.SelectedIndex == -1) { Messages.InformationMessage("Select nature"); cmbNature.Focus(); } else { AccountGroupInfo infoAccountGroup = new AccountGroupInfo(); AccountGroupSP spAccountGroup = new AccountGroupSP(); infoAccountGroup.AccountGroupName = txtAccountGroupName.Text.Trim(); infoAccountGroup.GroupUnder = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString()); infoAccountGroup.Nature = cmbNature.SelectedItem.ToString(); if (cmbAffectGrossProfit.SelectedIndex == -1) { infoAccountGroup.AffectGrossProfit = "No"; } else { infoAccountGroup.AffectGrossProfit = cmbAffectGrossProfit.SelectedItem.ToString(); } infoAccountGroup.IsDefault = false; infoAccountGroup.Narration = txtNarration.Text.Trim(); infoAccountGroup.Extra1 = string.Empty; infoAccountGroup.Extra2 = string.Empty; if (btnSave.Text == "Save") { if (Messages.SaveConfirmation()) { decAccountGroupId = spAccountGroup.AccountGroupAddWithIdentity(infoAccountGroup); Messages.SavedMessage(); decIdForOtherForms = decAccountGroupId; if (frmAccountLedgerobj != null) { this.Close(); } GridFill(); Clear(); } } else { if (isDefault == true) { Messages.InformationMessage("Can't update build in account group"); } else if (txtAccountGroupName.Text.Trim().ToLower() != cmbGroupUnder.Text.ToLower()) { if (Messages.UpdateConfirmation()) { infoAccountGroup.AccountGroupId = decAccountGroupIdForEdit; if (spAccountGroup.AccountGroupUpdate(infoAccountGroup)) { Messages.UpdatedMessage(); } GridFill(); Clear(); } } else { Messages.InformationMessage(" Can't save under same group"); } } } } else { Messages.InformationMessage(" Account group already exist"); txtAccountGroupName.Focus(); } } catch (Exception ex) { MessageBox.Show("AG8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }