Exemplo n.º 1
0
        public Sit[] GetSits()
        {
            DS.Clear();
            adapter.SelectCommand = new OracleCommand("select * from sit where branch_id='" + branch_id + "' order by sit_num asc", conn);
            adapter.Fill(DS, "Sit");
            int      x;
            int      y;
            char     isUsed;
            DateTime now     = DateTime.Now;
            DateTime sitTime = new DateTime(1);
            string   temp;

            string[] Date;
            string[] Time;
            Sit[]    result = new Sit[DS.Tables["Sit"].Rows.Count];
            for (int i = 0; i < result.Length; i++)
            {
                temp = (DS.Tables["Sit"].Rows[i]["end_at"]).ToString();
                string hhh = DateTime.Parse(DS.Tables["Sit"].Rows[i]["end_at"].ToString()).ToString("hh");
                //2020-12-01 오전 2:51:27
                if (temp.Length > 1)
                {
                    Date = temp.Substring(0, 10).Split('-');
                    Time = temp.Split(' ')[2].Split(':');
                    //if (temp.Split(' ')[1] == "오후") sitTime = new DateTime(Convert.ToInt32(Date[0]), Convert.ToInt32(Date[1]), Convert.ToInt32(Date[2]), (Convert.ToInt32(Time[0]) + 12), Convert.ToInt32(Time[1]), Convert.ToInt32(Time[2]));
                    sitTime = new DateTime(Convert.ToInt32(Date[0]), Convert.ToInt32(Date[1]), Convert.ToInt32(Date[2]), Convert.ToInt32(hhh), Convert.ToInt32(Time[1]), Convert.ToInt32(Time[2]));
                }
                if (DateTime.Compare(sitTime, now) <= 0)
                {
                    DS.Tables["Sit"].Rows[i]["is_used"]   = 'F';
                    DS.Tables["Sit"].Rows[i]["member_id"] = "0";
                }
                x         = Convert.ToInt32(DS.Tables["Sit"].Rows[i]["location_x"]);
                y         = Convert.ToInt32(DS.Tables["Sit"].Rows[i]["location_y"]);
                isUsed    = Convert.ToChar(DS.Tables["Sit"].Rows[i]["is_used"]);
                result[i] = new Sit(x, y, i + 1, isUsed);
            }
            adapter.Update(DS, "Sit");
            DS.AcceptChanges();
            return(result);
        }
Exemplo n.º 2
0
        public Sit[] GetFalseSits()
        {
            DS.Clear();
            adapter.SelectCommand = new OracleCommand("select * from sit where branch_id='" + branch_id + "' and is_used = 'F' order by sit_num asc", conn);
            adapter.Fill(DS, "Sit");
            int  x;
            int  y;
            char isUsed;
            int  sitNum;

            Sit[] result = new Sit[DS.Tables["Sit"].Rows.Count];
            for (int i = 0; i < result.Length; i++)
            {
                x         = Convert.ToInt32(DS.Tables["Sit"].Rows[i]["location_x"]);
                y         = Convert.ToInt32(DS.Tables["Sit"].Rows[i]["location_y"]);
                isUsed    = Convert.ToChar(DS.Tables["Sit"].Rows[i]["is_used"]);
                sitNum    = Convert.ToInt32(DS.Tables["Sit"].Rows[i]["sit_num"]);
                result[i] = new Sit(x, y, sitNum, isUsed);
            }
            return(result);
        }
Exemplo n.º 3
0
        private void DrawSit(Sit sit)
        {
            Pen  p = new Pen(Color.Gray, 3);
            Font f = new Font("휴먼둥근헤드라인", 16, FontStyle.Bold);

            if (sit.isUsed == 'T')
            {
                g.FillRectangle(Brushes.DimGray, sit.x, sit.y, 40, 35);
            }
            if (sit.isUsed == 'F')
            {
                g.FillRectangle(Brushes.GreenYellow, sit.x, sit.y, 40, 35);
            }
            g.DrawRectangle(p, sit.x, sit.y, 40, 35);
            if (sit.num < 10)
            {
                g.DrawString(sit.num.ToString(), f, Brushes.Black, sit.x + 8, sit.y + 7);
            }
            else
            {
                g.DrawString(sit.num.ToString(), f, Brushes.Black, sit.x, sit.y + 7);
            }
        }