Exemple #1
0
 /// <summary>
 /// Function to Update the items
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RoleInfo infoRole = new RoleInfo();
         RoleSP   spRole   = new RoleSP();
         infoRole.RoleId    = Convert.ToDecimal(dgvRole.CurrentRow.Cells["dgvtxtRoleId"].Value);
         infoRole.Role      = txtRole.Text.Trim();
         infoRole.Narration = txtNarration.Text.Trim();
         infoRole.Extra1    = string.Empty;
         infoRole.Extra2    = string.Empty;
         string strRole = txtRole.Text.Trim();
         if (spRole.RoleCheckExistence(decRoleId, strRole) == false)
         {
             spRole.RoleEdit(infoRole);
             Messages.UpdatedMessage();
             ClearFunction();
         }
         else
         {
             Messages.InformationMessage("Role already exists");
             txtRole.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RL:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #2
0
 /// <summary>
 /// Save function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RoleInfo infoRole = new RoleInfo();
         RoleSP   spRole   = new RoleSP();
         infoRole.Role      = txtRole.Text.Trim();
         infoRole.Narration = txtNarration.Text.Trim();
         infoRole.Extra1    = string.Empty;
         infoRole.Extra2    = string.Empty;
         string strRole = txtRole.Text.Trim();
         if (spRole.RoleCheckExistence(decRoleId, strRole) == false)
         {
             decRoleId = spRole.RoleAdd(infoRole);
             Messages.SavedMessage();
             ClearFunction();
         }
         else
         {
             Messages.InformationMessage("Role already exists");
             txtRole.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RL:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #3
0
 /// <summary>
 /// Function to fill the grid
 /// </summary>
 public void Gridfill()
 {
     try
     {
         DataTable dtbl   = new DataTable();
         RoleSP    spRole = new RoleSP();
         dtbl = spRole.RoleViewGridFill();
         dgvRole.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RL:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #4
0
 /// <summary>
 /// Function to fill the Controls for updation
 /// </summary>
 public void FillControls()
 {
     try
     {
         RoleInfo infoRole = new RoleInfo();
         RoleSP   spRole   = new RoleSP();
         infoRole          = spRole.RoleView(decRoleId);
         txtRole.Text      = infoRole.Role;
         txtNarration.Text = infoRole.Narration;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RL:6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #5
0
 /// <summary>
 /// Function to fill the Role ComboFill
 /// </summary>
 public void RoleComboFill()
 {
     try
     {
         RoleSP    spRole        = new RoleSP();
         DataTable dtblRoleCombo = new DataTable();
         dtblRoleCombo         = spRole.RoleViewAll();
         cmbRole.DataSource    = dtblRoleCombo;
         cmbRole.ValueMember   = "roleId";
         cmbRole.DisplayMember = "role";
         cmbRole.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #6
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 RoleInfo infoRole = new RoleInfo();
                 RoleSP   spRole   = new RoleSP();
                 if ((spRole.RoleReferenceDelete(decRoleId) == -1))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     btnSave.Text      = "Save";
                     btnDelete.Enabled = false;
                     ClearFunction();
                 }
             }
         }
         else
         {
             RoleInfo infoRole = new RoleInfo();
             RoleSP   spRole   = new RoleSP();
             if (spRole.RoleReferenceDelete(decRoleId) == -1)
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 ClearFunction();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("RL:7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #7
0
 /// <summary>
 /// Function to the search Role Combo box
 /// </summary>
 public void SearchRoleComboFill()
 {
     try
     {
         RoleSP    spRole = new RoleSP();
         DataTable dtblSearchRoleCombo = new DataTable();
         dtblSearchRoleCombo = spRole.RoleViewAll();
         DataRow dr = dtblSearchRoleCombo.NewRow();
         dr[1] = "All";
         dtblSearchRoleCombo.Rows.InsertAt(dr, 0);
         cmbSearchRole.DataSource    = dtblSearchRoleCombo;
         cmbSearchRole.ValueMember   = "roleId";
         cmbSearchRole.DisplayMember = "role";
     }
     catch (Exception ex)
     {
         MessageBox.Show("UC:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }