コード例 #1
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
        /// <summary>
        /// Function to check whether the groupname exist or not while save or edit group
        /// </summary>
        /// <returns></returns>
        public bool CheckExistanceOfGroupName()
        {
            bool isExist = false;

            try
            {
                //Check whether a group name already exist in DB
                ProductGroupSP spProductGroup = new ProductGroupSP();

                isExist = spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim(), 0);
                if (isExist)
                {
                    if (txtProductGroupName.Text.ToLower() == strProductGroupName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PG11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(isExist);
        }
コード例 #2
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
        /// <summary>
        /// Function To edit existing productgroup
        /// </summary>
        private void EditFunction()
        {
            try
            {
                ProductGroupInfo infoProductGroup = new ProductGroupInfo();
                ProductGroupSP   spProductGroup   = new ProductGroupSP();
                infoProductGroup.GroupId    = Convert.ToDecimal(dgvProductGroup.CurrentRow.Cells["dgvtxtgroupId"].Value);
                infoProductGroup.GroupName  = txtProductGroupName.Text.Trim();
                infoProductGroup.GroupUnder = Convert.ToDecimal(cmbUnder.SelectedValue.ToString());
                infoProductGroup.Narration  = txtNarration.Text.Trim();
                infoProductGroup.Extra1     = string.Empty;
                infoProductGroup.Extra2     = string.Empty;

                if (spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim().ToString(), decId) == false)
                {
                    spProductGroup.ProductGroupEdit(infoProductGroup);
                    Messages.UpdatedMessage();
                    ProductGroupUnderComboFill();
                    ProductGroupUnderComboFillForSearch();
                    GridFill();
                    Clear();
                    txtProductGroupName.Focus();
                }
                else
                {
                    Messages.InformationMessage(" Product group already exists");
                    txtProductGroupName.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PG5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #3
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
        /// <summary>
        /// Function to save new productgroup
        /// </summary>
        private void SaveFunction()
        {
            try
            {
                ProductGroupInfo infoProductGroup = new ProductGroupInfo();
                ProductGroupSP   spProductGroup   = new ProductGroupSP();
                infoProductGroup.GroupName  = txtProductGroupName.Text.Trim();
                infoProductGroup.GroupUnder = Convert.ToDecimal(cmbUnder.SelectedValue.ToString());
                infoProductGroup.Narration  = txtNarration.Text.Trim();
                infoProductGroup.Extra1     = string.Empty;
                infoProductGroup.Extra2     = string.Empty;


                if (spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim(), 0) == false)
                {
                    decIdForOtherForms = spProductGroup.ProductGroupAdd(infoProductGroup);
                    Messages.SavedMessage();
                    ProductGroupUnderComboFill();
                    ProductGroupUnderComboFillForSearch();
                    GridFill();
                    Clear();
                    txtProductGroupName.Focus();
                }
                else
                {
                    Messages.InformationMessage("Product group already exists");
                    txtProductGroupName.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PG4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #4
0
 /// <summary>
 /// Function to Fill product group or tax according to search by combo box selection in Product Group/Tax combo box
 /// </summary>
 public void ProductGroupTaxComboFill()
 {
     try
     {
         if (cmbSearchBy.SelectedIndex == 0)
         {
             ProductGroupSP spProductGroup   = new ProductGroupSP();
             DataTable      dtblProductGroup = new DataTable();
             dtblProductGroup = spProductGroup.ProductGroupViewAll();
             cmbProductGroupTax.DataSource    = dtblProductGroup;
             cmbProductGroupTax.ValueMember   = "groupId";
             cmbProductGroupTax.DisplayMember = "groupName";
         }
         else
         {
             TaxSP     spTax   = new TaxSP();
             DataTable dtblTax = new DataTable();
             dtblTax = spTax.TaxViewAll();
             cmbProductGroupTax.DataSource    = dtblTax;
             cmbProductGroupTax.ValueMember   = "taxId";
             cmbProductGroupTax.DisplayMember = "taxName";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CPT 5 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #5
0
 /// <summary>
 /// GridFill Function
 /// </summary>
 public void GridFill()
 {
     try
     {
         ProductGroupSP spProductGroup = new ProductGroupSP();
         DataTable      dtbl           = new DataTable();
         dtbl = spProductGroup.ProductAndUnitViewAllForGridFill(Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), txtProductCode.Text.Trim(), txtProductName.Text.Trim());
         dgvStandardRate.DataSource = dtbl;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
 /// <summary>
 /// Function to fill GroupUnder combobox for search
 /// </summary>
 public void ProductGroupUnderComboFillForSearch()
 {
     try
     {
         ProductGroupSP spProductGroup = new ProductGroupSP();
         DataTable      dtbl           = new DataTable();
         dtbl = spProductGroup.ProductGroupViewForComboFill();
         cmbUnderSearch.DataSource    = dtbl;
         cmbUnderSearch.ValueMember   = "GroupId";
         cmbUnderSearch.DisplayMember = "GroupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #7
0
 /// <summary>
 /// Function to fill ProductGroup combobox
 /// </summary>
 public void ProductGroupViewForComboFill()
 {
     try
     {
         ProductGroupSP spProductGroup = new ProductGroupSP();
         DataTable      dtbl           = spProductGroup.ProductGroupViewForComboFill();
         cmbProductGroup.DataSource    = dtbl;
         cmbProductGroup.DisplayMember = "groupName";
         cmbProductGroup.ValueMember   = "groupId";
         cmbProductGroup.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #8
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
 /// <summary>
 /// Function to delete productgroup
 /// </summary>
 private void Delete()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage() == true)
             {
                 ProductGroupInfo InfoProductGroup = new ProductGroupInfo();
                 ProductGroupSP   spProductGroup   = new ProductGroupSP();
                 if ((spProductGroup.ProductGroupReferenceDelete(decId) == -1))
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     Messages.DeletedMessage();
                     btnSave.Text      = "Save";
                     btnDelete.Enabled = false;
                     ProductGroupUnderComboFillForSearch();
                     Clear();
                 }
             }
         }
         else
         {
             ProductGroupInfo InfoProductGroup = new ProductGroupInfo();
             ProductGroupSP   spProductGroup   = new ProductGroupSP();
             if ((spProductGroup.ProductGroupReferenceDelete(decId) == -1))
             {
                 Messages.ReferenceExistsMessage();
             }
             else
             {
                 Messages.DeletedMessage();
                 btnSave.Text      = "Save";
                 btnDelete.Enabled = false;
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PG6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #9
0
 /// <summary>
 /// Function to fill the ProductGroup combobox
 /// </summary>
 public void ProductGroupComboFill()
 {
     try
     {
         ProductGroupSP spProductGroup   = new ProductGroupSP();
         DataTable      dtblProductGroup = new DataTable();
         dtblProductGroup = spProductGroup.ProductGroupViewAll();
         DataRow dr = dtblProductGroup.NewRow();
         dr[2] = "All";
         dtblProductGroup.Rows.InsertAt(dr, 0);
         cmbProductGroup.DataSource    = dtblProductGroup;
         cmbProductGroup.ValueMember   = "groupId";
         cmbProductGroup.DisplayMember = "groupName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PSP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #10
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
        /// <summary>
        /// Function to fill the grid to view all the product groups
        /// </summary>
        private void GridFill()
        {
            try
            {
                DataTable        dtbl            = new DataTable();
                ProductGroupSP   spProducttGroup = new ProductGroupSP();
                ProductGroupInfo info            = new ProductGroupInfo();
                if (cmbUnderSearch.Text == "")
                {
                    cmbUnderSearch.Text = "All";
                }

                dtbl = spProducttGroup.ProductGroupViewForGridFill(txtProductGroupSearch.Text, cmbUnderSearch.Text);
                dgvProductGroup.DataSource = dtbl;
            }
            catch (Exception ex)
            {
                MessageBox.Show("PG9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #11
0
ファイル: frmProductGroup.cs プロジェクト: Ahmad-Noor/POS111
 /// <summary>
 /// Function to fill the fields to edit or delete
 /// </summary>
 private void FillControls()
 {
     try
     {
         ProductGroupInfo infoProductGroup = new ProductGroupInfo();
         ProductGroupSP   spProductGroup   = new ProductGroupSP();
         infoProductGroup         = spProductGroup.ProductGroupView(decId);
         txtProductGroupName.Text = infoProductGroup.GroupName;
         DataTable dtbl = new DataTable();
         dtbl = spProductGroup.ProductGroupViewForComboFillForProductGroup();
         cmbUnder.DataSource = dtbl;
         foreach (DataRow dr in dtbl.Rows)
         {
             if (dr["GroupName"].ToString() == txtProductGroupName.Text)
             {
                 dr.Delete();
             }
         }
         cmbUnder.ValueMember   = "GroupId";
         cmbUnder.DisplayMember = "GroupName";
         cmbUnder.SelectedValue = infoProductGroup.GroupUnder;
         if (spProductGroup.ProductGroupCheckExistenceOfUnderGroup(decId) == false)
         {
             cmbUnder.Enabled = false;
         }
         else
         {
             cmbUnder.Enabled = true;
         }
         txtNarration.Text = infoProductGroup.Narration;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PG10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }