private void btn_member_card_search_Click(object sender, EventArgs e) { try { Buisness_Logic.gymMemberRepository gr = new Buisness_Logic.gymMemberRepository(); // Buisness_Logic.gymMember gm = new Buisness_Logic.gymMember(); string nicr = " "; gmzzz = gr.search(int.Parse(txt_memCardID.Text), txt_memCard_name.Text, nicr); txt_memCard_name.Text = gmzzz.name; txt_memCard_jdate.Text = gmzzz.joinedDate; pictureBox_card_photo.SizeMode = PictureBoxSizeMode.StretchImage; MemoryStream ms1 = new MemoryStream(gmzzz.photo); // ms1.ToArray(); ms1.Position = 0; ms1.Read(gmzzz.photo, 0, gmzzz.photo.Length); pictureBox_card_photo.Image = Image.FromStream(ms1); } catch (Exception dsf) { throw; } }
private void datagridm3refresh() { try { Buisness_Logic.gymMemberRepository gmrep = new Buisness_Logic.gymMemberRepository(); dataGridMemedit.DataSource = gmrep.editGymMembers(); this.dataGridMemedit.Columns[14].Visible = false; // txtM3_memID.Text= dataGridMemedit.SelectedRows[0].Cells[0].Value + string.Empty; } catch (Exception yt) { throw; } }
private void btnGw_search_Click(object sender, EventArgs e) { try { Buisness_Logic.gymMemberRepository gr = new Buisness_Logic.gymMemberRepository(); int regNo = string.IsNullOrWhiteSpace(txtgetW_memID.Text) ? 0 : int.Parse(txtgetW_memID.Text); string name = ""; string nic = txtgetW_nic.Text; var gm = gr.search(regNo, name, nic); txtgetW_memID.Text = gm.MemberID.ToString(); txtgetW_nic.Text = gm.nic; txtgetW_weight.Text = gm.weight.ToString(); txtgetW_bmi.Text = gm.BMIratio.ToString(); txtgetW_fat.Text = gm.fatLevel.ToString(); txtgetW_height.Text = gm.height.ToString(); //txtgetW_shedule.Text = } catch (Exception fd) { throw; } }
private void btnM3_update_Click(object sender, EventArgs e) { if (validateUpdateMember()) { Buisness_Logic.gymMember gm = new Buisness_Logic.gymMember(); MemoryStream memt1p2 = new MemoryStream(); pictureBoxM3.Image.Save(memt1p2, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] photo_memt2 = memt1p2.ToArray(); gm.MemberID = int.Parse(txtM3_memID.Text); gm.name = txtM3_name.Text; gm.nic = txtM3_nic.Text; gm.phone = txtM3_phone.Text; gm.fatLevel = double.Parse(txtM3_fatLevel.Text); gm.addresss = txtmsearch_address.Text; gm.gender = cmbM3_gender.SelectedItem.ToString(); gm.paymentPlan = cmbM3_paymentpaln.SelectedItem.ToString(); gm.dob = txtm3_dob.Text; gm.height = double.Parse(txtM3_height.Text); gm.weight = double.Parse(txtM3_weight.Text); gm.photo = photo_memt2; gm.email = txtmsemail.Text; Buisness_Logic.gymMemberRepository grup = new Buisness_Logic.gymMemberRepository(); if (grup.updateGymMember(gm)) { MessageBox.Show("Member detail updated.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); datagridm3refresh(); } } }
private void btnM2delete_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txtM3_memID.Text)) { try { Buisness_Logic.gymMember gmd = new Buisness_Logic.gymMember(); gmd.MemberID = int.Parse(txtM3_memID.Text); Buisness_Logic.gymMemberRepository grd = new Buisness_Logic.gymMemberRepository(); if (grd.deleteMemeber(gmd)) { MessageBox.Show("Record deleted.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Information); datagridm3refresh(); } else { MessageBox.Show("Record delete failed.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception edel) { throw; } } else { MessageBox.Show("Please enter the member ID to delete a record.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnM3_Search_Click(object sender, EventArgs e) { try { // Buisness_Logic.validation val3 = new Buisness_Logic.validation(); if (validate_search()) { Buisness_Logic.gymMemberRepository gr_search = new Buisness_Logic.gymMemberRepository(); var gm = gr_search.search((string.IsNullOrEmpty(txtM3_memID.Text) ? 0 : int.Parse(txtM3_memID.Text)), txtM3_name.Text.ToString(), txtM3_nic.Text.ToString()); if (gm.MemberID == 0) { clearMSearch(); } else { txtM3_memID.Text = gm.MemberID.ToString(); txtM3_name.Text = gm.name; txtM3_nic.Text = gm.nic; txtM3_phone.Text = gm.phone.ToString(); // txt.Text = gm.joinedDate; txtM3_fatLevel.Text = gm.fatLevel.ToString(); //MemoryStream ms = new MemoryStream(gm.photo); //pictureBoxM3.Image = Image.FromStream(ms); cmbM3_gender.SelectedItem = gm.gender; cmbM3_paymentpaln.SelectedItem = gm.paymentPlan; txtm3_dob.Text = gm.dob; txtM3_height.Text = gm.height.ToString(); txtM3_weight.Text = gm.weight.ToString(); txtM3_bmi.Text = gm.BMIratio.ToString(); txtmsemail.Text = gm.email; txtmsearch_address.Text = gm.addresss; pictureBoxM3.SizeMode = PictureBoxSizeMode.StretchImage; MemoryStream ms1 = new MemoryStream(gm.photo); // ms1.ToArray(); ms1.Position = 0; ms1.Read(gm.photo, 0, gm.photo.Length); pictureBoxM3.Image = Image.FromStream(ms1); } } } catch (Exception expo) { // MessageBox.Show(expo.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); // throw; } }
private void btnM_save_Click(object sender, EventArgs e) { try { if (validateAddMember()) { //initialize image MemoryStream memt1p1 = new MemoryStream(); picuturebox_member.Image.Save(memt1p1, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] photo_memt1 = memt1p1.ToArray(); //****************************************** // create gymMember object Buisness_Logic.gymMember mem = new Buisness_Logic.gymMember(); //******************************************* // set values to gymMember class mem.name = txtM_name.Text; mem.dob = dateTimePickerMem.Value.ToShortDateString(); mem.gender = cmbM_gender.SelectedItem.ToString(); mem.phone = txtM_phone.Text; mem.addresss = txtM_address.Text; mem.nic = txtM_nic.Text; mem.height = double.Parse(txtM_height.Text); mem.weight = double.Parse(txtM_weight.Text); mem.email = txtM_email.Text; mem.photo = photo_memt1; mem.paymentPlan = cmbM_paymentPlan.SelectedItem.ToString(); mem.fatLevel = double.Parse(txtM_fat.Text); //********************************************** Buisness_Logic.gymMemberRepository gr = new Buisness_Logic.gymMemberRepository(); if (gr.save(mem)) { MessageBox.Show("Success", "Data Insertion", MessageBoxButtons.OK, MessageBoxIcon.Information); txtM_memID.Text = mem.MemberID.ToString(); txtM_bmiratio.Text = mem.BMIratio.ToString(); } } } catch (Exception exm1) { MessageBox.Show(exm1.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }