private void DisplayAdminEditParentWindow(string ID)
        {
            AdminEditParentInfo AdminEditParentWindow = new AdminEditParentInfo(ID);

            AdminEditParentWindow.Show();
            this.Close();
        }//end DisplayAdminEditParentWindow
        private void btn_AddNewParent_Click(object sender, RoutedEventArgs e)
        {
            string pID = "", PIN = "";
            bool   formNotComplete = CheckIfNull();

            if (!formNotComplete)
            {
                bool sameID  = CheckIfSame(txt_ParentID1.Text, txt_ParentID2.Text);
                bool samePIN = CheckIfSame(psw_ParentPIN1.Password, psw_ParentPIN2.Password);

                bool regexID  = RegExpressions.RegexID(txt_ParentID1.Text);
                bool regexPIN = RegExpressions.RegexPIN(psw_ParentPIN1.Password);

                if (sameID && samePIN && regexID && regexPIN)
                {
                    pID = string.Format("{0:000000}", txt_ParentID1.Text);
                    PIN = string.Format("{0:0000}", psw_ParentPIN1.Password);
                    DataSet DS = new DataSet();
                    DS = this.db.GetParentInfoDS(pID);
                    int count = DS.Tables[0].Rows.Count;

                    if (count == 0)
                    {
                        string hashedPIN = ChildcareApplication.AdminTools.Hashing.HashPass(PIN);
                        hashedPIN = "\"" + hashedPIN + "\"";
                        this.db.AddNewParent(pID, hashedPIN, "\"First\"", "\"Last\"", "\"000-000-0000\"", "\"[email protected]\"", "\"123 Road St\"", "\"none\"", "\"City\"", "\"WA\"", "\"12345\"", "'" + "C:\\Users\\Public\\Documents" + "\\Childcare Application\\Pictures\\default.jpg'"); //TAG: pictures access
                        MakeFamilyID(pID);
                        try {
                            AdminEditParentInfo adminEditParentInfo = new AdminEditParentInfo(pID);
                            adminEditParentInfo.Show();
                        }catch (System.IO.DirectoryNotFoundException err)
                        {
                            WPFMessageBox.Show(err.ToString());
                        }
                        this.Close();
                    }
                    else
                    {
                        WPFMessageBox.Show("A Guardian with this ID already Exists. Please re-enter your ID");
                    }
                }
            }
        }
示例#3
0
        private void btn_AddNewParent_Click(object sender, RoutedEventArgs e)
        {
            string pID = "", PIN = "";
            bool   formNotComplete = CheckIfNull();

            if (!formNotComplete)//form is completed
            {
                bool sameID  = checkIfSame(txt_ParentID1.Text, txt_ParentID2.Text);
                bool samePIN = checkIfSame(psw_ParentPIN1.Password, psw_ParentPIN2.Password);
                if (sameID && samePIN)//both IDand PIN are the same vlues
                {
                    bool numbersID  = checkIfNumbers(txt_ParentID1.Text, txt_ParentID2.Text);
                    bool numbersPIN = checkIfNumbers(psw_ParentPIN1.Password, psw_ParentPIN2.Password);
                    if (numbersID && numbersPIN)//both ID and PIN are numbers
                    {
                        pID = txt_ParentID1.Text;
                        PIN = psw_ParentPIN1.Password;
                        DataSet DS = new DataSet();
                        DS = this.db.GetParentInfo(pID);
                        int count = DS.Tables[0].Rows.Count;

                        if (count == 0)//ID does not exist
                        {
                            this.db.AddNewParent(pID, PIN, "\"First\"", "\"Last\"", "\"000-000-0000\"", "\"[email protected]\"", "\"123 Road St\"", "\"none\"", "\"City\"", "\"WA\"", "\"12345\"", "\"../../Pictures/default.jpg\"");
                            MakeFamilyID(pID);
                            //MessageBox.Show("Made New Parent");

                            AdminEditParentInfo adminEditParentInfo = new AdminEditParentInfo(pID);
                            adminEditParentInfo.Show();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("A Guardian with this ID already Exists. Please re-enter your ID");
                        }
                    }
                }
            }
        }