private void btn_ViewGroup_Go_Click(object sender, EventArgs e) { flw_ViewGroup.Controls.Clear(); flw_ViewGroup.AutoScroll = false; flw_ViewGroup.HorizontalScroll.Enabled = false; flw_ViewGroup.HorizontalScroll.Visible = false; flw_ViewGroup.HorizontalScroll.Maximum = 0; flw_ViewGroup.AutoScroll = true; txt_ViewGroup_GroupName.Text = ""; //txt_ViewGroup_GroupNumber.Text = ""; txt_ViewGroup_NumberOfMember.Text = ""; txt_ViewGroup_ProjectTitle.Text = ""; string semester = cmb_ViewGroup_Semester.Text.ToString(); string grpnum = txt_ViewGroup_GroupNumber.Text.ToString(); tb_group tbg = new tb_group(); db_accountDataContext db = new db_accountDataContext(); var prods = from p in db.tb_groups where p.grp_semester.Contains(semester) where p.grp_groupNumber.Contains(grpnum) where p.grp_userName.Contains(temporaryUser) where p.grp_subject.Contains(temporaryCourse) select p; foreach (var a in prods) { txt_ViewGroup_GroupName.Text = a.grp_groupName; txt_ViewGroup_ProjectTitle.Text = a.grp_projectTitle; txt_ViewGroup_NumberOfMember.Text = a.grp_NumberOfMember.ToString(); } db_accountDataContext db1 = new db_accountDataContext(); var prods1 = from p in db1.tb_groupMembers where p.grpm_semester.Contains(semester) where p.grpm_groupNumber.Contains(grpnum) where p.grpm_username.Contains(temporaryUser) where p.grpm_subject.Contains(temporaryCourse) select p; foreach (var a in prods1) { string name = a.grpm_stdName; string id = a.grpm_stdId; string section = a.grpm_section; string part = a.grpm_stdPart; string mark = a.grpm_stdMark.ToString(); this.flw_ViewGroup.Controls.Add(new UserControl_ViewGroup(name, id, section, part, mark)); } }
private void btn_Editroup_Save_Click(object sender, EventArgs e) { string GroupName = txt_EditGroup_GroupName.Text.ToString(); string GroupNumber = txt_EditGroup_GroupNo.Text.ToString(); int NoOfMember = int.Parse(txt_EditGroup_NumberOfMember.Text); string ProjectTitle = txt_EditGroup_ProjectTitle.Text.ToString(); string semester = cmb_EditGroup_SemesterChooser.Text.ToString(); string subject = temporaryCourse; string username = temporaryUser; db_accountDataContext db1 = new db_accountDataContext(); tb_group acc1 = db1.tb_groups.SingleOrDefault(x => x.grp_groupNumber == GroupNumber); acc1.grp_groupName = GroupName; acc1.grp_projectTitle = ProjectTitle; acc1.grp_NumberOfMember = NoOfMember; acc1.grp_semester = semester; acc1.grp_subject = subject; acc1.grp_userName = username; // db1.tb_groups.InsertOnSubmit(acc1); db1.SubmitChanges(); foreach (string[] V1 in DataClass.EDitGroupTemporaryList) { string ax = V1[0]; string bx = V1[1]; string cx = V1[2]; string dx = V1[3]; // MessageBox.Show(V1[1]); db_accountDataContext db = new db_accountDataContext(); tb_groupMember acc = db.tb_groupMembers.SingleOrDefault(x => x.grpm_stdId == bx); acc.grpm_stdName = ax; acc.grpm_section = cx; acc.grpm_stdPart = dx; acc.grpm_stdMark = 0; acc.grpm_groupNumber = GroupNumber; acc.grpm_subject = subject; acc.grpm_semester = semester; acc.grpm_username = username; //db.tb_groupMembers.InsertOnSubmit(acc); db.SubmitChanges(); MessageBox.Show("Success"); } }
partial void Deletetb_group(tb_group instance);
partial void Updatetb_group(tb_group instance);
partial void Inserttb_group(tb_group instance);