Пример #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;
     }
 }
Пример #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)
     {
         MessageBox.Show("G7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
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;
     }
 }
Пример #4
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)
     {
         MessageBox.Show("R1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #5
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)
     {
         MessageBox.Show("R1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
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;
     }
 }
Пример #7
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;
     }
 }
Пример #8
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;
     }
 }
Пример #9
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)
     {
         MessageBox.Show("G11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #10
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)
     {
         MessageBox.Show("R2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #11
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)
     {
         MessageBox.Show("R2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #12
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)
     {
         MessageBox.Show("SE:7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #13
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 = "SER6:" + ex.Message;
     }
 }
Пример #14
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;
     }
 }
Пример #15
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)
     {
         MessageBox.Show("G8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #16
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;
     }
 }
Пример #17
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)
     {
         MessageBox.Show("G7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #18
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)
     {
         MessageBox.Show("G5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #19
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)
     {
         MessageBox.Show("G4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #20
0
 /// <summary>
 /// GridGodownComboFill
 /// </summary>
 public void GridGodownComboFill(decimal decProductId, int inRow, int inCol)
 {
     try
     {
         GodownSP spGodown = new GodownSP();
         DataTable dtblGodown = new DataTable();
         dtblGodown = spGodown.GodownViewAll();
         dgvcmbGodown.DataSource = dtblGodown;
         DataGridViewComboBoxCell dgvcmbGodownCell = (DataGridViewComboBoxCell)dgvProduct.Rows[inRow].Cells[inCol];
         dgvcmbGodownCell.DataSource = dtblGodown;
         dgvcmbGodown.ValueMember = "godownId";
         dgvcmbGodown.DisplayMember = "godownName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN31: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #21
0
        /// <summary>
        /// Function to fill godown combobox in grid
        /// </summary>
        public void GodownComboFill()
        {

            try
            {
                DataTable dtbl = new DataTable();
                GodownSP spGodown = new GodownSP();
                dtbl = spGodown.GodownViewAll();
                cmbDefaultGodown.DataSource = dtbl;
                cmbDefaultGodown.DisplayMember = "godownName";
                cmbDefaultGodown.ValueMember = "godownId";
                cmbDefaultGodown.SelectedValue = 1;


            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:49" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #22
0
        //--------------------------------------------------------------ReturnFromGodownForm---------------------------- 
        /// <summary>
        /// Function to fill godown combobox while return from godown when creating new godown 
        /// </summary>
        /// <param name="decId"></param>
        public void ReturnFromGodownForm(decimal decId)
        {
            try
            {
                if (!isCallFromGrid)
                {
                    GodownComboFill();
                    if (decId.ToString() != "0")
                    {
                        cmbDefaultGodown.SelectedValue = decId;
                    }
                    else if (strGodownName != string.Empty)
                    {
                        cmbDefaultGodown.SelectedValue = strGodownName;
                    }
                    else
                    {
                        cmbDefaultGodown.SelectedIndex = -1;
                    }
                    this.Enabled = true;
                    cmbDefaultGodown.Focus();
                    this.WindowState = FormWindowState.Normal;
                    this.Activate();
                }
                else
                {
                    DataGridViewComboBoxCell dgvGodownCell = (DataGridViewComboBoxCell)dgvProductCreation[dgvProductCreation.Columns["dgvcmbtgodown"].Index, dgvProductCreation.CurrentRow.Index];
                    DataGridViewComboBoxCell dgvRackCell = (DataGridViewComboBoxCell)dgvProductCreation[dgvProductCreation.Columns["dgvcmbrack"].Index, dgvProductCreation.CurrentRow.Index];
                    DataTable dtbl = new DataTable();
                    GodownSP spGodown = new GodownSP();
                    dtbl = spGodown.GodownViewAll();
                    dgvcmbtgodown.DataSource = dtbl;
                    if (decId.ToString() != "0")
                    {
                        dgvProductCreation.CurrentRow.Cells["dgvcmbtgodown"].Value = decId;
                        dgvRackCell.DataSource = null;

                    }


                }


            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:39" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #23
0
        /// <summary>
        /// Function to fill godown combobox in grid
        /// </summary>
        public void GodownGrigComboFill()
        {

            try
            {
                DataTable dtbl = new DataTable();
                GodownSP spGodown = new GodownSP();
                dtbl = spGodown.GodownViewAll();
                DataRow drow = dtbl.NewRow();
                drow["godownName"] = string.Empty;
                drow["godownId"] = 0;
                dtbl.Rows.InsertAt(drow, 0);
                dgvcmbtgodown.DataSource = dtbl;
                dgvcmbtgodown.DisplayMember = "godownName";
                dgvcmbtgodown.ValueMember = "godownId";

            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }
Пример #24
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)
     {
         MessageBox.Show("SE:7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #25
0
 /// <summary>
 /// Function to use the Godown ComboFill
 /// </summary>
 public void DGVGodownComboFill()
 {
     try
     {
         GodownSP spGodown = new GodownSP();
         dgvcmbGodown.DataSource = spGodown.GodownViewAll();
         dgvcmbGodown.ValueMember = "godownId";
         dgvcmbGodown.DisplayMember = "godownName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("RI:16" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #26
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)
     {
         MessageBox.Show("G8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Godown Combobox
 /// </summary>
 public void GoDownComboFill()
 {
     try
     {
         GodownSP spGodown = new GodownSP();
         DataTable dtblGodown = new DataTable();
         dtblGodown = spGodown.GodownViewAll();
         cmbGoDown.DataSource = dtblGodown;
         cmbGoDown.ValueMember = "godownId";
         cmbGoDown.DisplayMember = "godownName";
         if (GodownStatus())
         {
             cmbGoDown.Enabled = true;
             btnGodownAdd.Enabled = true;
             btnRackAdd.Visible = false;
             if (dtblGodown.Rows.Count == 1)
             {
                 cmbRack.Enabled = true;
                 btnRackAdd.Visible = true;
                 RackComboFillByGodown(Convert.ToDecimal(cmbGoDown.SelectedValue));
             }
         }
         else
         {
             cmbGoDown.Enabled = false;
             btnGodownAdd.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MPC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #28
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)
     {
         MessageBox.Show("G11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #29
0
 /// <summary>
 /// Function to add the products to grid
 /// </summary>
 public void AddToGrid()
 {
     try
     {
         SettingsSP spSettings = new SettingsSP();
         if (txtProductCode.Text.Trim() == null && txtProductCode.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter product code");
             txtProductCode.Focus();
         }
         else if (cmbItem.SelectedIndex == -1 && cmbItem.SelectedValue == null)
         {
             Messages.InformationMessage("Select a product");
             cmbItem.Focus();
         }
         else if (Convert.ToDecimal(txtQuantity.Text.Trim()) <= 0 || txtQuantity.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter quantity");
             txtQuantity.Focus();
         }
         else if (cmbUnit.SelectedValue == null)
         {
             Messages.InformationMessage("Select a unit");
             cmbUnit.Focus();
         }
         else if (spSettings.SettingsStatusCheck("AllowZeroValueEntry") == "No" && decimal.Parse(txtRate.Text.Trim()) <= 0 || txtRate.Text.Trim() == string.Empty)
         {
             Messages.InformationMessage("Enter rate");
             txtRate.Focus();
         }
         else
         {
             int inCurrentRowIndex = new int();
             bool isExecutef = false;
             if (rowIdToEdit == 0)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
                 isExecutef = true;
             }
             else
             {
                 for (int i = 0; i < dgvPointOfSales.Rows.Count; ++i)
                 {
                     if (dgvPointOfSales.Rows[i].Cells["rowId"].Value.ToString() == rowIdToEdit.ToString())
                     {
                         isExecutef = true;
                         inCurrentRowIndex = i;
                         break;
                     }
                 }
             }
             if (!isExecutef)
             {
                 dgvPointOfSales.Rows.Add();
                 inCurrentRowIndex = dgvPointOfSales.Rows.Count - 1;
             }
             ProductInfo infoProduct = new ProductInfo();
             BatchInfo infoBatch = new BatchInfo();
             RackInfo infoRack = new RackInfo();
             UnitConvertionInfo InfoUnitConvertion = new UnitConvertionInfo();
             infoProduct = new ProductSP().ProductView(decProductId);
             decimal dcProductBatch = new BatchSP().BatchIdViewByProductId(decProductId);
             InfoUnitConvertion = new UnitConvertionSP().UnitViewAllByProductId(decProductId);
             infoBatch = new BatchSP().BatchView(dcProductBatch);
             decimal dcGodownId = infoProduct.GodownId;
             GodownInfo infoGodown = new GodownInfo();
             infoGodown = new GodownSP().GodownView(dcGodownId);
             decimal dcRackId = infoProduct.RackId;
             infoRack = new RackSP().RackView(dcRackId);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductCode"].Value = txtProductCode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductName"].Value = cmbItem.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtQuantity"].Value = txtQuantity.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnit"].Value = cmbUnit.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRate"].Value = txtRate.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGrossValue"].Value = txtGrossValue.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxPercentage"].Value = cmbTax.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTaxAmount"].Value = txtTaxAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtNetAmount"].Value = txtNetAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtDiscount"].Value = txtDiscountAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtTotalAmount"].Value = txtAmount.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxttaxid"].Value = Convert.ToDecimal(cmbTax.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtProductId"].Value = infoProduct.ProductId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchId"].Value = dcProductBatch;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackId"].Value = infoProduct.RackId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownId"].Value = infoProduct.GodownId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtUnitId"].Value = Convert.ToDecimal(cmbUnit.SelectedValue);
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtunitconversionId"].Value = InfoUnitConvertion.UnitconvertionId;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBarcode"].Value = txtBarcode.Text;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtBatchno"].Value = infoBatch.BatchNo;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtGodownName"].Value = infoGodown.GodownName;
             dgvPointOfSales.Rows[inCurrentRowIndex].Cells["dgvtxtRackName"].Value = infoRack.RackName;
             TotalAmountCalculation();
             ClearGroupbox();
             dgvPointOfSales.CurrentCell = dgvPointOfSales[0, dgvPointOfSales.Rows.Count - 1];
             txtBarcode.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:34" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }