コード例 #1
0
 /// <summary>
 /// On doubleclicking on the grid, It displays the details to edit or delete a rack
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvRack_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             if (dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackName"].Value.ToString() != "NA")
             {
                 RackSP   spRack   = new RackSP();
                 RackInfo infoRack = new RackInfo();
                 decRackId               = Convert.ToDecimal(dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackId"].Value.ToString());
                 infoRack                = spRack.RackView(decRackId);
                 txtRackName.Text        = infoRack.RackName;
                 cmbGodown.SelectedValue = infoRack.GodownId.ToString();
                 txtNarration.Text       = infoRack.Narration;
                 btnSave.Text            = "Update";
                 btnDelete.Enabled       = true;
                 strRackName             = infoRack.RackName;
                 txtRackName.Focus();
             }
             else
             {
                 Messages.InformationMessage("Default Rack cannot update or delete");
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
 /// <summary>
 /// Function to save new rack
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo rackInfo = new RackInfo();
         rackInfo.RackName  = txtRackName.Text.Trim();
         rackInfo.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         rackInfo.Narration = txtNarration.Text.Trim();
         rackInfo.ExtraDate = DateTime.Now;
         rackInfo.Extra1    = string.Empty;
         rackInfo.Extra2    = string.Empty;
         decimal decGodounId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         if (spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false)
         {
             decIdForOtherForms = spRack.RackAdd(rackInfo);
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage(" Rack name already exist");
             txtRackName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #3
0
 /// <summary>
 /// Function to fill all rack in datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         RackSP    spRack   = new RackSP();
         DataTable dtblRack = new DataTable();
         dtblRack           = spRack.RackSearch(txtRackNameSearch.Text.Trim(), cmbGodownSearch.Text.ToString());
         dgvRack.DataSource = dtblRack;
     }
     catch (Exception ex)
     {
         MessageBox.Show("R5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #4
0
 /// <summary>
 /// Function to edit the existing rack
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo rackInfo = new RackInfo();
         rackInfo.RackName  = txtRackName.Text.Trim();
         rackInfo.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         rackInfo.Narration = txtNarration.Text.Trim();
         rackInfo.ExtraDate = DateTime.Now;
         rackInfo.Extra1    = string.Empty;
         rackInfo.Extra2    = string.Empty;
         rackInfo.RackId    = decRackId;
         if (txtRackName.Text != strRackName)
         {
             if (CheckExistenceOfRackName() == false)
             {
                 if (spRack.RackEdit(rackInfo))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
             }
             else
             {
                 Messages.InformationMessage("Already exists");
                 txtRackName.Focus();
             }
         }
         else if (rackInfo.RackId == 1)
         {
             Messages.InformationMessage("Cannot update");
             Clear();
             txtRackName.Focus();
         }
         else
         {
             if (spRack.RackEdit(rackInfo))
             {
                 Messages.UpdatedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #5
0
 /// <summary>
 /// Function to Rack Godown Combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             dtbl = spRack.RackFillForStock(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
             cmbRack.DataSource    = dtbl;
             cmbRack.DisplayMember = "rackName";
             cmbRack.ValueMember   = "rackId";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:09" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
 /// <summary>
 /// Function to Save Rack
 /// </summary>
 public void RackAddCurrespondingtoGodown()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo infoRack = new RackInfo();
         infoRack.RackName  = "NA";
         infoRack.GodownId  = decIdForOtherForms;
         infoRack.Narration = string.Empty;
         infoRack.Extra1    = string.Empty;
         infoRack.Extra2    = string.Empty;
         infoRack.ExtraDate = DateTime.Now;
         spRack.RackAdd(infoRack);
     }
     catch (Exception ex)
     {
         MessageBox.Show("G3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #7
0
 /// <summary>
 /// Function to fill rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         dtbl = spRack.RackViewAll();
         DataRow dr = dtbl.NewRow();
         dr["rackName"] = "All";
         dr["rackId"]   = 0;
         dtbl.Rows.InsertAt(dr, 0);
         cmbRack.DataSource    = dtbl;
         cmbRack.DisplayMember = "rackName";
         cmbRack.ValueMember   = "rackId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #8
0
 /// <summary>
 /// Function to delete a Rack
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         RackSP spRack = new RackSP();
         if (spRack.RackDeleteReference(decRackId) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
             GridFill();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #9
0
        /// <summary>
        /// Function to check rack name alredy exist or not
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfRackName()
        {
            bool isExist = false;

            try
            {
                RackSP spRack = new RackSP();
                isExist = spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
                if (isExist)
                {
                    string strRackNames = txtRackName.Text.Trim();
                    if (strRackNames.ToLower() == strRackName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("R6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isExist);
        }