Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        public void getDetails(string cn)
        {
            rbStudent.Visible = false;
            rbUser.Visible    = false;


            DataClasses1DataContext db = new DataClasses1DataContext(Tool.ConnectionString);
            var i = db.AccountSelectByID(this.Tag.ToString()).FirstOrDefault();

            if (!i.Level_cn.Equals(3))
            {
                wizard1.SelectedTab = tabPage3;

                txt_fname.Text    = i.Firstname;
                txt_MName.Text    = i.Middlename;
                txt_Lname.Text    = i.Lastname;
                txt_username.Text = i.Email;
                cbo_level.Tag     = i.Level_cn;
                txt_username.Text = i.Email;



                try
                {
                    DateTime Bd = i.BirrthDate.Value;
                    dtBirthDate.Text = Bd.ToShortDateString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                txtSy.Text     = i.SchoolYear;
                txtStrand.Text = i.Strand;

                txtGuardiansName.Text = i.GuardianName;



                txt_password.Text = EncodeString.Decrypt(i.Password);
                try
                {
                    pbUser.Image = Tool.bytetoimage(i.AVATAR.ToArray());
                }
                catch (Exception)
                {
                    pbUser.Image = Properties.Resources.AnonymousPic;
                }

                try
                {
                    FingerPrintScanner.FingerprintTemplate = i.biometrics.ToArray();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                wizard1.SelectedTab     = tabPage4;
                FirstNameStudent.Text   = i.Firstname;
                MiddleNameStudent.Text  = i.Middlename;
                LastNameStudent.Text    = i.Lastname;
                LRNStudent.Text         = i.LRN;
                txtQrCode.Text          = i.RFID;
                cboGrade.Text           = i.GradeName;
                PhoneNumberStudent.Text = i.PhoneNo;
                cboSection.Text         = i.Section_;
                txtGuardiansName.Text   = i.GuardianName;
                string   schedule        = i.Schedule;
                string[] scheduleSplited = schedule.Split('/');
                dt_TimeIN.Text  = scheduleSplited[0];
                dt_TimeOUT.Text = scheduleSplited[1];
                txtAdviser.Text = i.Adviser;
                try
                {
                    pbStudent.Image = Tool.bytetoimage(i.AVATAR.ToArray());
                }
                catch (Exception)
                {
                    pbStudent.Image = Properties.Resources.AnonymousPic;
                }

                try
                {
                    FingerPrintScanner.FingerprintTemplate = i.biometrics.ToArray();
                }
                catch (Exception)
                {
                }
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }