示例#1
0
        /// <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);
            }
        }
        public decimal ProductGroupAdd(ProductGroupInfo productgroupinfo)
        {
            decimal decIdForOtherForms = 0;

            try
            {
                decIdForOtherForms = spProductGroup.ProductGroupAdd(productgroupinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("AL18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decIdForOtherForms);
        }