/// <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); } }
/// <summary> /// grid fill function /// </summary> public void GridFill() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); DataTable dtbl = new DataTable(); dtbl = spSuffixPrefix.VoucherTypeSearchInSuffixPrefix(cmbVoucherTypeSearch.Text); dgvSuffixPrefixSettings.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("SPS3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// grid double click fill the items in controll for edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSuffixPrefixSettings_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffixPrefix.SuffixPrefixView(Convert.ToDecimal(dgvSuffixPrefixSettings.Rows[e.RowIndex].Cells["dgvtxtSuffixPrefixId"].Value.ToString())); decSuffixPrefixId = Convert.ToDecimal(dgvSuffixPrefixSettings.Rows[e.RowIndex].Cells["dgvtxtSuffixPrefixId"].Value.ToString()); txtFromDate.Text = infoSuffixPrefix.FromDate.ToString("dd-MMM-yyyy"); txtToDate.Text = infoSuffixPrefix.ToDate.ToString("dd-MMM-yyyy"); cmbVoucherType.SelectedValue = infoSuffixPrefix.VoucherTypeId.ToString(); txtStartIndex.Text = infoSuffixPrefix.StartIndex.ToString(); txtStartIndex.Enabled = false; txtSufix.Text = infoSuffixPrefix.Suffix; txtPrefix.Text = infoSuffixPrefix.Prefix; if (infoSuffixPrefix.PrefillWithZero == true) { cbxPrefillWithZero.Checked = true; txtWidthofNumericalPart.Text = infoSuffixPrefix.WidthOfNumericalPart.ToString(); } else { cbxPrefillWithZero.Checked = false; txtWidthofNumericalPart.Text = infoSuffixPrefix.WidthOfNumericalPart.ToString(); } txtNarration.Text = infoSuffixPrefix.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; txtFromDate.Focus(); txtWidthofNumericalPart.Enabled = true; if (cbxPrefillWithZero.Checked == true) { txtWidthofNumericalPart.Enabled = true; } else { txtWidthofNumericalPart.Enabled = false; } } } catch (Exception ex) { MessageBox.Show("SPS20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// vouchertype conbofill function /// </summary> public void VoucherTypeComboFill() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); DataTable dtbl = new DataTable(); dtbl = spSuffixPrefix.VoucherTypeViewAllInSuffixPrefix(); cmbVoucherType.DataSource = dtbl; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("SPS1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// delete function /// </summary> public void DeleteFunction() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); if (spSuffixPrefix.SuffixPrefixSettingsDeleting(decSuffixPrefixId) == -1) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("SPS7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// voucherType combofill for search function /// </summary> public void VoucherTypeComboFillSearch() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); DataTable dtbl = new DataTable(); dtbl = spSuffixPrefix.VoucherTypeViewAllInSuffixPrefix(); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVoucherTypeSearch.DataSource = dtbl; cmbVoucherTypeSearch.ValueMember = "voucherTypeId"; cmbVoucherTypeSearch.DisplayMember = "voucherTypeName"; cmbVoucherTypeSearch.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("SPS2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }