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


C# Connector.GetAge方法代码示例

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


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

示例1: 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

示例2: pbOverride_Click


//.........这里部分代码省略.........

                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"));
            DateTime edate = sdate.AddDays(6);
            DateTime bd = Convert.ToDateTime(Convert.ToDateTime(txtBirthday.Text).ToString("MM/dd"));

            if (bd >= sdate && bd <= edate)
            {
                pbBirthday.Visible = true;
                pbPopper.Visible = true;

            }
            else
            {
                pbBirthday.Visible = false;
                pbPopper.Visible = false;
            }

            txtAllergies.Text = js.Lookup("fldAllergies", "tblKids", "fldID='" + pbOverride.Tag + "'");

            txtAge.Text = js.GetAge(Convert.ToDateTime(txtBirthday.Text)).ToString();

            txtBarcode.Text = js.Lookup("fldStudentID", "tblKids", "fldID='" + pbOverride.Tag + "'");

            txtNFC.Text = js.Lookup("fldNFCCode", "tblKidsNFC", "fldKidID='" + pbOverride.Tag + "'");

            if (Convert.ToDecimal(age) < 2)
            {
                group = 1;
            }

            else if ((Convert.ToDecimal(age) >= 2) && (Convert.ToDecimal(age) < 3))
            {
                group = 2;
            }

            else if ((Convert.ToDecimal(age) >= 3) && (Convert.ToDecimal(age) <= 4))
            {
                group = 3;
            }

            else if ((Convert.ToDecimal(age) >= 5) && (Convert.ToDecimal(age) <= 6))
            {
                group = 4;
            }

            else if ((Convert.ToDecimal(age) >= 7) && (Convert.ToDecimal(age) <= 9))
            {
                group = 5;
            }

            else if ((Convert.ToDecimal(age) >= 10) && (Convert.ToDecimal(age) <= 12))
            {
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:67,代码来源:frmLogin.cs


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