Esempio n. 1
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ModelNoSP   spModelNo   = new ModelNoSP();
         ModelNoInfo infoModelNo = new ModelNoInfo();
         infoModelNo.ModelNo   = txtModalNo.Text.Trim();
         infoModelNo.Narration = txtNarration.Text.Trim();
         infoModelNo.Extra1    = string.Empty;
         infoModelNo.Extra2    = string.Empty;
         if (spModelNo.ModelCheckIfExist(txtModalNo.Text.Trim().ToString(), 0) == false)
         {
             decIdForOtherForms = spModelNo.ModelNoAddWithDifferentModelNo(infoModelNo);
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Model number already exist");
             txtModalNo.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void Gridfill()
 {
     try
     {
         DataTable dtblModelNo = new DataTable();
         ModelNoSP spModelNo   = new ModelNoSP();
         dtblModelNo           = spModelNo.ModelNoOnlyViewAll();
         dgvModalNo.DataSource = dtblModelNo;
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         ModelNoSP   spModelNo   = new ModelNoSP();
         ModelNoInfo infoModelNo = new ModelNoInfo();
         infoModelNo.ModelNo   = txtModalNo.Text.Trim();
         infoModelNo.Narration = txtNarration.Text.Trim();
         infoModelNo.Extra1    = string.Empty;
         infoModelNo.Extra2    = string.Empty;
         infoModelNo.ModelNoId = Convert.ToDecimal(dgvModalNo.CurrentRow.Cells[1].Value.ToString());
         if (txtModalNo.Text != strModelNo)
         {
             if (spModelNo.ModelCheckIfExist(txtModalNo.Text.Trim(), decModelNo) == false)
             {
                 if (spModelNo.ModelNoEditParticularFeilds(infoModelNo))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
                 else if (infoModelNo.ModelNoId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtModalNo.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Model number already exist");
                 txtModalNo.Focus();
             }
         }
         else
         {
             spModelNo.ModelNoEditParticularFeilds(infoModelNo);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Function to fill the ModelNo combobox
 /// </summary>
 public void ModelComboFill()
 {
     try
     {
         ModelNoSP spModelNo   = new ModelNoSP();
         DataTable dtblModelNo = new DataTable();
         dtblModelNo = spModelNo.ModelNoViewAll();
         DataRow dr = dtblModelNo.NewRow();
         dr[1] = "All";
         dtblModelNo.Rows.InsertAt(dr, 0);
         cmbModelNo.DataSource    = dtblModelNo;
         cmbModelNo.ValueMember   = "modelNoId";
         cmbModelNo.DisplayMember = "modelNo";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PSP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ModelNoInfo infoModelNo = new ModelNoInfo();
         ModelNoSP   spModelNo   = new ModelNoSP();
         infoModelNo       = spModelNo.ModelNoWithNarrationView(Convert.ToDecimal(dgvModalNo.CurrentRow.Cells[1].Value.ToString()));
         txtModalNo.Text   = infoModelNo.ModelNo;
         txtNarration.Text = infoModelNo.Narration;
         btnSave.Text      = "Update";
         btnDelete.Enabled = true;
         decModelNo        = infoModelNo.ModelNoId;
         strModelNo        = infoModelNo.ModelNo;
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Function to delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ModelNoSP spModelNo = new ModelNoSP();
         if (spModelNo.ModelNoCheckReferenceAndDelete(decModelNo) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             spModelNo.ModelNoDelete(Convert.ToDecimal(dgvModalNo.CurrentRow.Cells[1].Value.ToString()));
             Clear();
             Messages.DeletedMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }