コード例 #1
0
ファイル: frmModalNo.cs プロジェクト: hnjm/OneAccount
 /// <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)
     {
         formMDI.infoError.ErrorString = "MN3" + ex.Message;
     }
 }
コード例 #2
0
ファイル: frmModalNo.cs プロジェクト: hnjm/OneAccount
 /// <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)
     {
         formMDI.infoError.ErrorString = "MN2" + ex.Message;
     }
 }
コード例 #3
0
ファイル: frmModalNo.cs プロジェクト: hnjm/OneAccount
 /// <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)
     {
         formMDI.infoError.ErrorString = "MN4" + ex.Message;
     }
 }
コード例 #4
0
ファイル: frmModalNo.cs プロジェクト: hnjm/OneAccount
 /// <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)
     {
         formMDI.infoError.ErrorString = "MN8" + ex.Message;
     }
 }
コード例 #5
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)
     {
         formMDI.infoError.ErrorString = "PSP4:" + ex.Message;
     }
 }
コード例 #6
0
ファイル: frmModalNo.cs プロジェクト: hnjm/OneAccount
 /// <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)
     {
         formMDI.infoError.ErrorString = "MN6" + ex.Message;
     }
 }