/// <summary>
        /// Save Account Group
        /// </summary>
        /// <param name="objAccountGrp"></param>
        /// <returns>True/False</returns>
        public bool SaveContactGroup(eSunSpeedDomain.ContactModel objContactGrp)
        {
            string Query = string.Empty;

            DBParameterCollection paramCollection = new DBParameterCollection();

            paramCollection.Add(new DBParameter("@ContactName", objContactGrp.ContactName));
            paramCollection.Add(new DBParameter("@Alias", objContactGrp.AliasName));
            paramCollection.Add(new DBParameter("@Primary", objContactGrp.Primary));
            paramCollection.Add(new DBParameter("@UnderGroup", objContactGrp.UnderGroup));
            paramCollection.Add(new DBParameter("@CreatedBy", objContactGrp.CreatedBy));

            Query = "INSERT INTO contactgroup (`ContactName`,`Alias`,`Primarygroup`,`UnderGroup`,`CreatedBy`) VALUES (@contactName,@Alias,@Primarygroup,@UnderGroup,@CreatedBy)";

            return(_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0);
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //TODO: 1. Check whether the group name exists or not
            //2. if exist then do not allow to save with the same group name
            //3. Prompt user to change the group name as it already exists

            if (tbxGroupName.Text.Equals(string.Empty))
            {
                MessageBox.Show("Group Name can not be blank!");
                return;
            }

            //if (accObj.IsGroupExists(tbxGroupName.Text.Trim()))
            //{
            //    MessageBox.Show("Group Name already Exists!", "SunSpeed", MessageBoxButtons.RetryCancel);
            //    cbxUnderGrp.Focus();
            //    return;
            //}

            eSunSpeedDomain.ContactModel objContGroup = new eSunSpeedDomain.ContactModel();

            objContGroup.GroupName = tbxGroupName.Text;

            objContGroup.AliasName = tbxAliasname.Text;

            objContGroup.Primary = cbxPrimarygroup.SelectedItem.ToString() == "Yes" ? true : false;

            objContGroup.UnderGroup        = cbxUndergroup.SelectedItem.ToString();
            objContGroup.Natureofgroup     = cbxNaturegroup.SelectedItem.ToString();
            objContGroup.Affectgrossprofit = chkGrossProfit.Checked;

            objContGroup.CreatedBy = "Admin";

            string message = string.Empty;

            bool isSuccess = objcont.SaveContactGroup(objContGroup);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
            }
            //List<eSunSpeedDomain.AccountGroupModel> lstGroups = accObj.GetListofAccountsGroups();
            //dgvList.DataSource = lstGroups;

            //Dialogs.PopUPDialog d = new Dialogs.PopUPDialog("Saved Successfully!");
            //d.ShowDialog();
        }
Exemple #3
0
        /// <summary>
        /// Save Contact Group
        /// </summary>
        /// <param name="objContactGrp"></param>
        /// <returns>True/False</returns>
        public bool SaveContactGroup(eSunSpeedDomain.ContactModel objContactGrp)
        {
            string Query = string.Empty;

            DBParameterCollection paramCollection = new DBParameterCollection();
               paramCollection.Add(new DBParameter("@GroupName", objContactGrp.GroupName));
            paramCollection.Add(new DBParameter("@Alias", objContactGrp.AliasName));
            paramCollection.Add(new DBParameter("@Primarygroup", objContactGrp.Primary?1:0));
            paramCollection.Add(new DBParameter("@Natureofgroup", objContactGrp.Natureofgroup));
            paramCollection.Add(new DBParameter("@Affectgrossprofit", objContactGrp.Affectgrossprofit?1:0));
            paramCollection.Add(new DBParameter("@UnderGroup", objContactGrp.UnderGroup));
            paramCollection.Add(new DBParameter("@CreatedBy", objContactGrp.CreatedBy));

            Query = "INSERT INTO contactgroup (`Group`,`Alias`,`Primarygroup`,`Undergroup`,`Natureofgroup`,`Affectgrossprofit`,`CreatedBy`) VALUES (@GroupName,@Alias,@Primarygroup,@UnderGroup,@Natureofgroup,@Affectgrossprofit,@CreatedBy)";

            return _dbHelper.ExecuteNonQuery(Query,paramCollection) > 0;
        }