当前位置: 首页>>代码示例>>C#>>正文


C# Connector.ExecuteQuery方法代码示例

本文整理汇总了C#中Connector.ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.ExecuteQuery方法的具体用法?C# Connector.ExecuteQuery怎么用?C# Connector.ExecuteQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connector的用法示例。


在下文中一共展示了Connector.ExecuteQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateCheckin2

        private bool ValidateCheckin2(string BarCode, out string kidid)
        {
            string kid = js.Lookup("fldID", "tblKids", "fldStudentID='" + BarCode + "'");
            string id = "";
             if (kid=="")
             {
                 Connector con  =  new Connector(KIDS_CheckIn_System.Properties.Settings.Default.Server,"Kids_Checkin","kidschurch","[email protected]");
                 kid = con.Lookup("fldID", "tblKids", "fldStudentID='" + BarCode + "'");

                 //UPDATE Local Database;

                 string qry = "SELECT * FROM tblKids WHERE fldID='" + kid + "'";

                 con.ExecuteQuery(qry);

                 con.RiD.Read();

                 string studentID = "";
                 string firstname = "";
                 string lastname = "";
                 string middle = "";
                 string nickname = "";
                 string birthday = "";
                 string church = "";
                 string picture = "";
                 string nationality = "";
                 string gender = "";
                 string allergies = "";
                 string fldFirstName = "";
                 string fldLastName = "";
                 string fldRelationship = "";
                 string fldPicture = "";
                 string fldEmail = "";

                 if(con.RiD.HasRows)
                 {
                     studentID = "" + con.RiD["fldStudentID"];
                     firstname = "" + con.RiD["fldFirstName"];
                     lastname = "" + con.RiD["fldLastName"];
                     middle = "" + con.RiD["fldMiddleName"];
                     nickname = "" + con.RiD["fldNickName"];
                     birthday = "" + con.RiD["fldBirthday"];
                     church = "" + con.RiD["fldChurch"];
                     picture = "" + con.RiD["fldPicture"];
                     nationality = "" + con.RiD["fldNationality"];
                     gender = "" + con.RiD["fldGender"];
                     allergies = "" + con.RiD["fldAllergies"];

                 }

                 string fID = con.Lookup("fldFetcherID", "tblKidFetcher", "fldKidID='" + kid + "'");

                 qry = "SELECT * FROM tblFetcher WHERE fldID='" + fID + "'";

                 con.ExecuteQuery(qry);

                 con.RiD.Read();

                 if(con.RiD.HasRows)
                 {
                      fldFirstName = "" + con.RiD["fldFirstName"];
                      fldLastName = "" + con.RiD["fldLastName"];
                      fldRelationship = "" + con.RiD["fldRelationship"];
                      fldPicture = "" + con.RiD["fldPicture"];
                      fldEmail = "" + con.RiD["fldEmail"];
                 }

                 js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

                 string qry1 = "INSERT INTO tblKids(fldStudentID,fldFirstName,fldLastName,fldNickName,fldBirthday,fldChurch,fldPicture,fldNationality,fldGender,fldAllergies) VALUES('" +
                        studentID + "','" + firstname + "','" + lastname + "','" + nickname + "','" + birthday + "','" + church + "','" + picture + "','" + nationality + "','" + gender + "','" + allergies + "')" ;

                 js.ExecuteNonQuery(qry1);

                 string kcID = js.Lookup("fldID", "tblKids", "fldStudentID='" + studentID + "'");

                 string qry2 = "INSERT INTO tblFetcher(fldFirstName,fldLastName,fldRelationship,fldPicture,fldEmail) VALUES('" +
                        fldFirstName + "','" + fldLastName + "','" + fldRelationship + "','" + fldPicture + "','" + fldEmail + "')";

                 js.ExecuteNonQuery(qry2);

                 string fetcher = js.Lookup("fldID", "tblFetcher", "fldPicture='" + fldPicture + "' AND fldLastName='" + fldLastName + "'");

                 string qry3 = "INSERT INTO tblKidFetcher(fldKidID,fldFetcherID) VALUES('" + kcID + "','" + fetcher + "')";

                 js.ExecuteNonQuery(qry3);

                 kid = kcID;

                 pbLoading.Visible = true;
                 if (Properties.Settings.Default.PairedDevices != "")
                 {
                     string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));

                     if (devices[0] == "")
                     {
                         string device = Properties.Settings.Default.PairedDevices;

                         string[] properties = device.Split(char.Parse("|"));

//.........这里部分代码省略.........
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:101,代码来源:frmLogin.cs

示例2: frmLogin_Load

        private void frmLogin_Load(object sender, EventArgs e)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin","kidschurch","[email protected]");

            icon.Icon = new Icon(Application.StartupPath + @"\kids-icon.ico");
            icon.Visible = true;

            txtRoom.Text = this.Tag.ToString();

            lblConnected.Text = "Connected To: " + AccessRegistryTool.ReadValue("DBServer");

            fldRoomID = js.Lookup("fldID", "tblRoom", "fldRoom='" + txtRoom.Text + "'");

            string eID = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");

            lblTotal.Text = js.Lookup("fldMaxCapacity", "tblCustomizedEventRooms", "fldRoomID='" + fldRoomID + "' AND fldCEventID='" + eID + "'");

            txtAge1.Text = js.Lookup("fldAgeFrom", "tblCustomizedEventRooms", "fldRoomID='" + fldRoomID + "' AND fldCEventID='" + eID + "'");
            txtAge2.Text = js.Lookup("fldAgeTo", "tblCustomizedEventRooms", "fldRoomID='" + fldRoomID + "' AND fldCEventID='" + eID + "'");

            fldGroupID = js.Lookup("fldID","tblGroup","fldAgeFrom='" + txtAge1.Text + "' AND fldAgeTo='" + txtAge2.Text + "'");

            if(Convert.ToInt32(txtAge1.Text)< 7)
            {
                btnAddPoints.Enabled = false;
            }

            string timetoday = DateTime.Now.ToString("hh:mm tt");

            string q = "SELECT * FROM tblEvent WHERE fldRegistrationTime <= convert(time,'" + timetoday + "') AND fldEndTime >=convert(time,'" + timetoday + "')";

            js.ExecuteQuery(q);

            js.RiD.Read();

            lblNotification.Text = "";

            if (js.RiD.HasRows)
            {
                fldEventID = "" + js.RiD["fldID"].ToString();

                txtService.Text = js.RiD["fldEventTitle"].ToString();

                LoadAttendance();
                LoadBirthdays();
                LoadNewComer();
                LoadVolunteer();
                dgvAttendance_CellContentClick(null,null);
            }
            else
            {
                js.showExclamation("Cannot open an event yet!, Please try again later");
                frmSystemOptions frm = new frmSystemOptions();
                frm.Show();
                Close();
                return;
            }

            js.CloseConnection();

            StartReader();

            string mode = AccessRegistryTool.ReadValue("RegMode");

            if(mode=="Barcode")
            {
                tmrReader.Enabled = false;
                //rbBarcode_CheckedChanged(null, null);

            }
            else
            {
                tmrReader.Enabled = true;
            }

            //this.BackgroundImage = Image.FromFile(Application.StartupPath + "/Pictures/kids back.jpg");
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:77,代码来源:frmLogin.cs

示例3: tmrReader_Tick

        private void tmrReader_Tick(object sender, EventArgs e)
        {
            retCode = CardConnect(1);

            if (retCode != ModWinsCard.SCARD_S_SUCCESS)
            {

                //displayOut(5, 0, "No card within range.");
                //tsMsg2.Text = "";
                return;

            }

            //CheckCard();

            if (CheckCard())
            {

                //displayOut(5, 0, "Card is detected.");

                getParam();

                string tmpStr = "";
                int indx;

                for (indx = 0; indx <= RecvLen - 3; indx++)
                {

                    tmpStr = tmpStr + string.Format("{0:X2}", RecvBuff[indx]);

                }

                //tmrReader.Enabled = false;

                string kidid;
                string value;

                if (rbCheckin.Checked)
                {

                    string str = tmpStr.Substring(0, 8);

                    if(str=="00000000")
                    {
                        lblNotification.Text = "Please Try Again";
                        return;
                    }

                    ////if (tmpStr == "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
                    ////{
                    ////    lblNotification.Text = "Please try again";
                    ////    return;
                    ////}

                    if(isVolunteer(tmpStr))
                    {

                        //Display Info of Volunteer

                        js = new Connector(Properties.Settings.Default.Server,"Kids_Checkin","kidschurch","[email protected]");

                        string id = js.Lookup("fldID","tblVolunteers","fldNFCCode='" + tmpStr + "'");

                        string sql = "SELECT * FROM tblSchedule WHERE fldDate='" + DateTime.Now.ToShortDateString() + "' AND fldVolunteerID='" + id + "' AND (fldServiceID='" + fldEventID + "') AND fldClass='" + fldGroupID + "'" ;

                        js.ExecuteQuery(sql);

                        js.RiD.Read();

                        if(js.RiD.HasRows)
                        {
                            string q = "SELECT * FROM tblVolunteerAttendance WHERE fldVolunteerID='" + id + "' AND convert(time,fldLoginDateTime)<=convert(time,'" + DateTime.Now.ToString("HH:mm:ss") + "')  AND fldLogoutDateTime IS NULL";

                            js.ExecuteQuery(q);

                            if(js.RiD.HasRows)
                            {
                                lblNotification.Text = "Already logged in";
                                return;
                            }

                            txtName.Text = js.Lookup("fldFirstName + ' ' + fldLastName", "tblVolunteers", "fldID ='" + id + "'");

                            if (System.IO.File.Exists(AccessRegistryTool.ReadValue("PicPath") + @"\volunteer\" + js.Lookup("fldPicture", "tblVolunteers", "fldID ='" + id + "'")))
                            {
                                pbImageKid.Image = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + @"\volunteer\" + js.Lookup("fldPicture", "tblVolunteers", "fldID ='" + id + "'"));
                            }
                            else
                            {
                                pbImageKid.Image = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + "\\download.jpg");
                            }

                            txtNFC.Text = tmpStr;

                            txtBarcode.Text = "N/A";
                            txtBirthday.Text = "N/A";
                            txtAge.Text = "N/A";
                            txtAllergies.Text = "N/A";

                            lblNotification.Text = "Welcome " + txtName.Text;
//.........这里部分代码省略.........
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:101,代码来源:frmLogin.cs

示例4: ValidateCheckin

        private bool ValidateCheckin(string NFC, out string kidid,out string bcode)
        {
            string kid = js.Lookup("fldKidID", "tblKidsNFC", "fldNFCCode='" + NFC + "'");
            string barcode = js.Lookup("fldStudentID", "tblKids", "fldID='" + kid + "'");
            string id = "";

            Connector con = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");

            if(kid=="" && barcode=="")
            {
                kid = con.Lookup("fldKidID", "tblKidsNFC", "fldNFCCode='" + NFC + "'");
                barcode = con.Lookup("fldStudentID", "tblKids", "fldID='" + kid + "'");

                //Update Local Database

                js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

                string kcID = js.Lookup("fldID", "tblKids", "fldStudentID='" + barcode + "'");

                if(kcID!="")
                {
                    string qry = "INSERT INTO tblKidsNFC(fldNFCCode,fldKidID) VALUES('" + NFC + "','" + kcID + "')";

                    js.ExecuteQuery(qry);
                }

                kid = kcID;

                pbLoading.Visible = true;

                if (Properties.Settings.Default.PairedDevices != "")
                {
                    string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));

                    if (devices[0] == null)
                    {
                        string device = Properties.Settings.Default.PairedDevices;

                        string[] properties = device.Split(char.Parse("|"));

                        try
                        {

                            Application.DoEvents();

                            Connector paired = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
                            kcID = paired.Lookup("fldID", "tblKids", "fldStudentID='" + barcode + "'");

                            string qry = "INSERT INTO tblKidsNFC(fldNFCCode,fldKidID) VALUES('" + NFC + "','" + kcID + "')";
                            paired.ExecuteNonQuery(qry);
                            //paired.CloseConnection();
                        }
                        catch (Exception ex)
                        {
                            errBallontoolTip("Kids Checkin System", ex.Message);
                            //paired.CloseConnection();
                        }

                    }

                    for (int i = 0; i <= (devices.Length - 1); i++)
                    {
                        string device = devices[i];

                        string[] properties = device.Split(char.Parse("|"));

                        try
                        {
                            Application.DoEvents();

                            Connector paired = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");
                            kcID = paired.Lookup("fldID", "tblKids", "fldStudentID='" + barcode + "'");

                            string qry = "INSERT INTO tblKidsNFC(fldNFCCode,fldKidID) VALUES('" + NFC + "','" + kcID + "')";
                            paired.ExecuteNonQuery(qry);
                            //paired.CloseConnection();
                        }
                        catch (Exception ex)
                        {
                            errBallontoolTip("Kids Checkin System", ex.Message);
                            //paired.CloseConnection();
                            pbLoading.Visible = false;
                        }

                    }

                }

            }

            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

            id = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + barcode + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.AddDays(-1).ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59'");

            if (id == "")
            {
                kidid = kid;
                bcode = barcode;
                return true;

//.........这里部分代码省略.........
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:101,代码来源:frmLogin.cs

示例5: SaveCheckin

        private void SaveCheckin(string kidid,string fldRoomID = "")
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin","kidschurch","[email protected]");

            if (kidid == "")
            {
                return;
            }

            DataGridViewImageColumn img = new DataGridViewImageColumn();
            int age = 0;
            int group = 0;
            bool passed = false;

            string pathfile = js.GetPath() + "/Kids/" + js.Lookup("fldPicture", "tblKids", "fldID='" + kidid + "'");

            string roomid;
            string room = "";

            string firstname = js.Lookup("fldNickName", "tblKids", "fldID='" + kidid + "'");
            string Lastname = js.Lookup("fldLastName", "tblKids", "fldID='" + kidid + "'");

            age = js.GetAge(Convert.ToDateTime(js.Lookup("fldBirthday", "tblKids", "fldID='" + kidid + "'")));

            if (fldRoomID == "")
            {
                roomid = js.Lookup("fldID", "tblRoom", "fldRoom='" + txtRoom.Text + "'");
                room = js.Lookup("fldRoom", "tblRoom", "fldID=" + roomid);
            }
            else
            {
                roomid = fldRoomID;
                room = js.Lookup("fldRoom", "tblRoom", "fldID=" + roomid);
                passed = true;
            }

            if (age <= Convert.ToInt32(txtAge1.Text) && age >= Convert.ToInt32(txtAge2.Text))
            {
                int rooms = 0;
                string id = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");

                rooms = int.Parse(js.Lookup("Count(*)","tblCustomizedEventRooms","fldCEventID='" + id + "'"));

                if(rooms>1)
                {
                    string qry = "SELECT er.fldRoomID,r.fldRoom FROM tblCustomizedEventRooms er " +
                              "  LEFT OUTER JOIN tblRoom r on r.fldID=er.fldRoomID" +
                               " WHERE er.fldMaxCapacity>(SELECT Count(*) FROM tblAttendance WHERE fldRoomID=er.fldRoomID AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldEventID='" + fldEventID + "')" +
                               " AND fldCEventID='" + id + "' AND er.fldAgeFrom<=" + age + " AND er.fldAgeTo>=" + age;

                    js.RiD.Read();

                    //string roomid = "";

                    if (js.RiD.HasRows)
                    {
                        room = "" + js.RiD["fldRoom"].ToString();
                        roomid = js.RiD["fldRoomID"].ToString();
                        passed = true;
                    }
                    else
                    {
                            roomid = js.Lookup("fldID", "tblCustomizedEventRooms", "fldAgeFrom<=" + age + " AND fldAgeTo>=" + age + " AND fldCEventID='" + id + "'");
                            room = js.Lookup("fldRoom", "tblRoom", "fldID='" +roomid + "'");
                    }

                }
                else
                {
                    lblNotification.ForeColor = System.Drawing.Color.Red;
                    lblNotification.Text = firstname + " " + Lastname + " does not belong to this Group";
                    pbOverride.Tag = null;
                    pbOverride.Visible = false;
                    return;
                }

            }
            else if(age > Convert.ToInt32(txtAge2.Text))
            {
                int rooms = 0;
                string id = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");

                rooms = int.Parse(js.Lookup("Count(*)", "tblCustomizedEventRooms", "fldCEventID='" + id + "'"));

                if (rooms>1)
                {

                    string qry = "SELECT er.fldRoomID,r.fldRoom FROM tblCustomizedEventRooms er " +
                              "  LEFT OUTER JOIN tblRoom r on r.fldID=er.fldRoomID" +
                               " WHERE er.fldMaxCapacity>(SELECT Count(*) FROM tblAttendance WHERE fldRoomID=er.fldRoomID AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldEventID='" + fldEventID + "')" +
                               " AND fldCEventID='" + id + "' AND er.fldAgeFrom<=" + age + " AND er.fldAgeTo>=" + age;

                    js.ExecuteQuery(qry);

                    js.RiD.Read();

                    //string roomid = "";

                    if (js.RiD.HasRows)
                    {
//.........这里部分代码省略.........
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:101,代码来源:frmLogin.cs

示例6: timer3_Tick

        private void timer3_Tick(object sender, EventArgs e)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

            //Automatic Changing of Service Time
            string timetoday = DateTime.Now.ToString("hh:mm tt");
            object thistag = this.Tag;

            string q = "SELECT * FROM tblEvent WHERE fldRegistrationTime <= convert(time,'" + timetoday + "') AND fldEndTime >=convert(time,'" + timetoday + "')";

            js.ExecuteQuery(q);

            js.RiD.Read();

            if(js.RiD.HasRows)
            {
                if(fldEventID!=js.RiD["fldID"].ToString())
                {
                    this.Tag = thistag;
                    frmLogin_Load(null, null);
                }

            }
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:24,代码来源:frmLogin.cs

示例7: LoadVolunteer

        private void LoadVolunteer()
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
            string sql = "SELECT * FROM tblVolunteerAttendance WHERE fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy 00:00:00") + "' AND '" + DateTime.Now.ToString("MM/dd/yyyy 23:59:59") + "' AND fldLogoutDateTime IS NULL";

            js.ExecuteQuery(sql);

            dgvVolunteers.Rows.Clear();
            while(js.RiD.Read())
            {
                string id = js.RiD["fldVolunteerID"].ToString();
                Image img;
                string picture = js.Lookup("fldPicture", "tblVolunteers", "fldID='" + id + "'");

                if(System.IO.File.Exists(AccessRegistryTool.ReadValue("PicPath") + "\\volunteer\\" + picture))
                {
                    img = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + "\\volunteer\\" + picture);
                }
                else
                {
                    img = Image.FromFile(AccessRegistryTool.ReadValue("PicPath") + "\\download.jpg");
                }

                img = new Bitmap(img,new Size(150,150));

                dgvVolunteers.Rows.Add(id, (Image)img);

            }
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:29,代码来源:frmLogin.cs

示例8: ValidateCheckOut

        private bool ValidateCheckOut(string NFC, out string kid)
        {
            string kid2 = js.Lookup("fldFetcherID", "tblFetcherNFC", "fldNFCCode='" + NFC + "'");

            string[] fetcherID = new string[5];
            //string id2 = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + kid + "' AND fldLogoutDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59'");

            if(kid2=="")
            {
                Connector server = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");

                //kid2 = server.Lookup("fldFetcherID", "tblFetcherNFC", "fldNFCCode='" + NFC + "'");

                string query = "SELECT * FROM tblFetcherNFC WHERE fldNFCCode='" + NFC + "'";

                server.ExecuteQuery(query);
                int i =0;
                while(server.RiD.Read())
                {

                    fetcherID[i] = server.RiD["fldFetcherID"].ToString();
                    i++;
                }

            }

            for (int i = 0; i <= (fetcherID.Length - 1);i++)
            {
                if(fetcherID[i]==null)
                {
                    break;
                }

                string qry = "SELECT * FROM tblFetcher WHERE fldID='" + fetcherID[i] + "'";

                Connector server = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");

                server.ExecuteQuery(qry);
                server.RiD.Read();

                string fldLastName = "" + server.RiD["fldLastName"];
                string fldFirstName = "" + server.RiD["fldFirstName"];
                string fldPicture = "" + server.RiD["fldPicture"];

                Connector local = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

                string q = "SELECT fldID FROM tblFetcher WHERE fldLastName='" + fldLastName + "' AND fldFirstName='" + fldFirstName + "' AND fldPicture='" + fldPicture + "'";

                local.ExecuteQuery(q);

                local.RiD.Read();

                if (local.RiD.HasRows)
                {
                    string exist = local.Lookup("fldNFCCode", "tblFetcherNFC", "fldFetcherID='" + local.RiD["fldID"] + "'");

                    if(exist=="")
                    {
                        string insert = "INSERT INTO tblFetcherNFC (fldFetcherID,fldNFCCode) VALUES('" + local.RiD["fldID"] + "','" + NFC + "')";
                        js.ExecuteNonQuery(insert);
                    }

                    else
                    {
                        string update = "UPDATE tblFetcherNFC SET fldNFCCode='" + NFC + "' WHERE fldID='" + local.RiD["fldID"] + "'";

                        js.ExecuteNonQuery(update);
                    }

                    kid2 = local.RiD["fldID"].ToString();
                }
            }

                if (kid2 == "")
                {
                    kid = kid2;
                    return false;

                }
                else
                {
                    kid = kid2;
                    return true;
                }
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:85,代码来源:frmCheckOut.cs

示例9: LoadFetcher2

        private void LoadFetcher2(string kidid)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin","kidschurch","[email protected]");
            string[] fID = new string[4];

            string q = "SELECT * FROM tblFetcherNFC WHERE fldNFCCode='" + kidid + "'";
            js.ExecuteQuery(q);

            if (!js.RiD.HasRows)
            {
                js = new Connector(Properties.Settings.Default.Server, "Kids_Checkin", "kidschurch", "[email protected]");
                js.ExecuteQuery(q);
            }

            int i = 0;
            int j = 0;
            while (js.RiD.Read())
            {
                fID[i] = js.RiD["fldFetcherID"].ToString();
                string qry = "SELECT * FROM tblKidFetcher WHERE fldFetcherID='" + fID[i] + "'";
                Connector js2 = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
                js2.ExecuteQuery(qry);

                while (js2.RiD.Read())
                {
                    kID[j] = js2.RiD["fldKidID"].ToString();
                    j++;
                }

                i++;
            }

            if (!js.RiD.HasRows)
            {
                lblNotification.Text = "No Fetcher details yet!";
                return;
            }

            js.CloseConnection();

            string pic1 = "";
            string pic2 = "";
            string pic3 = "";
            string name1 = "";
            string name2 = "";
            string name3 = "";

            pic1 = js.GetPath() + "/Fetchers/" + js.Lookup("fldPicture", "tblFetcher", "fldID='" + fID[0] + "'");
            pic2 = js.GetPath() + "/Fetchers/" + js.Lookup("fldPicture", "tblFetcher", "fldID='" + fID[1] + "'");
            pic3 = js.GetPath() + "/Fetchers/" + js.Lookup("fldPicture", "tblFetcher", "fldID='" + fID[2] + "'");

            name1 = js.Lookup("fldFirstName", "tblFetcher", "fldID='" + fID[0] + "'") + " " + js.Lookup("fldLastName", "tblFetcher", "fldID='" + fID[0] + "'");
            name2 = js.Lookup("fldFirstName", "tblFetcher", "fldID='" + fID[1] + "'") + " " + js.Lookup("fldLastName", "tblFetcher", "fldID='" + fID[1] + "'");
            name3 = js.Lookup("fldFirstName", "tblFetcher", "fldID='" + fID[2] + "'") + " " + js.Lookup("fldLastName", "tblFetcher", "fldID='" + fID[2] + "'");

            if (System.IO.File.Exists(pic1))
            {
                pb1.Image = Image.FromFile(pic1);

            }
            else
            {
                pb1.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
            }

            if (System.IO.File.Exists(pic2))
            {
                pb2.Image = Image.FromFile(pic2);
            }
            else
            {
                pb2.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
            }

            if (System.IO.File.Exists(pic3))
            {
                pb3.Image = Image.FromFile(pic3);
            }
            else
            {
                pb3.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
            }

            lblName1.Text = name1;
            lblName2.Text = name2;
            lblName3.Text = name3;
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:87,代码来源:frmCheckOut.cs

示例10: ExecuteQuery

 public DataTable ExecuteQuery(string query, Connector cnn)
 {
     return cnn.ExecuteQuery(query);
 }
开发者ID:ElDT43,项目名称:iLium,代码行数:4,代码来源:Initializer.cs

示例11: LoadFetcher

        private void LoadFetcher(string kidid)
        {
            string[] fID = new string[3];

            string q = "SELECT * FROM tblKidFetcher WHERE fldKidID='" + kidid + "'";

            js.ExecuteQuery(q);
            int i = 0;
            int j = 0;
            while (js.RiD.Read())
            {
                fID[i] = js.RiD["fldFetcherID"].ToString();
                string qry = "SELECT * FROM tblKidFetcher WHERE fldFetcherID='" + fID[i] + "'";
                Connector js2 = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin","kidschurch","[email protected]");
                js2.ExecuteQuery(qry);

                while(js2.RiD.Read())
                {
                    kID[j] = js2.RiD["fldKidID"].ToString();
                    j++;
                }
                i++;
            }

            if(!js.RiD.HasRows)
            {
                string id = js.Lookup("fldStudentID","tblKids","fldID='" + kidid + "'");
                string aID = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + id + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59'");

                lblNotification.Text = "No Fetcher details yet!";

                string pic = js.GetPath() + "/Kids/" + js.Lookup("fldPicture", "tblKids", "fldID='" + kidid + "'");

                if (System.IO.File.Exists(pic))
                {
                    pbK1.Image = Image.FromFile(pic);

                }
                lblKName.Text = "" + js.Lookup("fldNickName", "tblKids", "fldID='" + kidid + "'") + " " + js.Lookup("fldLastName", "tblKids", "fldID='" + kidid + "'");
                lblBarcode.Text = "" + id;
                lblBirthday.Text = Convert.ToDateTime(js.Lookup("fldBirthday","tblKids","fldID='" + kidid + "'")).ToShortDateString();
                btnConfirm.Tag = aID;
                btnConfirm.Enabled = true;

                return;
            }

            js.CloseConnection();

            string pic1 = "";
            string pic2 = "";
            string pic3 = "";
            string name1 = "";
            string name2 = "";
            string name3 = "";

            pic1 = js.GetPath() + "/Fetchers/" + js.Lookup("fldPicture", "tblFetcher", "fldID='" + fID[0] + "'");
            pic2 = js.GetPath() + "/Fetchers/" + js.Lookup("fldPicture", "tblFetcher", "fldID='" + fID[1] + "'");
            pic3 = js.GetPath() + "/Fetchers/" + js.Lookup("fldPicture", "tblFetcher", "fldID='" + fID[2] + "'");

            name1 = js.Lookup("fldFirstName", "tblFetcher", "fldID='" + fID[0] + "'") + " " + js.Lookup("fldLastName", "tblFetcher", "fldID='" + fID[0] + "'");
            name2 = js.Lookup("fldFirstName", "tblFetcher", "fldID='" + fID[1] + "'") + " " + js.Lookup("fldLastName", "tblFetcher", "fldID='" + fID[1] + "'");
            name3 = js.Lookup("fldFirstName", "tblFetcher", "fldID='" + fID[2] + "'") + " " + js.Lookup("fldLastName", "tblFetcher", "fldID='" + fID[2] + "'");

            if (System.IO.File.Exists(pic1))
            {
                pb1.Image = Image.FromFile(pic1);

            }
            else
            {
                pb1.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
            }

            if (System.IO.File.Exists(pic2))
            {
                pb2.Image = Image.FromFile(pic2);
            }
            else
            {
                pb2.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
            }

            if (System.IO.File.Exists(pic3))
            {
                pb3.Image = Image.FromFile(pic3);
            }
            else
            {
                pb3.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
            }

            lblName1.Text = name1;
            lblName2.Text = name2;
            lblName3.Text = name3;
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:96,代码来源:frmCheckOut.cs

示例12: CheckOut

        private void CheckOut(string attendanceID)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

            string remarks = js.Lookup("fldRemarks", "tblAttendance", "fldID='" + attendanceID + "'");

            string fldKidID = js.Lookup("fldKidsID", "tblAttendance", "fldID='" + attendanceID + "'");

            int p = 0;
            int fldPoints = 0;
            if(int.TryParse(js.Lookup("fldPoints","tblKids"," fldStudentID='" + fldKidID + "'"),out p))
            {
                fldPoints = p + 50;
            }
            else
            {
                fldPoints = 50;
            }

            if(fromNFC==true)
            {
                string qq = "UPDATE tblKids SET fldPoints='" + fldPoints + "' WHERE fldStudentID='" + fldKidID + "'";
                js.ExecuteNonQuery(qq);
            }

            remarks += ";Logged out: " + DateTime.Now.ToString();
            string q = "Update tblAttendance SET fldLogoutDateTime='" + DateTime.Now.ToString() + "',fldRemarks='" + remarks + "' WHERE fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy") + " 00:00:00' AND '" +  DateTime.Now.ToString("MM/dd/yyyy") + " 23:59:59' AND fldKidsID='" +fldKidID + "'";

            js.ExecuteNonQuery(q);

            pbLoading.Visible = true;

            if (Properties.Settings.Default.PairedDevices != "")
            {
                string[] devices = Properties.Settings.Default.PairedDevices.Split(char.Parse(","));

                if (devices[0] == "")
                {
                    string device = Properties.Settings.Default.PairedDevices;

                    string[] properties = device.Split(char.Parse("|"));

                    Connector con = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");

                    try
                    {
                        Application.DoEvents();
                        con.ExecuteNonQuery(q);
                    }
                    catch(Exception ex)
                    {

                    }

                    return;
                }

                for (int i = 0; i <= (devices.Length - 1); i++)
                {
                    string device = devices[i];

                    string[] properties = device.Split(char.Parse("|"));

                    Connector con = new Connector(properties[1], "Kids_Checkin", "kidschurch", "[email protected]");

                    try
                    {
                        Application.DoEvents();
                        con.ExecuteNonQuery(q);
                    }
                    catch(Exception ex)
                    {

                    }

                }

            }

            //PASS TO SERVER

            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
            string query = "SELECT * FROM tblAttendance WHERE fldLoginDateTime BETWEEN '" + DateTime.Now.ToString("MM/dd/yyyy") + " 00:00:00' AND '" + DateTime.Now.ToString("MM/dd/yyyy") + " 23:59:59'" +
                              " AND fldKidsID='" + fldKidID + "'";

            js.ExecuteQuery(query);

                js.RiD.Read();

                if(js.RiD.HasRows)
                {
                    string fldRoomID = "" + js.RiD["fldRoomID"];
                    string fldLoginDateTime = "" + js.RiD["fldLoginDateTime"];
                    string fldLogoutDateTime = "" + js.RiD["fldLogoutDateTime"];
                    string fldChurch ="" + js.RiD["fldChurch"];
                    string fldKidsID = "" + js.RiD["fldKidsID"];
                    string fldRemarks = "" + js.RiD["fldRemarks"];
                    string fldEventID = js.Lookup("fldEventTitle", "tblEvent", "fldID='" + js.RiD["fldEventID"] + "'");
                    string fldGroupID ="" + js.RiD["fldGroupID"];
                    string fldAge = "" + js.RiD["fldAge"];
//.........这里部分代码省略.........
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:101,代码来源:frmCheckOut.cs

示例13: btnScan_Click

        private void btnScan_Click(object sender, EventArgs e)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");

            string value = "";
            bool passed  = false;
            if (js.InputBox("Check Out", "Please Scan Barcode", ref value) == System.Windows.Forms.DialogResult.OK)
            {
                string q = "SELECT * FROM tblKids WHERE fldStudentID = '" + value + "'";
                js.ExecuteQuery(q);
                js.RiD.Read();

                if(!js.RiD.HasRows)
                {
                    return;
                }

                string kidsid = js.RiD["fldID"].ToString();
                for (int i=0;i<kID.Length;i++)
                {
                    if(kidsid==kID[i])
                    {
                        passed = true;
                        break;
                    }
                }

                if(passed==true)
                {
                    string p = js.GetPath() + "/Kids/" + js.RiD["fldPicture"];

                    string aID = js.Lookup("fldID", "tblAttendance", "fldKidsID='" + value  + "' AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND (fldLogoutDateTime IS NULL)");

                    if (System.IO.File.Exists(p))
                    {
                        pbK1.Image = Image.FromFile(p);
                    }
                    lblKName.Text = "" + js.RiD["fldNickName"] + " " + js.RiD["fldLastName"];
                    lblBarcode.Text = value;
                    lblBirthday.Text = Convert.ToDateTime(js.RiD["fldBirthday"].ToString()).ToString("MM/dd/yyyy");
                    btnConfirm.Tag = aID;
                    btnConfirm.Enabled = true;
                    fromNFC = false;
                }
                else
                {
                    lblNotification.ForeColor = Color.Red;
                    lblNotification.Text = "Fetcher and Kid Do Not Match";
                }
            }
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:51,代码来源:frmCheckOut.cs

示例14: isVolunteer

        private bool isVolunteer(string NFC = "")
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"),"Kids_Checkin", "kidschurch", "[email protected]");

            string sql = "SELECT * FROM tblVolunteers WHERE fldNFCCode='" + NFC + "'";

            js.ExecuteQuery(sql);

            js.RiD.Read();

            if(js.RiD.HasRows)
            {
                js.CloseConnection();
                return true;
            }
            else
            {
                js.CloseConnection();
                return false;
            }
        }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:21,代码来源:frmLogin.cs

示例15: pbOverride_Click

        private void pbOverride_Click(object sender, EventArgs e)
        {
            js = new Connector(AccessRegistryTool.ReadValue("DBServer"), "Kids_Checkin", "kidschurch", "[email protected]");
            tmrReader.Enabled = false;
            DataGridViewImageColumn img = new DataGridViewImageColumn();
            int age = 0;
            int group = 0;

            string pathfile = js.GetPath() + "/Kids/" + js.Lookup("fldPicture", "tblKids", "fldID='" + pbOverride.Tag + "'");

            string roomid = js.Lookup("fldID", "tblRoom", "fldRoom='" + txtRoom.Text + "'");

            string firstname = js.Lookup("fldNickName", "tblKids", "fldID='" + pbOverride.Tag + "'");
            string Lastname = js.Lookup("fldLastName", "tblKids", "fldID='" + pbOverride.Tag + "'");
            bool correct = false;
            string room = "";
            string thistext = "";
            string id = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");

            if(lblCount.Text==lblTotal.Text)
            {

                string qry = "SELECT er.fldRoomID,r.fldRoom FROM tblCustomizedEventRooms er " +
                              "  LEFT OUTER JOIN tblRoom r on r.fldID=er.fldRoomID" +
                               " WHERE er.fldMaxCapacity>(SELECT Count(*) FROM tblAttendance WHERE fldRoomID=er.fldRoomID AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldEventID='" + fldEventID + "')" +
                               " AND fldCEventID='" + id + "'";
                js.ExecuteQuery(qry);

                js.RiD.Read();

                if (js.RiD.HasRows)
                {
                    room = "" + js.RiD["fldRoom"].ToString();
                    roomid = js.RiD["fldRoomID"].ToString();
                }

                if(room!="")
                {
                    js.showExclamation("Room: " + txtRoom.Text + " is already maxed out the kid will be transferred to Room: " + room);
                }
                else
                {
                    room = txtRoom.Text;
                    roomid =  js.Lookup("fldID", "tblRoom", "fldRoom='" + txtRoom.Text + "'");
                    js.showExclamation("Room: " + txtRoom.Text + " is already maxed out, the kid will be added to Room: " + room);
                }

            }
               id = js.Lookup("fldID", "tblCustomizedEvent", "fldEventCode='" + this.Text + "'");

            string qq = "SELECT er.fldRoomID,r.fldRoom,er.fldAgeFrom,er.fldAgeTo FROM tblCustomizedEventRooms er " +
                              "  LEFT OUTER JOIN tblRoom r on r.fldID=er.fldRoomID" +
                               " WHERE er.fldMaxCapacity>(SELECT Count(*) FROM tblAttendance WHERE fldRoomID=er.fldRoomID AND fldLoginDateTime BETWEEN '" + DateTime.Now.ToShortDateString() + " 00:00:00' AND '" + DateTime.Now.ToShortDateString() + " 23:59:59' AND fldEventID='" + fldEventID + "')" +
                               " AND fldCEventID='" + id + "'";

            while (correct == false)
            {
                //string value = "";
                frmOverride frm = new frmOverride();
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {

                }
                else
                {

                    checkin.frmOverFlowRoom form = new checkin.frmOverFlowRoom();
                    form.Tag = qq;
                    if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string[] tag = form.Tag.ToString().Split(char.Parse("|"));

                        room = tag[1];
                        roomid = tag[0];
                    }
                    correct = true;
                    //return;
                }

            }

            if (System.IO.File.Exists(pathfile))
            {
                img.Image = Image.FromFile(pathfile);

                img.Image = (Image)(new Bitmap(img.Image, new Size(150, 150)));
            }
            else
            {
                img.Image = Image.FromFile(Application.StartupPath + "/Pictures/download.jpg");
                img.Image = (Image)(new Bitmap(img.Image, new Size(150, 150)));
            }

            pbImageKid.Image = img.Image;

            txtName.Text = firstname + " " + Lastname;

            txtBirthday.Text = Convert.ToDateTime(js.Lookup("fldBirthday", "tblKids", "fldID='" + pbOverride.Tag + "'")).ToShortDateString();

            DateTime sdate = Convert.ToDateTime(DateTime.Now.ToString("MM/dd"));
//.........这里部分代码省略.........
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:101,代码来源:frmLogin.cs


注:本文中的Connector.ExecuteQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。