protected void bthnoteok_Click(object sender, EventArgs e) { UserScanDAO userscan = new UserScanDAO(); int memberuserid = Convert.ToInt32(this.DecryptQueryString("userid").ToString()); DataTable dt = userscan.GetUserScanByIDMember(memberuserid); if (dt.Rows.Count > 0) { if (txtcomment.Text.Trim() != "") { string datetimeup = dt.Rows[0]["datetime_up"].ToString(); string datetimedown = dt.Rows[0]["datetime_down"].ToString(); if (datetimeup == "ยังไม่ได้สแกน") { if (chkup.Checked == true) { userscan.UpdateUserScanByIDMember_Up(memberuserid, txtcomment.Text.Trim()); userscan.UpdateUserScanByIDMember_Noteup(memberuserid, 1); } } if (datetimedown == "ยังไม่ได้สแกน") { if (chkdown.Checked == true) { userscan.UpdateUserScanByIDMember_Down(memberuserid, txtcomment.Text.Trim()); userscan.UpdateUserScanByIDMember_Notedown(memberuserid, 1); } } } } }
public void client_MqttMsgPublishRecieved_GetSubscribe(object sender, MqttMsgPublishEventArgs e) { UserScanDAO userscan = new UserScanDAO(); string trunscan = ViewState["trunscan"].ToString(); if (trunscan == "ขึ้นรถรับส่งเด็กนักเรียน") { string fingerprintid = Encoding.UTF8.GetString(e.Message); if (fingerprintid == "disconnect") { Debug.WriteLine("Received = " + fingerprintid + "\ron topic = " + e.Topic + "\rtrunscan = " + trunscan + datetime()); client_scan.Disconnect(); } else if (fingerprintid == "fail") { Debug.WriteLine("Disconnect"); client_scan.Disconnect(); Timer = true; } else { int memberuserid = Convert.ToInt32(fingerprintid); Debug.WriteLine("Received = " + fingerprintid + "\ron topic = " + e.Topic + "\rtrunscan = " + trunscan + datetime()); userscan.UpdateUserScanByIDMember_Noteup(memberuserid, 0); userscan.UpdateUserScanByIDMember_Up(memberuserid, datetime()); //userscan.UpdateUserScanByFingerprintid_Up(fingerprintid, DateTime.Now.ToString("dd-MM-yyyy เวลา HH:mm:ss")); Debug.WriteLine("OKScanup"); client_scan.Disconnect(); Timer = true; } } if (trunscan == "ลงรถรับส่งเด็กนักเรียน") { string fingerprintid = Encoding.UTF8.GetString(e.Message); if (fingerprintid == "disconnect") { Debug.WriteLine("Received = " + fingerprintid + "\ron topic = " + e.Topic + "\rtrunscan = " + trunscan + datetime()); client_scan.Disconnect(); Timer = true; } else if (fingerprintid == "fail") { Debug.WriteLine("Disconnect"); client_scan.Disconnect(); Timer = true; } else { int memberuserid = Convert.ToInt32(fingerprintid); Debug.WriteLine("Received = " + fingerprintid + "\ron topic = " + e.Topic + "\rtrunscan = " + trunscan + datetime()); userscan.UpdateUserScanByIDMember_Notedown(memberuserid, 0); userscan.UpdateUserScanByIDMember_Down(memberuserid, datetime()); //userscan.UpdateUserScanByFingerprintid_Down(fingerprintid, DateTime.Now.ToString("dd-MM-yyyy เวลา HH:mm:ss")); Debug.WriteLine("OKScanDown"); client_scan.Disconnect(); Timer = true; } } }