コード例 #1
0
 /// <summary>
 /// Function to fill ModelNo combobox
 /// </summary>
 public void ModelNoComboFill()
 {
     try
     {
         List<DataTable> listObj = new List<DataTable>();
         ModelNoBll BllModelNo = new ModelNoBll();
         listObj = BllModelNo.ModelNoViewAll();
         DataRow dr = listObj[0].NewRow();
         dr["modelno"] = "All";
         dr["modelNoId"] = 0;
         listObj[0].Rows.InsertAt(dr, 0);
         cmbModelNo.DataSource = listObj[0];
         cmbModelNo.DisplayMember = "modelNo";
         cmbModelNo.ValueMember = "modelNoId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("ST:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void Gridfill()
 {
     try
     {
         List<DataTable> listModelNo = new List<DataTable>();
         ModelNoBll BllModelNo = new ModelNoBll();
         listModelNo = BllModelNo.ModelNoOnlyViewAll();
         dgvModalNo.DataSource = listModelNo[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ModelNoBll BllModelNo = new ModelNoBll();
         ModelNoInfo infoModelNo = new ModelNoInfo();
         infoModelNo.ModelNo = txtModalNo.Text.Trim();
         infoModelNo.Narration = txtNarration.Text.Trim();
         infoModelNo.Extra1 = string.Empty;
         infoModelNo.Extra2 = string.Empty;
         if (BllModelNo.ModelCheckIfExist(txtModalNo.Text.Trim().ToString(), 0) == false)
         {
             decIdForOtherForms = BllModelNo.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);
     }
 }
コード例 #4
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         ModelNoInfo infoModelNo = new ModelNoInfo();
         ModelNoBll BllModelNo = new ModelNoBll();
         infoModelNo = BllModelNo.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);
     }
 }
コード例 #5
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         ModelNoBll BllModelNo = new ModelNoBll();
         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 (BllModelNo.ModelCheckIfExist(txtModalNo.Text.Trim(), decModelNo) == false)
             {
                 if (BllModelNo.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
         {
             BllModelNo.ModelNoEditParticularFeilds(infoModelNo);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MN4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
 /// <summary>
 /// Function to delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ModelNoBll BllModelNo = new ModelNoBll();
         if (BllModelNo.ModelNoCheckReferenceAndDelete(decModelNo) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             BllModelNo.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);
     }
 }
コード例 #7
0
 //-------------------------------------------------------------ModelNoComboFill---------------------------
 public void ModelNoComboFill()
 {
     try
     {
         List<DataTable> listObj = new List<DataTable>();
         ModelNoBll BllModelNo = new ModelNoBll();
         listObj = BllModelNo.ModelNoViewAll();
         cmbModalNo.DataSource = listObj[0];
         cmbModalNo.DisplayMember = "modelNo";
         cmbModalNo.ValueMember = "modelNoId";
         cmbModalNo.SelectedValue = 1;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC:44" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #8
0
 /// <summary>
 /// Function to fill ModelNo combobox
 /// </summary>
 public void ModelComboFill()
 {
     try
     {
         ModelNoBll BllModelNo = new ModelNoBll();
         dtblModelNo = BllModelNo.ModelNoViewAll();
         dgvcmbModel.DataSource = dtblModelNo[0];
         dgvcmbModel.ValueMember = "modelNoId";
         dgvcmbModel.DisplayMember = "modelNo";
         SettingsBll BllSettings = new SettingsBll();
         if (BllSettings.SettingsStatusCheck("ShowModelNo") == "Yes")
         {
             dgvcmbModel.ReadOnly = false;
         }
         else
         {
             dgvcmbModel.ReadOnly = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MPC7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }