public AdminChildCheckIn()
 {
     InitializeComponent();
     this.db = new ConnectionsDB();
     txt_SearchBox.Focus();
     SetupEvents();
 }
        private void btn_AddChild_Click(object sender, RoutedEventArgs e)
        {
            EnableForm();
            int           maxID = this.db.GetMaxChildID();
            ConnectionsDB conDB = new ConnectionsDB();

            maxID = maxID + 1;
            string mID = string.Format("{0:000000}", maxID);

            Image i; //string test = "C:/Users/Public/Documents";

            i = buildImage("C:/Users/Public/Documents" + "/Childcare Application/Pictures/default.jpg", 60);
            lst_ChildBox.Items.Add(new Child(mID, "First", "Last", i, "2005/01/01", "None", "None", "C:/Users/Public/Documents" + "/Childcare Application/Pictures/default.jpg")); //TAG: pictures access

            int connID = this.db.GetMaxConnectionID();

            connID = connID + 1;
            string connectionID = string.Format("{0:000000}", connID);

            string famID = GetFamilyID(ID);

            this.db.AddNewChild(mID, "First", "Last", "2005-01-01", "None", "None", "C:/Users/Public/Documents" + "/Childcare Application/Pictures/default.jpg"); //TAG: pictures access

            conDB.UpdateAllowedConnections(connectionID, ID, mID, famID);

            lst_ChildBox.Items.Clear();
            setChildBox();
            lst_ChildBox.SelectedItem = lst_ChildBox.Items[lst_ChildBox.Items.Count - 1];
            txt_FirstName.Focus();
        }
 public TransactionCharge(String guardianID, String allowanceID)
 {
     this.settings    = new GuardianToolsSettings();
     this.guardianID  = guardianID;
     this.allowanceID = allowanceID;
     this.db          = new ConnectionsDB();
 }
        private void btn_Enter_Click(object sender, RoutedEventArgs e)
        {
            ConnectionsDB  conDB = new ConnectionsDB();
            GuardianInfoDB gdb = new GuardianInfoDB();
            string         fID = "", pID = "";
            bool           formNotComplete = CheckIfNull();

            if (!formNotComplete)//form is completed
            {
                bool sameID  = CheckIfSame(txt_GuardianID.Text, txt_GuardianID2.Text);
                bool regexID = RegExpressions.RegexID(txt_GuardianID.Text);
                if (sameID && regexID)//both IDand PIN are the same vlues
                {
                    pID = txt_GuardianID.Text;

                    MakeFamilyID(pID);
                    if (linked == 0)  //link child

                    {
                        int connID = this.db.GetMaxConnectionID();
                        connID = connID + 1;

                        string connectionID = string.Format("{0:000000}", connID);
                        fID = MakeFamilyID(pID);
                        bool guardianExists = false;
                        guardianExists = gdb.GuardianNotDeletedAndExists(pID);
                        if (guardianExists)
                        {
                            conDB.UpdateAllowedConnections(connectionID, pID, childID, fID);
                        }
                        else
                        {
                            WPFMessageBox.Show("Guardian with ID: " + pID + " does not exist.");
                        }
                    }
                    else if (linked == 1)    //delink child
                    {
                        bool connExists     = conDB.ConnectionExists(pID, childID);
                        bool guardianExists = gdb.GuardianNotDeletedAndExists(pID);
                        if (connExists && guardianExists)
                        {
                            conDB.DeleteAllowedConnection(childID, pID);
                        }

                        else
                        {
                            WPFMessageBox.Show("No connection to the Guardian with ID: " + pID + " exists or no Guardian with that ID exists.");
                        }
                    }
                    this.Close();
                }
            }
        }
        private void ReadyTransaction(object sender, RoutedEventArgs e)
        {
            TransactionDB     transDB  = new TransactionDB();
            ConnectionsDB     conDB    = new ConnectionsDB();
            ChildInfoDatabase childDB  = new ChildInfoDatabase();
            GuardianInfoDB    parentDB = new GuardianInfoDB();

            if (parentDB.GuardianNameExists(txt_GuardianName.Text) && childDB.ChildNameExists(txt_ChildName.Text))
            {
                SetAllowanceID();
                this.transaction = new TransactionCharge(conDB.GetGuardianID(allowanceID), allowanceID);
                CalculateTransaction(sender, e);
            }
        }
Ejemplo n.º 6
0
 public ChildLogin(string ID)
 {
     InitializeComponent();
     this.WindowState = WindowState.Maximized;
     this.guardianID  = ID;
     this.db          = new ConnectionsDB();
     SetUpCheckInBox();
     SetUpParentDisplay();
     EventsSetup();
     this.updateTime                = new DateTime();
     updateTime                     = DateTime.Now;
     lbl_Time.DataContext           = updateTime;
     this.lst_CheckInBox.GotFocus  += listBoxFocus;
     this.lst_CheckOutBox.GotFocus += listBoxFocus;
     this.MouseDown                += WindowMouseDown;
 }
        private void LoadGrid()
        {
            ConnectionsDB conDB = new ConnectionsDB();
            DataTable     table = new DataTable();

            string[] guardianName = new string[2]; //[first, last]

            table.Columns.Add("First Name", typeof(string));
            table.Columns.Add("Last Name", typeof(string));
            table.Columns.Add("Allowance ID", typeof(string));

            for (int i = 0; i < this.allowanceIDs.Count; i++)
            {
                guardianName = conDB.GetGuardianName(allowanceIDs[i]);
                table.Rows.Add(guardianName[0], guardianName[1], allowanceIDs[i]);
            }
            this.dta_GuardianList.ItemsSource = table.DefaultView;
        }
 private void btn_Delete_Click(object sender, RoutedEventArgs e)
 {
     if (lst_ChildBox.SelectedItem != null)
     {
         MessageBoxResult messageBoxResult = WPFMessageBox.Show("Are you sure you wish to delete this person?", "Deletion Conformation", MessageBoxButton.YesNo);
         if (messageBoxResult == MessageBoxResult.Yes)
         {
             ConnectionsDB conDB = new ConnectionsDB();
             string        cID   = ((Child)(lst_ChildBox.SelectedItem)).ID;
             string        pID   = txt_IDNumber.Text;
             this.db.DeleteChildInfo(cID);
             conDB.DeleteAllowedConnection(cID, pID);
             lst_ChildBox.Items.Clear();
             setChildBox();
             ClearFields();
         }
     }
 }
        private void LoadData()
        {
            ChildInfoDatabase childDB  = new ChildInfoDatabase();
            TransactionDB     transDB  = new TransactionDB();
            GuardianInfoDB    parentDB = new GuardianInfoDB();
            ConnectionsDB     conDB    = new ConnectionsDB();

            this.txt_ChildName.Text        = childDB.GetChildName(this.transactionID);
            this.txt_GuardianName.Text     = transDB.GetParentNameFromTrans(this.transactionID);
            this.originalFee               = transDB.GetTransactionTotal(this.transactionID);
            this.txt_TransactionTotal.Text = String.Format("{0:0.00}", transDB.GetTransactionTotal(this.transactionID));
            this.originalEventName         = transDB.GetTransEventName(this.transactionID);
            string eventName = this.originalEventName;

            LoadEventCMB(eventName);
            this.txt_CheckIn.Text  = transDB.GetTwelveHourTime(this.transactionID, "CheckedIn");
            this.txt_CheckOut.Text = transDB.GetTwelveHourTime(this.transactionID, "CheckedOut");
            this.txt_Date.Text     = transDB.GetTransactionDate(this.transactionID);
            this.transaction       = new TransactionCharge(transDB.GetGuardianIDFromTrans(this.transactionID), conDB.GetAllowanceID(this.transactionID));
        }
        private void SetAllowanceID()
        {
            if (this.allowanceID == null || this.txt_GuardianName.Text.CompareTo(guardianName) != 0 || this.txt_ChildName.Text.CompareTo(childName) != 0)
            {
                this.guardianName = this.txt_GuardianName.Text;
                this.childName    = this.txt_ChildName.Text;
                ConnectionsDB conDB        = new ConnectionsDB();
                List <string> allowanceIDs = conDB.GetAllowanceIDsOnNames(txt_GuardianName.Text, txt_ChildName.Text);

                if (allowanceIDs.Count > 1)
                {
                    SelectGuardian selectGuardian = new SelectGuardian(allowanceIDs, this);
                    selectGuardian.ShowDialog();
                }
                else
                {
                    this.allowanceID = allowanceIDs[0];
                }
            }
        }
        private void lst_Guardians_IndexChange(object sender, System.EventArgs e)
        {
            if (dta_GuardianList.SelectedItem != null)
            {
                GuardianInfoDB parentDB     = new GuardianInfoDB();
                ConnectionsDB  conDB        = new ConnectionsDB();
                String         allowanceID  = "";
                DataRowView    selectedFile = (DataRowView)dta_GuardianList.SelectedItem;
                allowanceID = Convert.ToString(selectedFile.Row.ItemArray[2]);

                this.guardianID = conDB.GetGuardianID(allowanceID);
                string imageLink = parentDB.GetGuardianImagePath(this.guardianID);
                if (imageLink != null)
                {
                    ImageBrush ib = new ImageBrush();
                    ib.ImageSource             = new BitmapImage(new Uri(imageLink, UriKind.Relative));
                    cnv_GuardianPic.Background = ib;
                    cnv_GuardianPic.Visibility = System.Windows.Visibility.Visible;
                }
            }
        }