Example #1
0
        protected void gvItemGroup_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow _row = (GridViewRow)((Control)e.CommandSource).NamingContainer;

            if (_row != null)
            {
                TextBox _GroupItemTypeIDTextBox = (TextBox)_row.FindControl("GroupItemTypeIDTextBox");
                if ((_GroupItemTypeIDTextBox != null) && (!String.IsNullOrEmpty(_GroupItemTypeIDTextBox.Text)))
                {
                    control.ItemGroupTbl _ItemGroup = new control.ItemGroupTbl();
                    Literal _ItemGroupIDLiteral     = (Literal)_row.FindControl("ItemGroupIDLiteral");
                    _ItemGroup.ItemGroupID = (_ItemGroupIDLiteral != null) ? Convert.ToInt32(_ItemGroupIDLiteral.Text) : 0;
                    if (e.CommandName.Equals("Delete"))
                    {
                        _ItemGroup.DeleteItemGroup(_ItemGroup.ItemGroupID);
                    }
                    else
                    {
                        TextBox  _ItemTypeIDTextBox = (TextBox)_row.FindControl("ItemTypeIDTextBox");
                        CheckBox _Enabled           = (CheckBox)_row.FindControl("EnabledCheckBox");
                        if (e.CommandName.Equals("Add") || e.CommandName.Equals("Insert"))
                        {
                            _ItemGroup.InsertItemGroup(_ItemGroup);
                        }
                        else if (e.CommandName.Equals("Update"))
                        {
                            _ItemGroup.UpdateItemGroup(_ItemGroup, _ItemGroup.ItemGroupID);
                        }
                    }
                }
                //gvItemGroup.DataBind();
            }
        }
Example #2
0
        protected void gvItemsInList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("MoveDown") || e.CommandName.Equals("MoveUp"))
            {
                // Convert the row index stored in the CommandArgument
                // property to an Integer.
                int _index = Convert.ToInt32(e.CommandArgument);

                // Get the last name of the sele  cted author from the appropriate
                // cell in the GridView control.
                GridViewRow  _row            = gvItemsInList.Rows[_index];
                DropDownList _ddlItem        = (DropDownList)_row.FindControl("ddlItemDesc");
                Label        _lblItemSortPos = (Label)_row.FindControl("lblItemSortPos");

                TrackerDotNet.control.ItemGroupTbl _ITG = new control.ItemGroupTbl();
                _ITG.GroupItemTypeID = Convert.ToInt32(ddlGroupItems.SelectedValue);
                _ITG.ItemTypeID      = Convert.ToInt32(_ddlItem.SelectedValue);
                _ITG.ItemTypeSortPos = Convert.ToInt32(_lblItemSortPos.Text);

                if (e.CommandName.Equals("MoveUp"))
                {
                    _ITG.DecItemSortPos(_ITG);
                }
                else
                {
                    _ITG.IncItemSortPos(_ITG);
                }

                gvItemsInList.DataBind();
            }
        }
Example #3
0
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            // for each item that is selected remove from list
            foreach (GridViewRow row in gvItemsInList.Rows)
            {
                // Access the CheckBox
                CheckBox _cbxRemoveItem = (CheckBox)row.FindControl("cbxRemoveItem");
                if (_cbxRemoveItem != null && _cbxRemoveItem.Checked)
                {
                    DropDownList _ddlItem = (DropDownList)row.FindControl("ddlItemDesc");

                    TrackerDotNet.control.ItemGroupTbl _ITG = new control.ItemGroupTbl();
                    _ITG.DeleteGroupItemFromGroup(Convert.ToInt32(ddlGroupItems.SelectedValue), Convert.ToInt32(_ddlItem.SelectedValue));
                }
            }
            gvItemsInList.DataBind();
            gvItemsNotInGroup.DataBind();
        }
Example #4
0
        protected void btnAddItem_Click(object sender, EventArgs e)
        {
            // for each item that is selected remove from list
            foreach (GridViewRow _row in gvItemsNotInGroup.Rows)
            {
                // Access the CheckBox
                CheckBox _cbxAddItem = (CheckBox)_row.FindControl("cbxAddItem");
                if (_cbxAddItem != null && _cbxAddItem.Checked)
                {
                    DropDownList _ddlItem = (DropDownList)_row.FindControl("ddlItemTypeDesc");

                    TrackerDotNet.control.ItemGroupTbl _ITG = new control.ItemGroupTbl();
                    _ITG.GroupItemTypeID = Convert.ToInt32(ddlGroupItems.SelectedValue);
                    _ITG.ItemTypeID      = Convert.ToInt32(_ddlItem.SelectedValue);
                    _ITG.ItemTypeSortPos = _ITG.GetLastGroupItemSortPos(_ITG.GroupItemTypeID) + 1;
                    _ITG.Enabled         = true;
                    _ITG.Notes           = "added on ItemGroup form";
                    _ITG.InsertItemGroup(_ITG);
                }
            }
            gvItemsInList.DataBind();
            gvItemsNotInGroup.DataBind();
            updtPnlItemsInList.Update();
        }