/// <summary> /// Function to fill Datagridview on Search /// </summary> private void Search() { try { DesignationSP spDesignation = new DesignationSP(); dgvDesignation.DataSource = spDesignation.DesignationSearch(txtSearch.Text); } catch (Exception ex) { MessageBox.Show("D5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> private void GridFill() { try { DesignationSP spDesignation = new DesignationSP(); dgvDesignation.DataSource = spDesignation.DesignationViewForGridFill(); } catch (Exception ex) { MessageBox.Show("D3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to check existence of Designation /// </summary> /// <param name="strDesignation"></param> /// <param name="decDesignationId"></param> /// <returns></returns> public bool CheckExistanceOfDesignation(string strDesignation, decimal decDesignationId) { try { bool isExist = false; DesignationSP spDesignation = new DesignationSP(); isExist = spDesignation.DesignationCheckExistanceOfName(strDesignation, decDesignationId); return(isExist); } catch (Exception ex) { MessageBox.Show("D7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(false); }
/// <summary> /// Function for save /// </summary> private void SaveFunction() { try { DesignationInfo infoDesignation = new DesignationInfo(); DesignationSP spDesignation = new DesignationSP(); if (txtAdvanceAmount.Text == string.Empty) { infoDesignation.AdvanceAmount = 0; } else { infoDesignation.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text.Trim()); } infoDesignation.DesignationName = txtDesignationName.Text.Trim(); if (txtCLInMonth.Text == string.Empty) { infoDesignation.LeaveDays = 0; } else { infoDesignation.LeaveDays = Convert.ToDecimal(txtCLInMonth.Text.Trim()); } decimal decD = infoDesignation.LeaveDays; infoDesignation.Narration = txtNarration.Text.Trim(); infoDesignation.Extra1 = string.Empty; infoDesignation.Extra2 = string.Empty; infoDesignation.ExtraDate = DateTime.Now; if (CheckExistanceOfDesignation(txtDesignationName.Text.Trim(), 0) == false) { decIdentity = spDesignation.DesignationAddWithReturnIdentity(infoDesignation); if (decIdentity > 0) { Messages.SavedMessage(); } } else { Messages.InformationMessage("Designation already exist"); } } catch (Exception ex) { MessageBox.Show("D8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for Delete /// </summary> private void Delete() { try { if (PublicVariables.isMessageDelete) { if (Messages.DeleteMessage() == true) { bool isDeleteStatus = false; DesignationSP spDestination = new DesignationSP(); isDeleteStatus = spDestination.DesignationDelete(decDesignationId); if (isDeleteStatus == true) { Messages.DeletedMessage(); Clear(); GridFill(); } else { Messages.ReferenceExistsMessage(); } } } else { bool isDeleteStatus = false; DesignationSP spDestination = new DesignationSP(); isDeleteStatus = spDestination.DesignationDelete(decDesignationId); if (isDeleteStatus == true) { Messages.DeletedMessage(); Clear(); GridFill(); } else { Messages.ReferenceExistsMessage(); } } } catch (Exception ex) { MessageBox.Show("D2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for Edit /// </summary> private void EditFunction() { try { DesignationInfo infoDesignation = new DesignationInfo(); DesignationSP spDesignation = new DesignationSP(); if (txtAdvanceAmount.Text == string.Empty) { infoDesignation.AdvanceAmount = 0; } else { infoDesignation.AdvanceAmount = Convert.ToDecimal(txtAdvanceAmount.Text.Trim()); } infoDesignation.DesignationName = txtDesignationName.Text.TrimEnd(); if (txtCLInMonth.Text == string.Empty) { infoDesignation.LeaveDays = 0; } else { infoDesignation.LeaveDays = Convert.ToDecimal(txtCLInMonth.Text.Trim()); } infoDesignation.Narration = txtNarration.Text.Trim(); infoDesignation.Extra1 = string.Empty; infoDesignation.Extra2 = string.Empty; infoDesignation.ExtraDate = DateTime.Now; if (CheckExistanceOfDesignation(txtDesignationName.Text.Trim(), decDesignationId) == false) { infoDesignation.DesignationId = decDesignationId; if (spDesignation.DesignationEdit(infoDesignation)) { Messages.UpdatedMessage(); } } else { Messages.InformationMessage("Designation already exist"); } } catch (Exception ex) { MessageBox.Show("D9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Designation combobox /// </summary> public void DesignationComboFill() { try { DesignationSP spDesigantion = new DesignationSP(); DataTable dtbl = spDesigantion.DesignationViewAll(); DataRow dr = dtbl.NewRow(); dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbDesignation.DataSource = dtbl; cmbDesignation.ValueMember = "designationId"; cmbDesignation.DisplayMember = "designationName"; } catch (Exception ex) { MessageBox.Show("DSR3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill controls fpor update /// </summary> private void FillControls() { try { DesignationInfo infoDesignaion = new DesignationInfo(); DesignationSP spDesignation = new DesignationSP(); infoDesignaion = spDesignation.DesignationView(decDesignationId); txtDesignationName.Text = infoDesignaion.DesignationName; txtCLInMonth.Text = infoDesignaion.LeaveDays.ToString(); txtAdvanceAmount.Text = infoDesignaion.AdvanceAmount.ToString(); txtNarration.Text = infoDesignaion.Narration; btnSave.Text = "Update"; } catch (Exception ex) { MessageBox.Show("D6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Designation combobox /// </summary> public void DesignationComboFill() { try { DesignationSP SpDesignation = new DesignationSP(); DataTable dtblDesignation = new DataTable(); dtblDesignation = SpDesignation.DesignationViewAll(); cmbDesignation.DataSource = dtblDesignation; if (dtblDesignation.Rows.Count > 0) { cmbDesignation.ValueMember = "designationId"; cmbDesignation.DisplayMember = "designationName"; DataRow drRow = dtblDesignation.NewRow(); drRow["designationId"] = "0"; drRow["designationName"] = "All"; dtblDesignation.Rows.InsertAt(drRow, 0); cmbDesignation.SelectedValue = "0"; } } catch (Exception ex) { MessageBox.Show("ER2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }