コード例 #1
0
ファイル: EngineerGroupsTest.cs プロジェクト: jbob24/KPFF
        public void InsertGroup()
        {
            var group = new EngineerGroup(0, "My 2nd Group", "This is another test group", true);
            group.Insert();

            Assert.AreNotEqual(0, group.GroupId, "the groupid is still 0");
        }
コード例 #2
0
ファイル: EngineerGroups.aspx.cs プロジェクト: jbob24/KPFF
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                return;
            }

            var newGroup = new EngineerGroup();
            newGroup.Name = txtName.Text;
            newGroup.Description = txtDescription.Text;

            newGroup.Insert();

            RefreshPage();
        }
コード例 #3
0
ファイル: EngineerGroup.cs プロジェクト: jbob24/KPFF
        public static EngineerGroup GetById(int groupId)
        {
            var group = new EngineerGroup();

            using (var con = new SqlConnection(Configuration.ConnectionString))
            {
                con.Open();

                Dictionary<string, string> @params = new Dictionary<string, string>();
                @params.Add("@GroupID", groupId.ToString());

                var reader = GetDataReaderByStoredProcedure("sp_tblEngineerGroup_GetById", @params, con);

                if (reader.HasRows)
                {
                    reader.Read();
                    group.GroupId = reader.GetValueOrDefault<int>("ID");
                    group.Name = reader.GetValueOrDefault<string>("Name");
                    group.Description = reader.GetValueOrDefault<string>("Description");
                    group.IsActive = reader.GetValueOrDefault<bool>("Active");

                    group.Members = EngineerGroupMember.GetByGroupId(groupId);
                }

                con.Close();
            }

            return group;
        }
コード例 #4
0
ファイル: AllEngineers.aspx.cs プロジェクト: jbob24/KPFF
        private void GetGroup()
        {
            int groupId = 0;

            if (int.TryParse(hdnGroupFilterId.Value, out groupId))
            {
                if (groupId > 0)
                {
                    _filterGroup = EngineerGroup.GetById(groupId);
                }
            }
        }