Exemple #1
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         GodownInfo infoGodown = new GodownInfo();
         GodownSP   spGodown   = new GodownSP();
         infoGodown.GodownName = txtGodownName.Text.Trim();
         infoGodown.Narration  = txtNarration.Text.Trim();
         infoGodown.Extra1     = string.Empty;
         infoGodown.Extra2     = string.Empty;
         if (spGodown.GodownCheckIfExist(txtGodownName.Text.Trim(), 0) == false)
         {
             decIdForOtherForms = spGodown.GodownAddWithoutSameName(infoGodown);
             RackAddCurrespondingtoGodown();
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage("Godown name already exist");
             txtGodownName.Focus();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G4:" + ex.Message;
     }
 }
Exemple #2
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void Gridfill()
 {
     try
     {
         DataTable dtblGodown = new DataTable();
         GodownSP  spGodown   = new GodownSP();
         dtblGodown           = spGodown.GodownOnlyViewAll();
         dgvGodown.DataSource = dtblGodown;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G7:" + ex.Message;
     }
 }
Exemple #3
0
 /// <summary>
 /// Function to fill cmbGodown
 /// </summary>
 public void FillGodownCombo()
 {
     try
     {
         GodownSP  spGodown   = new GodownSP();
         DataTable dtblGodown = new DataTable();
         dtblGodown              = spGodown.GodownViewAll();
         cmbGodown.DataSource    = dtblGodown;
         cmbGodown.ValueMember   = "godownId";
         cmbGodown.DisplayMember = "godownName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "R1:" + ex.Message;
     }
 }
Exemple #4
0
 /// <summary>
 /// Function to fill cmbGodownSearch
 /// </summary>
 public void FillSearchCombo()
 {
     try
     {
         GodownSP  spGodown   = new GodownSP();
         DataTable dtblGodown = new DataTable();
         dtblGodown = spGodown.GodownViewAll();
         cmbGodownSearch.DataSource = dtblGodown;
         DataRow dr = dtblGodown.NewRow();
         dr[1] = "All";
         dtblGodown.Rows.InsertAt(dr, 0);
         cmbGodownSearch.ValueMember   = "godownId";
         cmbGodownSearch.DisplayMember = "godownName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "R2:" + ex.Message;
     }
 }
Exemple #5
0
 /// <summary>
 /// Function to fill controls for update
 /// </summary>
 public void FillControls()
 {
     try
     {
         GodownInfo infoGodown = new GodownInfo();
         GodownSP   spGodown   = new GodownSP();
         infoGodown         = spGodown.GodownWithNarrationView(Convert.ToDecimal(dgvGodown.CurrentRow.Cells[1].Value.ToString()));
         txtGodownName.Text = infoGodown.GodownName;
         txtNarration.Text  = infoGodown.Narration;
         btnSave.Text       = "Update";
         btnDelete.Enabled  = true;
         decGodownId        = infoGodown.GodownId;
         strGodownName      = infoGodown.GodownName;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G11:" + ex.Message;
     }
 }
Exemple #6
0
 /// <summary>
 /// Function to fill Godown combobox
 /// </summary>
 public void GodownComboFill()
 {
     try
     {
         DataTable dtbl     = new DataTable();
         GodownSP  spGodown = new GodownSP();
         dtbl = spGodown.GodownViewAll();
         DataRow dr = dtbl.NewRow();
         dr["godownName"] = "All";
         dr["godownId"]   = 0;
         dtbl.Rows.InsertAt(dr, 0);
         cmbGodown.DataSource    = dtbl;
         cmbGodown.DisplayMember = "godownName";
         cmbGodown.ValueMember   = "godownId";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "ST:5" + ex.Message;
     }
 }
Exemple #7
0
 /// <summary>
 /// Function to Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         GodownInfo infoGodown = new GodownInfo();
         GodownSP   spGodown   = new GodownSP();
         infoGodown.GodownName = txtGodownName.Text.Trim();
         infoGodown.Narration  = txtNarration.Text.Trim();
         infoGodown.Extra1     = string.Empty;
         infoGodown.Extra2     = string.Empty;
         infoGodown.GodownId   = Convert.ToDecimal(dgvGodown.CurrentRow.Cells["dgvtxtGodownId"].Value.ToString());
         if (txtGodownName.Text != strGodownName)
         {
             if (spGodown.GodownCheckIfExist(txtGodownName.Text.Trim(), decGodownId) == false)
             {
                 if (spGodown.GodownEditParticularField(infoGodown))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
             }
             else
             {
                 Messages.InformationMessage("Godown name already exist");
                 txtGodownName.Focus();
             }
         }
         else
         {
             spGodown.GodownEditParticularField(infoGodown);
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G5:" + ex.Message;
     }
 }
Exemple #8
0
 /// <summary>
 /// Function to delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         GodownSP spGodown = new GodownSP();
         if (spGodown.GodownCheckReferenceAndDelete(decGodownId) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             // spGodown.GodownDelete(Convert.ToDecimal(dgvGodown.CurrentRow.Cells[1].Value.ToString()));
             //spGodown.GodownDelete(Convert.ToDecimal(dgvGodown.CurrentRow.Cells["dgvtxtGodownId"].Value.ToString()));
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "G8:" + ex.Message;
     }
 }