Exemplo n.º 1
0
        public RegistrationForm(int n, MainForm f)
        {
            num = n;
            InitializeComponent();
            mainf      = f;
            this.Text += num;

            dateTimePicker3.Value = DateTime.Today;
            dateTimePicker2.Value = DateTime.Today.AddYears(-35);
            dateTimePicker1.Value = DateTime.Today.AddDays(7);

            if (mainf.roomList[num - 1].IsOccupied)
            {
                visitors = mainf.roomList[num - 1].CurrentVisitors;

                this.Text                    = "Изменнения даты отъезда из номера " + num;
                this.panel1.Enabled          = false;
                this.dateTimePicker3.Enabled = false;
                this.button2.Text            = "Перерасчёт и оформление дополнительной квитанции";
                foreach (var visitor in visitors)
                {
                    string s = visitor.Surname + " " + visitor.Name;
                    textBox1.AppendText(s + "\n");
                    comboBox1.Items.Add(s);
                }
            }
        }
Exemplo n.º 2
0
 public void AddVisitors(VisitorList visitors)
 {
     foreach (var c in visitors.visitors)
     {
         Create(c);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Fills Data into ListView based on Search Criteria provided.
        /// </summary>
        /// <param name="strCompany">Name of Company Visitor Belongs.</param>
        /// <param name="strContact">Visitor Contact No.</param>
        private void FillList(string strCompany, string strContact)
        {
            VisitorList objList = new VisitorList();

            if (strCompany == "All")
            {
                strCompany = "";
            }
            if (strContact == "All")
            {
                strContact = "";
            }
            objList = VisitorManager.GetList(strCompany, strContact);

            lvwVisitors.Items.Clear();

            if (objList != null)
            {
                foreach (Visitor objVisitor in objList)
                {
                    ListViewItem objLvwItem = new ListViewItem();
                    objLvwItem.Name = Convert.ToString(objVisitor.DBID);
                    objLvwItem.Text = objVisitor.VName;
                    objLvwItem.SubItems.Add(objVisitor.Company);
                    objLvwItem.SubItems.Add(objVisitor.MobileNo);
                    objLvwItem.SubItems.Add(Convert.ToString(objVisitor.RegNo));

                    lvwVisitors.Items.Add(objLvwItem);
                }
            }
        }
Exemplo n.º 4
0
        public RegistrationForm(int n, MainForm f)
        {
            num = n;
            InitializeComponent();
            mainf = f;
            this.Text += num;

            dateTimePicker3.Value = DateTime.Today;
            dateTimePicker2.Value = DateTime.Today.AddYears(-35);
            dateTimePicker1.Value = DateTime.Today.AddDays(7);

            if (mainf.roomList[num - 1].IsOccupied)
            {
                visitors = mainf.roomList[num - 1].CurrentVisitors;

                this.Text = "Изменнения даты отъезда из номера " + num;
                this.panel1.Enabled = false;
                this.dateTimePicker3.Enabled = false;
                this.button2.Text = "Перерасчёт и оформление дополнительной квитанции";
                foreach (var visitor in visitors)
                {
                    string s = visitor.Surname + " " + visitor.Name;
                    textBox1.AppendText(s + "\n");
                    comboBox1.Items.Add(s);
                }
            }
        }
Exemplo n.º 5
0
        public SearchForm(VisitorList visitorList)
        {
            InitializeComponent();
            visitors = visitorList;

            dataGridView1.DataSource = null;
            visitorListBindingSource.DataSource = visitors;
            dataGridView1.DataSource = visitorListBindingSource;
        }
Exemplo n.º 6
0
        public SearchForm(VisitorList visitorList)
        {
            InitializeComponent();
            visitors = visitorList;

            dataGridView1.DataSource            = null;
            visitorListBindingSource.DataSource = visitors;
            dataGridView1.DataSource            = visitorListBindingSource;
        }
        static VisitCounter()
        {
            var timer = new Timer(10000)
            {
                Enabled = true
            };

            timer.Start();
            timer.Elapsed += (sender, e) => VisitorList.RemoveWhere(x => x.LatestVisitAt < DateTime.Now.AddMinutes(-5));
        }
Exemplo n.º 8
0
        public ActionResult List(DateTime bDate, DateTime eDate, string SearchType = "", int codeID = 0, string code = "", int codeID2 = 0)
        {
            GetData();
            ViewBag.BeginDate = bDate.ToShortDateString();
            ViewBag.EndDate   = eDate.ToShortDateString();

            IEnumerable <visitor> VisitorList;

            if (SearchType == "CategorySearch")
            {
                VisitorList = VisitorRepository.GetVisitorByCategory(codeID);
            }
            else if (SearchType == "StatusSearch")
            {
                VisitorList = VisitorRepository.GetVisitorByStatus(code);
            }
            else if (SearchType == "BestContactSearch")
            {
                VisitorList = VisitorRepository.GetVisitorByBestContact(codeID);
            }
            else if (SearchType == "LastEventAttendedSearch")
            {
                VisitorList = VisitorRepository.GetVisitorByLastEventAttended(codeID);
            }
            else
            {
                VisitorList = VisitorRepository.GetVisitorByEventDate(bDate.Date, eDate.Date);
            }

            foreach (var i in VisitorList)
            {
                if (i.subCategoryID != 0)
                {
                    i.VisitorCategory = ConstantRepository.GetConstantID(i.subCategoryID).Value1;
                }
                if (i.BestContact != null)
                {
                    i.BestContactType = ConstantRepository.GetConstantID((int)i.BestContact).Value1;
                }
                if (i.Title != null)
                {
                    i.Title2 = ConstantRepository.GetConstantID((int)i.Title).Value1;
                }
                if (i.LastEventAttended != null)
                {
                    i.LastEventName = ConstantRepository.GetConstantID((int)i.LastEventAttended).Value1;
                }
            }

            ViewBag.RecordCount = VisitorList.Count();

            return(PartialView(VisitorList));
        }
Exemplo n.º 9
0
        /// <summary>
        /// This method provides List of Visitors available in Database.
        /// </summary>
        /// <param name="strWhere">Specifies condition for retrieving records.</param>
        /// <returns>Collection of Visitor Objects.</returns>
        public static VisitorList GetList(string strCompany, string strContactNo)
        {
            VisitorList objList = null;
            string      strSql  = "Select * from VISITORMASTER ";

            if (strCompany != string.Empty & strContactNo == string.Empty)
            {
                strSql += " WHERE COMPANY = '" + strCompany + "'";
            }
            else if (strCompany == string.Empty & strContactNo != string.Empty)
            {
                strSql += " WHERE CONTACTNO = '" + strContactNo + "'";
            }
            else if ((strCompany != string.Empty) & (strContactNo != string.Empty))
            {
                strSql += " WHERE COMPANY = '" + strCompany +
                          "' AND CONTACTNO = '" + strContactNo + "'";
            }

            strSql += " ORDER BY VISITORREGNO";

            using (SqlConnection Conn = new SqlConnection(General.GetSQLConnectionString()))
            {
                using (SqlCommand objCmd = new SqlCommand())
                {
                    objCmd.Connection  = Conn;
                    objCmd.CommandType = CommandType.Text;
                    objCmd.CommandText = strSql;

                    if (Conn.State != ConnectionState.Open)
                    {
                        Conn.Open();
                    }

                    using (SqlDataReader oReader = objCmd.ExecuteReader())
                    {
                        if (oReader.HasRows)
                        {
                            objList = new VisitorList();
                            while (oReader.Read())
                            {
                                objList.Add(FillDataRecord(oReader));
                            }
                        }
                        oReader.Close();
                        oReader.Dispose();
                    }
                }
            }
            return(objList);
        }
Exemplo n.º 10
0
 public void InsertVisitor(bool isLogin, int id, SqlSugarClient db, UserInfo user)
 {
     if (isLogin && user.Id != id)
     {
         db.Delete <VisitorList>(it => it.Uid == id && it.VisitorId == user.Id);//删除历史
         VisitorList v = new VisitorList()
         {
             CreateDate = DateTime.Now,
             Uid        = id,
             VisitorId  = user.Id
         };
         db.Insert(v);
     }
 }
Exemplo n.º 11
0
    public void SetSystemManager(SystemData systemData)
    {
        //Set all system data here
        //Can I refactor to simplify??
        systemName       = systemData.systemName;
        backdropMaterial = Resources.Load("Visuals/Backdrops/" + systemData.backdropMaterial, typeof(Material)) as Material;
        visitorList      = Resources.Load("Prefabs/Visitor List/" + systemData.visitorList) as GameObject;

        _visitorList = visitorList.GetComponent <VisitorList>();

        systemSize       = systemData.systemSize;
        systemOwner      = systemData.systemOwner;
        systemPopulated  = systemData.systemPopulated;
        asteroidsToSpawn = systemData.asteroidsToSpawn;
        chanceOfPirate   = systemData.chanceOfPirate;

        InitializeArea();
    }
Exemplo n.º 12
0
        public static void Visit(string visitorId)
        {
            var visitor = VisitorList.FirstOrDefault(x => x.Id == visitorId);

            if (visitor == null)
            {
                VisitorList.Add(new Visitor
                {
                    Id            = visitorId,
                    FirstVisitAt  = DateTime.Now,
                    LatestVisitAt = DateTime.Now
                });
            }
            else
            {
                visitor.LatestVisitAt = DateTime.Now;
            }
        }
Exemplo n.º 13
0
        public async Task <IActionResult> postVisitors([FromBody] VisitorList visitors)
        {
            try
            {
                if (visitors == null)
                {
                    Logger.LogError("The visitor List is null.");
                    return(BadRequest("Null visitor list"));
                }

                VisitorRepository.AddVisitors(visitors);
                await VisitorRepository.saveChanges();
            }
            catch (Exception exception)
            {
                Logger.LogError($"Something went wrong internally in the server: ", exception.Message);
                return(StatusCode(500, "Internal server error"));
            }

            return(Ok("Visitor List has been added to the database"));
        }
Exemplo n.º 14
0
        /// <summary>
        /// This method called when the request arrives.
        /// </summary>
        /// <param name="visitorId">visitor identity</param>
        public static void Visit(string visitorId)
        {
            var visitor = VisitorList.FirstOrDefault(x => x.Id == visitorId);
            var d       = DateTime.Now;

            if (visitor == null)
            {
                VisitorList.Add(new Visitor
                {
                    Id            = visitorId,
                    FirstVisitAt  = d,
                    LatestVisitAt = d,
                    ExpiredAt     = d.AddSeconds(ViCounterSettings.ActivityDuration)
                });
            }
            else
            {
                visitor.LatestVisitAt = d;
                visitor.ExpiredAt     = d.AddSeconds(ViCounterSettings.ActivityDuration);
            }
        }
Exemplo n.º 15
0
 public static void Init()
 {
     if (!Initialized)
     {
         lock (Lock)
         {
             if (!Initialized && _timer == null)
             {
                 _counter++;
                 _timer = new Timer(ViCounterSettings.RefreshInterval * 1000)
                 {
                     Enabled = true
                 };
                 _timer.Start();
                 _timer.Elapsed += (sender, e) =>
                 {
                     //Console.WriteLine($"Start clear expired session, interval:{ViCounterSettings.RefreshInterval}, count:{_counter}...");
                     VisitorList.RemoveWhere(x => x.ExpiredAt < DateTime.Now);
                     //Console.WriteLine("Expired session clear completed.");
                 };
             }
         }
     }
 }