Fixed numerous bugs and added function to convert bitmap images to Image data type. Need to work on sql retention to have web-cam images show up.
This commit is contained in:
parent
d90a4fd64e
commit
d98547c786
96
GenerateMockData.sql
Normal file
96
GenerateMockData.sql
Normal file
@ -0,0 +1,96 @@
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k1_FirstName','k1_LastName','1/1/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k2_FirstName','k2_LastName','1/2/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k3_FirstName','k3_LastName','1/3/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k4_FirstName','k4_LastName','1/4/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k5_FirstName','k5_LastName','1/5/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k6_FirstName','k6_LastName','1/6/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k7_FirstName','k7_LastName','1/7/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k8_FirstName','k8_LastName','1/8/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k9_FirstName','k9_LastName','1/9/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k10_FirstName','k10_LastName','1/10/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k11_FirstName','k11_LastName','1/11/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k12_FirstName','k12_LastName','1/12/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k13_FirstName','k13_LastName','1/13/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k14_FirstName','k14_LastName','1/14/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k15_FirstName','k15_LastName','1/15/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k16_FirstName','k16_LastName','1/16/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k17_FirstName','k17_LastName','1/17/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k18_FirstName','k18_LastName','1/18/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k19_FirstName','k19_LastName','1/19/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k20_FirstName','k20_LastName','1/20/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k21_FirstName','k21_LastName','1/21/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k22_FirstName','k22_LastName','1/22/2021','123 Fake Street','White','Male');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k23_FirstName','k23_LastName','1/23/2021','123 Fake Street','White','Female');
|
||||
INSERT INTO Children(FirstName,LastName,DOB,address,race,gender) VALUES ('k24_FirstName','k24_LastName','1/24/2021','123 Fake Street','White','Male');
|
||||
|
||||
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber,isAdmin) VALUES ('Main','Admin',1000000000,'main@admin.com','9999',1);
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G1_FirstName','G1_LastName',1000000001,'G1@email.com','0001');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G2_FirstName','G2_LastName',1000000002,'G2@email.com','0002');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G3_FirstName','G3_LastName',1000000003,'G3@email.com','0003');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G4_FirstName','G4_LastName',1000000004,'G4@email.com','0004');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G5_FirstName','G5_LastName',1000000005,'G5@email.com','0005');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G6_FirstName','G6_LastName',1000000006,'G6@email.com','0006');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G7_FirstName','G7_LastName',1000000007,'G7@email.com','0007');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G8_FirstName','G8_LastName',1000000008,'G8@email.com','0008');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G9_FirstName','G9_LastName',1000000009,'G9@email.com','0009');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G10_FirstName','G10_LastName',1000000010,'G10@email.com','0010');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G11_FirstName','G11_LastName',1000000011,'G11@email.com','0011');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G12_FirstName','G12_LastName',1000000012,'G12@email.com','0012');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G13_FirstName','G13_LastName',1000000013,'G13@email.com','0013');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G14_FirstName','G14_LastName',1000000014,'G14@email.com','0014');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G15_FirstName','G15_LastName',1000000015,'G15@email.com','0015');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G16_FirstName','G16_LastName',1000000016,'G16@email.com','0016');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G17_FirstName','G17_LastName',1000000017,'G17@email.com','0017');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G18_FirstName','G18_LastName',1000000018,'G18@email.com','0018');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G19_FirstName','G19_LastName',1000000019,'G19@email.com','0019');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G20_FirstName','G20_LastName',1000000020,'G20@email.com','0020');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G21_FirstName','G21_LastName',1000000021,'G21@email.com','0021');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G22_FirstName','G22_LastName',1000000022,'G22@email.com','0022');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G23_FirstName','G23_LastName',1000000023,'G23@email.com','0023');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G24_FirstName','G24_LastName',1000000024,'G24@email.com','0024');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G25_FirstName','G25_LastName',1000000025,'G25@email.com','0025');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G26_FirstName','G26_LastName',1000000026,'G26@email.com','0026');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G27_FirstName','G27_LastName',1000000027,'G27@email.com','0027');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G28_FirstName','G28_LastName',1000000028,'G28@email.com','0028');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G29_FirstName','G29_LastName',1000000029,'G29@email.com','0029');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G30_FirstName','G30_LastName',1000000030,'G30@email.com','0030');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G31_FirstName','G31_LastName',1000000031,'G31@email.com','0031');
|
||||
INSERT INTO Guardians(FirstName,LastName,PhoneNumber,EmailAddress,PinNumber) VALUES ('G32_FirstName','G32_LastName',1000000032,'G32@email.com','0032');
|
||||
|
||||
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (1,2);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (2,3);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (2,4);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (3,5);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (3,6);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (3,7);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (3,8);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (4,9);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (4,10);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (4,11);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (4,12);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (5,13);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (6,14);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (7,15);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (8,16);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (9,17);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (10,18);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (11,19);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (12,20);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (13,21);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (14,22);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (15,23);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (16,24);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (17,25);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (18,26);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (19,27);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (20,28);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (21,29);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (22,30);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (23,31);
|
||||
INSERT INTO Authorized_Guardians(child_id, guardian_id) VALUES (24,32);
|
||||
|
||||
INSERT INTO Attendence(child_id, guardian_id,in_out) VALUES (1,2,"in");
|
||||
INSERT INTO Attendence(child_id, guardian_id,in_out) VALUES (2,2,"out");
|
||||
INSERT INTO Attendence(child_id, guardian_id,in_out) VALUES (3,1,"out");
|
@ -16,7 +16,7 @@ namespace GreatHomeChildcare
|
||||
Child child;
|
||||
VideoCapture capture;
|
||||
Mat frame;
|
||||
Bitmap image;
|
||||
Image image;
|
||||
private Thread camera;
|
||||
bool isCameraRunning = false;
|
||||
private void CaptureCamera()
|
||||
@ -46,9 +46,10 @@ namespace GreatHomeChildcare
|
||||
}
|
||||
}
|
||||
|
||||
public SnapShotWin()
|
||||
public SnapShotWin(int id)
|
||||
{
|
||||
InitializeComponent();
|
||||
child = SqliteDataAccess.GetChildByID(id);
|
||||
}
|
||||
|
||||
|
||||
@ -72,17 +73,29 @@ namespace GreatHomeChildcare
|
||||
{
|
||||
if (isCameraRunning)
|
||||
{
|
||||
byte[] pic_in;
|
||||
Bitmap snapshot = new Bitmap(pictureBox1.Image);
|
||||
byte[] pic_in = BitmapToByte(snapshot);
|
||||
try
|
||||
{
|
||||
Image image = (Image)snapshot;
|
||||
ImageConverter _imageConverter = new ImageConverter();
|
||||
pic_in = (byte[])_imageConverter.ConvertTo(snapshot, typeof(byte[]));
|
||||
} catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show("Unable to picture. Try again.", "Great Home Childcare", MessageBoxButtons.OK, MessageBoxIcon.None);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
child.id = child.id;
|
||||
child.address = child.address;
|
||||
child.DOB = child.DOB;
|
||||
child.FirstName = child.FirstName;
|
||||
child.gender = child.gender;
|
||||
child.LastName = child.LastName;
|
||||
child.race = child.race;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show("This child has not been created yet. Save the child first and then come back.", "Great Home Childcare", MessageBoxButtons.OK, MessageBoxIcon.None);
|
||||
return;
|
||||
}
|
||||
child.photo = pic_in;
|
||||
SqliteDataAccess.UpdateChild(child);
|
||||
SqliteDataAccess.AddWebCamPhoto(child);
|
||||
isCameraRunning = false;
|
||||
Close();
|
||||
}
|
||||
|
@ -108,6 +108,20 @@ namespace GreatHomeChildcare
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddWebCamPhoto(Child child)
|
||||
{
|
||||
using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
|
||||
{
|
||||
string strQuery = "UPDATE Children SET photo = @_photo WHERE id = @_id;";
|
||||
|
||||
cnn.Execute(strQuery, new
|
||||
{
|
||||
_id = child.id,
|
||||
_photo = child.photo
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ***************** Delete *****************
|
||||
|
||||
/* Deletes a child from the database.
|
||||
|
@ -170,12 +170,16 @@ namespace GreatHomeChildcare
|
||||
private void btnPhotoFromCam_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
MessageBox.Show("From cam");
|
||||
// MessageBox.Show("From cam");
|
||||
int child_id = frmAdminForm.child_id;
|
||||
SnapShotWin openWebCam = new SnapShotWin(child_id);
|
||||
openWebCam.Show();
|
||||
photoPictureBox.Tag = CUSTOM_PIC_TAG;
|
||||
return;
|
||||
|
||||
//TED: Be sure you set this somewhere along the way
|
||||
//after you wrangle the damn camera.
|
||||
photoPictureBox.Tag = CUSTOM_PIC_TAG;
|
||||
|
||||
}
|
||||
|
||||
/* On click of the button, open a file picker dialog box
|
||||
|
Loading…
Reference in New Issue
Block a user