private void admin_info_Click(object sender, EventArgs e) { dbDataContext db = new dbDataContext(); var data = (from x in db.admins select new { x.admin_name, x.t_department, x.t_id, x.password }); admin_grid.DataSource = data; }
private void valid_members_Click(object sender, EventArgs e) { dbDataContext db = new dbDataContext(); var data = (from x in db.registrations where x.status == "valid" select new { x.name, x.student_id, x.department, x.age, x.mail_address, x.blood_group, x.phone_number, x.status }); valid_grid.DataSource = data; }
private void search_Click(object sender, EventArgs e) { dbDataContext db = new dbDataContext(); string searchx = search_box.Text; var data = from x in db.donwithtables where x.withdrawer_id.Contains(search_box.Text) select new { x.withdrawer_id, x.withdrawal_amount, x.withdrawal_date, x.withdrawal_details }; if (data.Any()) { withdraw_grid.DataSource = data.ToList(); withdraw_grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; } else { MessageBox.Show("No such result available!! :/", "Warning Message"); search_box.Text = ""; } int sum = 0; for (int i = 0; i < withdraw_grid.Rows.Count; ++i) { sum += Convert.ToInt32(withdraw_grid.Rows[i].Cells[1].Value); } label3.Text = Convert.ToString(sum) + " " + "taka"; }
private void button2_Click(object sender, EventArgs e) { dbDataContext db = new dbDataContext(); var data = (from x in db.donwithtables where x.status == "withdraw" select new { x.withdrawer_id, x.withdrawal_amount, x.withdrawal_date, x.withdrawal_details }); withdraw_grid.DataSource = data; int sum = 0; for (int i = 0; i < withdraw_grid.Rows.Count; ++i) { sum += Convert.ToInt32(withdraw_grid.Rows[i].Cells[1].Value); } label3.Text = Convert.ToString(sum) + " " + "taka"; }
private void get_info_Click(object sender, EventArgs e) { dbDataContext db = new dbDataContext(); var data = (from x in db.donwithtables where x.status == "deposit" select new { x.donor_id, x.donation_amount, x.donation_date, x.donation_details }); deposit_grid.DataSource = data; int sum = 0; for (int i = 0; i < deposit_grid.Rows.Count; ++i) { sum += Convert.ToInt32(deposit_grid.Rows[i].Cells[1].Value); } label2.Text = Convert.ToString(sum) + " " + "taka"; }
private void button1_Click(object sender, EventArgs e) { dbDataContext db = new dbDataContext(); var admin = db.admins.SingleOrDefault(x => x.t_id == username.Text && x.password == pass.Text); var member = db.registrations.SingleOrDefault(x => x.student_id == username.Text && x.password == pass.Text && x.status == "valid"); if (username.Text == "") { MessageBox.Show("User Id is Empty", "Warning message"); } else if (pass.Text == "") { MessageBox.Show("Password is Empty", "Warning message"); } else if (username.Text == masterUser && pass.Text == masterPassword) { SuperAdmin sup = new SuperAdmin(); this.Hide(); sup.Show(); username.Text = ""; pass.Text = ""; } else if (admin != null) { Admin ad = new Admin(this); this.Hide(); ad.Show(); //username.Text = ""; pass.Text = ""; } else if (member != null) { Member mem = new Member(this); this.Hide(); mem.ShowDialog(); //username.Text = ""; pass.Text = ""; } else { MessageBox.Show("User Id or Password is Wrong or your credential is not valid", "Warning Message"); } }
private void button2_Click(object sender, EventArgs e) { int warning_rem = 0; if (r_tid.Text == "") { MessageBox.Show("Enter a valid teacher Id", "Warning Message"); } else if (r_tid.Text != null) { if (r_tid.Text != "") { string id_pattern = @"^[1]{1}[0-9]{3}-[1-9]{3}-[1-9]{4}$"; string tid_input = r_tid.Text; Match tid_match = Regex.Match(tid_input, id_pattern); if (tid_match.Success) { } else { MessageBox.Show("Enter a Valid Id!!", "Warning Message"); warning_rem = 1; r_tid.Text = ""; } } if (warning_rem == 0) { dbDataContext db = new dbDataContext(); var adm = db.admins.SingleOrDefault(x => x.t_id == r_tid.Text); db.admins.DeleteOnSubmit(adm); db.SubmitChanges(); MessageBox.Show("Admin removed successfully!!"); r_tid.Text = ""; } } }
private void Add_member_Click(object sender, EventArgs e) { int warning_add = 0; if (member_add.Text == "") { MessageBox.Show("Input a Student Id to Add!!"); member_add.Text = ""; } else { if (member_add.Text != "") { string id_pattern = @"^[1]{1}[0-9]{1}-[1-3]{1}\d{3}[1-3]{1}-[1-3]{1}$"; string mem_input = member_add.Text; Match mem_match = Regex.Match(mem_input, id_pattern); if (mem_match.Success) { } else { MessageBox.Show("Enter A Valid Id!!", "Warning Message"); warning_add = 1; member_add.Text = ""; } } if (warning_add == 0) { dbDataContext db = new dbDataContext(); registration reg = db.registrations.SingleOrDefault(x => x.student_id == member_add.Text); reg.status = "valid"; db.SubmitChanges(); MessageBox.Show("Member Added Sucessfully", "Message"); member_add.Text = ""; } } }
private void remove_Click(object sender, EventArgs e) { int warning_rem = 0; if (rmember_id.Text == "") { MessageBox.Show("Input a Member Id to Remove!!"); rmember_id.Text = ""; } else { if (rmember_id.Text != "") { string rid_pattern = @"^[1]{1}[0-9]{1}-[1-3]{1}\d{3}[1-3]{1}-[1-3]{1}$"; string rmem_input = rmember_id.Text; Match rmem_match = Regex.Match(rmem_input, rid_pattern); if (rmem_match.Success) { } else { MessageBox.Show("Enter Correct Id!!", "Warning Message"); warning_rem = 1; rmember_id.Text = ""; } } if (warning_rem == 0) { dbDataContext db = new dbDataContext(); registration reg = db.registrations.SingleOrDefault(x => x.student_id == rmember_id.Text); reg.status = "invalid"; db.SubmitChanges(); MessageBox.Show("Member Has Been Removed Sucessfully", "Message"); rmember_id.Text = ""; } } }
public Admin(Form1 fr2) { InitializeComponent(); this.f2 = fr2; dbDataContext db = new dbDataContext(); }
public Form1() { InitializeComponent(); dbDataContext db = new dbDataContext(); }
private void sign_up_Click(object sender, EventArgs e) { int warning = 0; if (s_name.Text == "" || s_id.Text == "" || s_dept.Text == "" || s_age.Text == "" || mail.Text == "" || b_gr.Text == "" || p_numb.Text == "" || pass.Text == "" || repass.Text == "") { MessageBox.Show("Fill UP all The Fields!!", "Warning Message"); } else if (pass.Text == repass.Text) { if (s_id.Text != "") { string id_pattern = @"^[1]{1}[0-9]{1}-[1-3]{1}\d{3}[1-3]{1}-[1-3]{1}$"; string input = s_id.Text; Match match = Regex.Match(input, id_pattern); if (match.Success) { } else { MessageBox.Show("Enter Correct Id!!", "Warning Message"); warning = 2; s_id.Text = ""; } } if (s_age.Text != "") { string age_pattern = @"^[1-9]{2}$"; string input_age = s_age.Text; Match match_age = Regex.Match(input_age, age_pattern); if (match_age.Success) { } else { MessageBox.Show("Enter Your Original Age!!", "Warning Message"); warning = 1; s_age.Text = ""; } } if (mail.Text != "") { string mail_pattern = @"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$"; string input_mail = mail.Text; Match match_mail = Regex.Match(input_mail, mail_pattern); if (match_mail.Success) { } else { MessageBox.Show("Enter Your Valid Mail Address!!", "Warning Message"); warning = 1; mail.Text = ""; } } if (p_numb.Text != "") { string numb_pattern = @"^[0]{1}[1]{1}[5-9]{1}\d{8}$"; string input_numb = p_numb.Text; Match match_numb = Regex.Match(input_numb, numb_pattern); if (match_numb.Success) { } else { MessageBox.Show("Enter Your Valid Phone Number!!", "Warning Message"); warning = 1; p_numb.Text = ""; } } if (warning == 0) { dbDataContext db = new dbDataContext(); registration reg = new registration(); reg.name = s_name.Text; reg.student_id = s_id.Text; reg.department = s_dept.Text; reg.age = int.Parse(s_age.Text); reg.mail_address = mail.Text; reg.blood_group = b_gr.Text; reg.phone_number = p_numb.Text; reg.password = pass.Text; reg.status = "pending"; db.registrations.InsertOnSubmit(reg); db.SubmitChanges(); MessageBox.Show("Registration Request has been sent successfully"); s_name.Text = ""; s_id.Text = ""; s_dept.Text = ""; s_age.Text = ""; mail.Text = ""; b_gr.Text = ""; p_numb.Text = ""; pass.Text = ""; repass.Text = ""; } } else { MessageBox.Show("Password and Re-Type Password Didn't match"); pass.Text = ""; repass.Text = ""; } }
public Registration() { InitializeComponent(); dbDataContext db = new dbDataContext(); }
private void ad_register_Click(object sender, EventArgs e) { int warning = 0; if (ad_name.Text == "" || t_dept.Text == "" || tid.Text == "" || pass.Text == "" || repass.Text == "") { MessageBox.Show("May be something is missing!!", "Warning Message"); } else if (pass.Text == repass.Text) { if (ad_name.Text != "") { string name_pattern = @"^[\p{L}'][ \p{L}'-]*[\p{L}]$"; string input_name = ad_name.Text; Match match_name = Regex.Match(input_name, name_pattern); if (match_name.Success) { } else { MessageBox.Show("Enter A Valid Name!!", "Warning Message"); warning = 1; ad_name.Text = ""; } } if (tid.Text != "") { string id_pattern = @"^[1]{1}[0-9]{3}-[1-9]{3}-[1-9]{4}$"; string tid_input = tid.Text; Match tid_match = Regex.Match(tid_input, id_pattern); if (tid_match.Success) { } else { MessageBox.Show("Enter a Valid Id!!", "Warning Message"); warning = 1; tid.Text = ""; } } if (warning == 0) { dbDataContext db = new dbDataContext(); admin ad = new admin(); ad.admin_name = ad_name.Text; ad.t_department = t_dept.Text; ad.t_id = tid.Text; ad.password = pass.Text; db.admins.InsertOnSubmit(ad); db.SubmitChanges(); MessageBox.Show("Sucessfully Registered"); ad_name.Text = ""; t_dept.Text = ""; tid.Text = ""; pass.Text = ""; repass.Text = ""; } } else { MessageBox.Show("Password and Re-Type Password Didn't match"); } }
public SuperAdmin() { InitializeComponent(); dbDataContext db = new dbDataContext(); }
private void withdraw_Click(object sender, EventArgs e) { int warning_wd = 0; if (w_id.Text == "" || w_am.Text == "" || re_wam.Text == "" || w_date.Text == "" || w_det.Text == "") { MessageBox.Show("One of the field is empty", "Warning Message"); } else if (w_am.Text == re_wam.Text) { if (w_id.Text != "") { string w_id_pattern = @"^[1]{1}[0-9]{3}-[1-9]{3}-[1-9]{4}$"; string w_input = w_id.Text; Match w_match = Regex.Match(w_input, w_id_pattern); if (w_match.Success) { } else { MessageBox.Show("Enter a Correct Withdrawal Id!!", "Warning Message"); warning_wd = 1; w_id.Text = ""; } } if (w_am.Text != "") { string w_am_pattern = @"^[1-9]{1,10}\d{0,8}$"; string w_am_input = w_am.Text; Match wam_match = Regex.Match(w_am_input, w_am_pattern); if (wam_match.Success) { } else { MessageBox.Show("Enter a Valid Withdrawal Amount!!", "Warning Message"); warning_wd = 1; w_am.Text = ""; re_wam.Text = ""; } } if (warning_wd == 0) { dbDataContext db = new dbDataContext(); donwithtable dw1 = new donwithtable(); dw1.withdrawer_id = w_id.Text; dw1.withdrawal_amount = w_am.Text; dw1.withdrawal_date = w_date.Text; dw1.withdrawal_details = w_det.Text; dw1.status = "withdraw"; db.donwithtables.InsertOnSubmit(dw1); db.SubmitChanges(); MessageBox.Show("Withdraw Sucessfull"); //w_id.Text = ""; w_am.Text = ""; re_wam.Text = ""; w_date.Text = ""; w_det.Text = ""; } } else { MessageBox.Show("Amount is not correct"); } }
private void update_Click(object sender, EventArgs e) { int warning_up = 0; if (s_name.Text == "" || sid.Text == "" || dept.Text == "" || s_age.Text == "" || mail.Text == "" || b_gr.Text == "" || p_numb.Text == "" || pass.Text == "" || repass.Text == "") { MessageBox.Show("Something is missinng"); if (sid.Text == "") { MessageBox.Show("Input an Id to update"); } } else if (pass.Text == repass.Text) { if (sid.Text != "") { string s_id_pattern = @"^[1]{1}[0-9]{1}-[1-3]{1}\d{3}[1-3]{1}-[1-3]{1}$"; string sid_input = sid.Text; Match sid_match = Regex.Match(sid_input, s_id_pattern); if (sid_match.Success) { } else { MessageBox.Show("Enter a Valid Student Id!!", "Warning Message"); warning_up = 1; sid.Text = ""; } } if (s_age.Text != "") { string age_pattern = @"^[1-9]{2}$"; string input_age = s_age.Text; Match match_age = Regex.Match(input_age, age_pattern); if (match_age.Success) { } else { MessageBox.Show("Enter A Valid Age!!", "Warning Message"); warning_up = 1; s_age.Text = ""; } } if (mail.Text != "") { string mail_pattern = @"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$"; string input_mail = mail.Text; Match match_mail = Regex.Match(input_mail, mail_pattern); if (match_mail.Success) { } else { MessageBox.Show("Enter A Valid Mail Address!!", "Warning Message"); warning_up = 1; mail.Text = ""; } } if (p_numb.Text != "") { string numb_pattern = @"^[0]{1}[1]{1}[5-9]{1}\d{8}$"; string input_numb = p_numb.Text; Match match_numb = Regex.Match(input_numb, numb_pattern); if (match_numb.Success) { } else { MessageBox.Show("Enter A Valid Phone Number!!", "Warning Message"); warning_up = 1; p_numb.Text = ""; } } if (warning_up == 0) { dbDataContext db = new dbDataContext(); registration reg = db.registrations.SingleOrDefault(x => x.student_id == sid.Text); reg.name = s_name.Text; // reg.student_id = sid.Text; reg.department = dept.Text; reg.age = int.Parse(s_age.Text); reg.mail_address = mail.Text; reg.blood_group = b_gr.Text; reg.phone_number = p_numb.Text; reg.password = pass.Text; db.SubmitChanges(); MessageBox.Show("Profile updated Sucessfully", "Message"); s_name.Text = ""; sid.Text = ""; dept.Text = ""; s_age.Text = ""; mail.Text = ""; b_gr.Text = ""; p_numb.Text = ""; pass.Text = ""; repass.Text = ""; } } else { MessageBox.Show("ReEnter your password correctly", "Warning Message"); pass.Text = ""; repass.Text = ""; } }
private void deposit_Click(object sender, EventArgs e) { int warning = 0; if (d_id.Text == "" || d_amount.Text == "" || re_am.Text == "" || d_date.Text == "" || d_det.Text == "") { MessageBox.Show("One of the field is empty", "Warning Message"); } else if (d_amount.Text == re_am.Text) { if (d_id.Text != "") { string d_id_pattern = @"^[1]{1}[0-9]{1}-[1-3]{1}\d{3}[1-3]{1}-[1-3]{1}$"; string did_input = d_id.Text; Match did_match = Regex.Match(did_input, d_id_pattern); if (did_match.Success) { } else { MessageBox.Show("Enter a Correct Deposit Id!!", "Warning Message"); warning = 1; d_id.Text = ""; } } if (d_amount.Text != "") { string d_am_pattern = @"^[1-9]{1,10}\d{0,8}$"; string dam_input = d_amount.Text; Match dam_match = Regex.Match(dam_input, d_am_pattern); if (dam_match.Success) { } else { MessageBox.Show("Enter a Valid Deposit Amount!!", "Warning Message"); warning = 1; d_amount.Text = ""; re_am.Text = ""; } } if (warning == 0) { dbDataContext db = new dbDataContext(); donwithtable dw = new donwithtable(); dw.donor_id = d_id.Text; dw.donation_amount = d_amount.Text; dw.donation_date = d_date.Text; dw.donation_details = d_det.Text; dw.status = "deposit"; db.donwithtables.InsertOnSubmit(dw); db.SubmitChanges(); MessageBox.Show("Deposit Sucessfull"); // d_id.Text = ""; d_amount.Text = ""; re_am.Text = ""; d_date.Text = ""; d_det.Text = ""; } } else { MessageBox.Show("Amount is not correct"); } }
public Deposit() { InitializeComponent(); dbDataContext db = new dbDataContext(); }