void StudentSave() { string Grade = ((cboGrade.SelectedItem as ComboBoxItem).Value.ToString()); string Section = ((cboSection.SelectedItem as ComboBoxItem).Value.ToString()); string course = ((cboCourse.SelectedItem as ComboBoxItem).Value.ToString()); if (!Grade.Contains("13")) { txtGradeOther.Text = ""; } string[] g = Grade.Split('/'); Grade = g[0]; if (!Section.Contains("0")) { txtSectionOther.Text = ""; } string[] s = Section.Split('/'); Section = s[0]; if (cmd_save.Text == "&Save") { int lrn = db.sp_checkLRN(LRNStudent.Text).Count(); if (lrn >= 1) { MessageBox.Show("LRN already exist!", Tool.Systemname, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { db.sp_InsertUser(FirstNameStudent.Text, MiddleNameStudent.Text, LastNameStudent.Text, "", "3", "", "", new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), txtQrCode.Text, Tool.ImageToByte(pbStudent.Image), LRNStudent.Text, Grade, Section, "", "", PhoneNumberStudent.Text, dtBirthDate.Text, txtStrand.Text, txtSy.Text, txtGuardiansName.Text, dt_TimeIN.Text + "/" + dt_TimeOUT.Text, txtAdviser.Text, course, txtGradeOther.Text, txtSectionOther.Text); MessageBox.Show("Changes Successfully saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); fmain.getAccounts("%"); FingerPrintScanner.FingerprintTemplate = null; this.Close(); } // } else { int lrn = db.sp_checkLRN(LRNStudent.Text).Count(); if (lrn > 1) { MessageBox.Show("LRN already exist!", Tool.Systemname, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { string level = ((this.cbo_level.SelectedItem as ComboBoxItem).Value.ToString()); db.sp_UpdateUser(FirstNameStudent.Text, MiddleNameStudent.Text, LastNameStudent.Text, "", "3", "", "", new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), txtQrCode.Text, Tool.ImageToByte(pbStudent.Image), LRNStudent.Text, Grade, Section, "", "", PhoneNumberStudent.Text, this.Tag.ToString(), dt_TimeIN.Text + "/" + dt_TimeOUT.Text, txtGuardiansName.Text, txtAdviser.Text, course, txtGradeOther.Text, txtSectionOther.Text); MessageBox.Show("Changes Successfully saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); fmain.getAccounts("%"); this.Close(); } } }
void UserSave() { if (cmd_save.Text == "&Save") { int i = db.sp_checkUsername(txt_username.Text).Count(); if (i >= 1) { MessageBox.Show("Username already exist!", Tool.Systemname, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { //if (rbUser.Checked == true) //{ string level = ((this.cbo_level.SelectedItem as ComboBoxItem).Value.ToString()); db.sp_InsertUser(txt_fname.Text, txt_MName.Text, txt_Lname.Text, txt_username.Text, level, txt_username.Text, Tool.Encrypt(txt_password.Text), new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), "", Tool.ImageToByte(pbUser.Image), "", "0", "0", "", "", PhoneNumberStudent.Text, "", "", "", "", "", "", "", "", ""); //} //else //{ //string Grade = ((cboGrade.SelectedItem as ComboBoxItem).Value.ToString()); //string Section = ((cboSection.SelectedItem as ComboBoxItem).Value.ToString()); //db.sp_InsertUser(FirstNameStudent.Text, MiddleNameStudent.Text, LastNameStudent.Text, "", "3", "", "", new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), txtRfidId.Text, Tool.ImageToByte(pbStudent.Image), LRNStudent.Text, Grade, Section, "", ""); //} MessageBox.Show("Changes Successfully saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); fmain.getAccounts("%"); FingerPrintScanner.FingerprintTemplate = null; this.Close(); } } else { string level = ((this.cbo_level.SelectedItem as ComboBoxItem).Value.ToString()); db.sp_UpdateUser(txt_fname.Text, txt_MName.Text, txt_Lname.Text, txt_username.Text, level, txt_username.Text, Tool.Encrypt(txt_password.Text), new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), "", Tool.ImageToByte(pbUser.Image), "", "0", "0", "", "", PhoneNumberStudent.Text, this.Tag.ToString(), "", txtGuardiansName.Text, "", "", "", ""); MessageBox.Show("Changes Successfully saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); fmain.getAccounts("%"); this.Close(); } }
void StudentSave() { string Grade = ((cboGrade.SelectedItem as ComboBoxItem).Value.ToString()); string Section = ((cboSection.SelectedItem as ComboBoxItem).Value.ToString()); string[] g = Grade.Split('/'); Grade = g[0]; if (cmd_save.Text == "&Save") { db.sp_InsertUser(FirstNameStudent.Text, MiddleNameStudent.Text, LastNameStudent.Text, "", "3", "", "", new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), txtQrCode.Text, Tool.ImageToByte(pbStudent.Image), LRNStudent.Text, Grade, Section, "", "", PhoneNumberStudent.Text, dtBirthDate.Text, txtStrand.Text, txtSy.Text, txtGuardiansName.Text, dt_TimeIN.Text + "/" + dt_TimeOUT.Text, txtAdviser.Text); MessageBox.Show("Changes Successfully saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); fmain.getAccounts("%"); FingerPrintScanner.FingerprintTemplate = null; this.Close(); // } else { string level = ((this.cbo_level.SelectedItem as ComboBoxItem).Value.ToString()); db.sp_UpdateUser(FirstNameStudent.Text, MiddleNameStudent.Text, LastNameStudent.Text, "", "3", "", "", new System.Data.Linq.Binary(FingerPrintScanner.FingerprintTemplate), txtQrCode.Text, Tool.ImageToByte(pbStudent.Image), LRNStudent.Text, Grade, Section, "", "", PhoneNumberStudent.Text, this.Tag.ToString(), dt_TimeIN.Text + "/" + dt_TimeOUT.Text, txtGuardiansName.Text, txtAdviser.Text); MessageBox.Show("Changes Successfully saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); fmain.getAccounts("%"); this.Close(); } }