Пример #1
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)
     {
         formMDI.infoError.ErrorString = "R7:" + ex.Message;
     }
 }
Пример #2
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)
     {
         formMDI.infoError.ErrorString = "R21:" + ex.Message;
     }
 }
Пример #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)
     {
         formMDI.infoError.ErrorString = "R5:" + ex.Message;
     }
 }
Пример #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)
     {
         formMDI.infoError.ErrorString = "R8:" + ex.Message;
     }
 }
Пример #5
0
 /// <summary>
 /// Function to fill Rack 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)
     {
         formMDI.infoError.ErrorString = "ST:8" + ex.Message;
     }
 }
Пример #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)
     {
         formMDI.infoError.ErrorString = "G3:" + ex.Message;
     }
 }
Пример #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)
     {
         formMDI.infoError.ErrorString = "SE:10" + ex.Message;
     }
 }
Пример #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)
     {
         formMDI.infoError.ErrorString = "R11:" + ex.Message;
     }
 }
Пример #9
0
        /// <summary>
        /// To fill rack combobox
        /// </summary>
        public void RackComboFill()
        {
            try
            {
                RackSP    spRack = new RackSP();
                DataTable dtbl   = new DataTable();
                if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
                {
                    dtbl = spRack.RackViewAllByGodown(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));

                    DataRow drowSelect = dtbl.NewRow();
                    drowSelect[0]          = 0;
                    drowSelect["rackName"] = "All";
                    cmbRack.DataSource     = dtbl;
                    cmbRack.DisplayMember  = "rackName";
                    cmbRack.ValueMember    = "rackId";
                }
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "STKR6:" + ex.Message;
            }
        }
Пример #10
0
 /// <summary>
 /// Function to Rack Godown Combobox
 /// </summary>
 public void RackComboFillForLoad()
 {
     try
     {
         RackSP    spRack = new RackSP();
         DataTable dtbl   = new DataTable();
         if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             dtbl = spRack.RackFillForStock(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
             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)
     {
         formMDI.infoError.ErrorString = "PS:10" + ex.Message;
     }
 }
Пример #11
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)
            {
                formMDI.infoError.ErrorString = "R6:" + ex.Message;
            }
            return(isExist);
        }