示例#1
0
        void btnCreate_Click(object sender, EventArgs e)
        {
            string group_name = CreateForm(string.Empty);

            if (group_name == null)
            {
                return;
            }

            Database.GroupDetails gd = new Database.GroupDetails();
            gd.GroupName = group_name;

            try
            {
                GlobalHelper.dbGroups.Save(true, gd);
            }
            catch (Database.DatabaseException ex)
            {
                if (ex.ExceptionType == Database.DatabaseException.ExceptionTypes.DUPLICATE_ENTRY)
                {
                    MessageBox.Show("A group by that name is already exist. Please give a different name.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to save the group due to error.\r\n\r\nError Message: " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // let's just repopulate for a while
            PopulateListView(lvGroups);
        }
        void btnUpdate_Click(object sender, EventArgs e)
        {
            string group_name = CreateForm(string.Empty);
            if (group_name == null) { return; }

            int groupid = int.Parse(lvGroups.SelectedItems[0].Tag.ToString());
            Database.GroupDetails gd = new Database.GroupDetails();
            gd.GroupID = groupid;
            gd.GroupName = group_name;
            GlobalHelper.dbGroups.Save(false, gd);

            // let's just repopulate for a while
            PopulateListView(lvGroups);
        }
示例#3
0
        void btnUpdate_Click(object sender, EventArgs e)
        {
            string group_name = CreateForm(string.Empty);

            if (group_name == null)
            {
                return;
            }

            int groupid = int.Parse(lvGroups.SelectedItems[0].Tag.ToString());

            Database.GroupDetails gd = new Database.GroupDetails();
            gd.GroupID   = groupid;
            gd.GroupName = group_name;
            GlobalHelper.dbGroups.Save(false, gd);

            // let's just repopulate for a while
            PopulateListView(lvGroups);
        }
        void btnCreate_Click(object sender, EventArgs e)
        {
            string group_name = CreateForm(string.Empty);
            if (group_name == null) { return; }

            Database.GroupDetails gd = new Database.GroupDetails();
            gd.GroupName = group_name;

            try
            {
                GlobalHelper.dbGroups.Save(true, gd);
            }
            catch (Database.DatabaseException ex)
            {
                if (ex.ExceptionType == Database.DatabaseException.ExceptionTypes.DUPLICATE_ENTRY)
                {
                    MessageBox.Show("A group by that name is already exist. Please give a different name.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to save the group due to error.\r\n\r\nError Message: " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // let's just repopulate for a while
            PopulateListView(lvGroups);
        }