예제 #1
0
        /// <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)
            {
                formMDI.infoError.ErrorString = "PG5:" + ex.Message;
            }
        }
예제 #2
0
        /// <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)
            {
                formMDI.infoError.ErrorString = "PG10:" + ex.Message;
            }

            return(isExist);
        }
예제 #3
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)
            {
                formMDI.infoError.ErrorString = "PG4:" + ex.Message;
            }
        }