예제 #1
0
 /// <summary>
 /// On 'Print' button click to print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvPayHead.RowCount > 0)
         {
             DataSet          ds         = new DataSet();
             PayHeadBll       BllPayHead = new PayHeadBll();
             List <DataTable> listObj    = BllPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text);
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List <DataTable>   listObjCompany     = bllCompanyCreation.CompanyViewDataTable(1);
             frmReport          frmreport          = new frmReport();
             frmreport.MdiParent = formMDI.MDIObj;
             ds.Tables.Add(listObj[0]);
             ds.Tables.Add(listObjCompany[0]);
             frmreport.PayHeadReport(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PHR:7 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PayHeadBll  BllPayHead  = new PayHeadBll();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadId   = decPayHeadId;
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.Text;
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         if (BllPayHead.PayheadCheckExistence(txtPayheadName.Text.Trim(), infoPayhead.PayHeadId) == false)
         {
             BllPayHead.PayHeadEdit(infoPayhead);
             GridFill();
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Payhead name already exist");
             txtPayheadName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PayHeadBll  BllPayHead  = new PayHeadBll();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.SelectedItem.ToString();
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         infoPayhead.ExtraDate   = DateTime.Parse(DateTime.Now.ToString());
         infoPayhead.Extra1      = string.Empty;
         infoPayhead.Extra2      = string.Empty;
         if (btnPayheadSave.Text == "Save")
         {
             if (BllPayHead.PayheadCheckExistence(txtPayheadName.Text.Trim(), 0) == false)
             {
                 Messages.SavedMessage();
                 BllPayHead.PayHeadAdd(infoPayhead);
                 GridFill();
                 Clear();
             }
             else
             {
                 Messages.InformationMessage("Payhead name already exist");
                 txtPayheadName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Fills controls for updation on cell double click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvPayhead_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             PayHeadInfo infoPayhead = new PayHeadInfo();
             PayHeadBll  BllPayHead  = new PayHeadBll();
             infoPayhead              = BllPayHead.PayHeadView(Convert.ToDecimal(dgvPayhead.CurrentRow.Cells["dgvtxtPayheadId"].Value.ToString()));
             txtPayheadName.Text      = infoPayhead.PayHeadName;
             cmbPayheadType.Text      = infoPayhead.Type;
             strPayheadType           = cmbPayheadType.Text;
             txtPayheadNarration.Text = infoPayhead.Narration;
             btnPayheadSave.Text      = "Update";
             btnPayheadDelete.Enabled = true;
             strPayHeadName           = infoPayhead.PayHeadName;
             decPayHeadId             = Convert.ToDecimal(dgvPayhead.CurrentRow.Cells["dgvtxtPayheadId"].Value.ToString());
             if (BllPayHead.payheadTypeCheckeferences(infoPayhead.PayHeadId, txtPayheadName.Text, cmbPayheadType.Text, txtPayheadNarration.Text))
             {
                 if (e.RowIndex != -1)
                 {
                     cmbPayheadType.Enabled = true;
                 }
             }
             else
             {
                 cmbPayheadType.Enabled = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #5
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         PayHeadBll       BllPayHead = new PayHeadBll();
         List <DataTable> listObj    = BllPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text);
         dgvPayHead.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("PHR:2 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         PayHeadBll       BllPayHead  = new PayHeadBll();
         List <DataTable> listPayhead = new List <DataTable>();
         listPayhead           = BllPayHead.PayHeadSearch(txtPayheadSearch.Text.Trim());
         dgvPayhead.DataSource = listPayhead[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #7
0
 /// <summary>
 /// Function to fill PayHead combobox
 /// </summary>
 public void PayHeadComboFill()
 {
     try
     {
         PayHeadBll       BllPayHead  = new PayHeadBll();
         List <DataTable> listPayHead = BllPayHead.PayHeadViewAll();
         DataRow          dr          = listPayHead[0].NewRow();
         dr[2] = "All";
         listPayHead[0].Rows.InsertAt(dr, 0);
         cmbPayHead.DataSource    = listPayHead[0];
         cmbPayHead.ValueMember   = "payHeadId";
         cmbPayHead.DisplayMember = "payHeadName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PHR:1 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         PayHeadInfo infoPayhead = new PayHeadInfo();
         PayHeadBll  BllPayHead  = new PayHeadBll();
         if (BllPayHead.PayHeadDeleteVoucherTypeCheckReference(decPayHeadId))
         {
             Messages.ReferenceExistsMessage();
             txtPayheadName.Focus();
         }
         else
         {
             Messages.DeletedMessage();
             Clear();
         }
         GridFill();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }