/// <summary> /// Edit function /// </summary> public void EditFunction() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix.FromDate = Convert.ToDateTime(txtFromDate.Text.ToString()); infoSuffixPrefix.ToDate = Convert.ToDateTime(txtToDate.Text.ToString()); String strvouchertype = (cmbVoucherType.SelectedValue.ToString()); infoSuffixPrefix.VoucherTypeId = Convert.ToDecimal(strvouchertype.ToString()); infoSuffixPrefix.Prefix = txtPrefix.Text.Trim(); infoSuffixPrefix.Suffix = txtSufix.Text.Trim(); infoSuffixPrefix.StartIndex = Convert.ToDecimal(txtStartIndex.Text.ToString()); if (cbxPrefillWithZero.Checked) { infoSuffixPrefix.PrefillWithZero = true; infoSuffixPrefix.WidthOfNumericalPart = Convert.ToInt32(txtWidthofNumericalPart.Text.ToString()); } else { infoSuffixPrefix.PrefillWithZero = false; infoSuffixPrefix.WidthOfNumericalPart = 0; } infoSuffixPrefix.Narration = txtNarration.Text.Trim(); infoSuffixPrefix.Extra1 = string.Empty; infoSuffixPrefix.Extra2 = string.Empty; infoSuffixPrefix.SuffixprefixId = decSuffixPrefixId; if (spSuffixPrefix.SuffixPrefixCheckExistenceForAdd(txtFromDate.Text.ToString(), txtToDate.Text.ToString(), Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), decSuffixPrefixId) == false) { if (spSuffixPrefix.SuffixPrefixSettingsEdit(infoSuffixPrefix)) { Messages.UpdatedMessage(); Clear(); } else { Messages.ReferenceExistsMessageForUpdate(); cmbVoucherType.Focus(); } } else { Messages.InformationMessage("Voucher type already exist for dates"); cmbVoucherType.Focus(); } } catch (Exception ex) { formMDI.infoError.ErrorString = "SPS5" + ex.Message; } }
/// <summary> /// Edit function /// </summary> public void EditFunction() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix.FromDate = Convert.ToDateTime(txtFromDate.Text.ToString()); infoSuffixPrefix.ToDate = Convert.ToDateTime(txtToDate.Text.ToString()); String strvouchertype = (cmbVoucherType.SelectedValue.ToString()); infoSuffixPrefix.VoucherTypeId = Convert.ToDecimal(strvouchertype.ToString()); infoSuffixPrefix.Prefix = txtPrefix.Text.Trim(); infoSuffixPrefix.Suffix = txtSufix.Text.Trim(); infoSuffixPrefix.StartIndex = Convert.ToDecimal(txtStartIndex.Text.ToString()); if (cbxPrefillWithZero.Checked) { infoSuffixPrefix.PrefillWithZero = true; infoSuffixPrefix.WidthOfNumericalPart = Convert.ToInt32(txtWidthofNumericalPart.Text.ToString()); } else { infoSuffixPrefix.PrefillWithZero = false; infoSuffixPrefix.WidthOfNumericalPart = 0; } infoSuffixPrefix.Narration = txtNarration.Text.Trim(); infoSuffixPrefix.Extra1 = string.Empty; infoSuffixPrefix.Extra2 = string.Empty; infoSuffixPrefix.SuffixprefixId = decSuffixPrefixId; if (spSuffixPrefix.SuffixPrefixCheckExistenceForAdd(txtFromDate.Text.ToString(), txtToDate.Text.ToString(), Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), decSuffixPrefixId) == false) { if (spSuffixPrefix.SuffixPrefixSettingsEdit(infoSuffixPrefix)) { Messages.UpdatedMessage(); Clear(); } else { Messages.ReferenceExistsMessageForUpdate(); cmbVoucherType.Focus(); } } else { Messages.InformationMessage("Voucher type already exist for dates"); cmbVoucherType.Focus(); } } catch (Exception ex) { MessageBox.Show("SPS5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }