Ejemplo n.º 1
0
        /// <summary>
        /// Function to fill area datagridview
        /// </summary>
        public void AreaGridfill()
        {
            AreaBll BllArea = new AreaBll();
            try
            {
                List<DataTable> listObj = new List<DataTable>();

                listObj = BllArea.AreaOnlyViewAll();
                dgvArea.DataSource = listObj[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("AR1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to fill Area combobox
 /// </summary>
 public void AreaForComboFill()
 {
     try
     {
         AreaBll BllArea = new AreaBll();
         List<DataTable> dtbl = BllArea.AreaViewFOrCombofill();
         cmbArea.DataSource = dtbl[0];
         cmbArea.DisplayMember = "areaName";
         cmbArea.ValueMember = "areaId";
         cmbArea.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// area grid cell double click for update
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvArea_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {

                    string strArea = dgvArea.CurrentRow.Cells["dgvtxtarea"].Value.ToString();
                    if (strArea != "NA")
                    {
                        AreaInfo infoArea = new AreaInfo();
                        AreaBll BllArea = new AreaBll();
                        infoArea = BllArea.AreaFill(Convert.ToDecimal(dgvArea.CurrentRow.Cells[1].Value.ToString()));
                        txtAreaName.Text = infoArea.AreaName;
                        txtNarration.Text = infoArea.Narration;
                        btnSave.Text = "Update";
                        btnDelete.Enabled = true;
                        txtAreaName.Focus();
                        decAreaId = Convert.ToDecimal(dgvArea.CurrentRow.Cells[1].Value.ToString());
                    }
                    else
                    {
                        Messages.WarningMessage("NA Area cannot update or delete");
                        Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AR16" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Checking the invalid entries fro save or update
 /// </summary>
 public void SaveOrEdit()
 {
     try
     {
         if (txtAreaName.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter area name");
             txtAreaName.Focus();
         }
         else
         {
             AreaInfo infoArea = new AreaInfo();
             AreaBll BllArea = new AreaBll();
             infoArea.AreaName = txtAreaName.Text.Trim();
             infoArea.Narration = txtNarration.Text.Trim();
             infoArea.Extra1 = string.Empty;
             infoArea.Extra2 = string.Empty;
             infoArea.AreaId = decAreaId;
             if (btnSave.Text == "Save")
             {
                 if (Messages.SaveConfirmation())
                 {
                     if (BllArea.AreaNameCheckExistence(txtAreaName.Text.Trim(), 0) == false)
                     {
                         decAreaId = BllArea.AreaAddWithIdentity(infoArea);
                         AreaGridfill();
                         Messages.SavedMessage();
                         Clear();
                         decIdForOtherForms = decAreaId;
                         if (frmRouteObj != null)
                         {
                             this.Close();
                         }
                         if (frmCustomerobj != null)
                         {
                             this.Close();
                         }
                         if (frmSupplierobj != null)
                         {
                             this.Close();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Area name already exist");
                         txtAreaName.Focus();
                     }
                 }
             }
             else
             {
                 if (Messages.UpdateConfirmation())
                 {
                     if (BllArea.AreaNameCheckExistence(txtAreaName.Text.Trim(), decAreaId) == false)
                     {
                         infoArea.AreaId = decAreaId;
                         if (BllArea.AreaUpdate(infoArea))
                         {
                             AreaGridfill();
                             Messages.UpdatedMessage();
                             Clear();
                         }
                     }
                     else
                     {
                         Messages.InformationMessage("Area name already exist");
                         txtAreaName.Focus();
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// delete function
 /// </summary>
 public void Delete()
 {
     try
     {
         if (Messages.DeleteConfirmation())
         {
             AreaBll BllArea = new AreaBll();
             if (BllArea.AreaDeleteReference(decAreaId) <= 0)
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("AR4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 ///Function to fill area combobox
 /// </summary> 
 public void AreaComboFill()
 {
     try
     {
         AreaBll BllArea = new AreaBll();
         List<DataTable> listObj = new List<DataTable>();
         listObj = BllArea.AreaViewAll();
         //cmbArea.DataSource = null;
         cmbArea.DataSource = listObj[0];
         cmbArea.ValueMember = "areaId";
         cmbArea.DisplayMember = "areaName";
         cmbArea.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }