protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblUser.Text = GlobalAccess.Fullname;
            }

            var collection = Event_Log.GetCurrentEvents();
            //
            var empList  = collection.Where(o => o.TableName == "employee" && o.Event == "insert").ToList();
            int empCount = empList.Count;

            var kioskList  = collection.Where(o => o.TableName == "kiosk" && o.Event == "insert").ToList();
            int kioskCount = kioskList.Count;

            var productList  = collection.Where(o => o.TableName == "product" && o.Event == "insert").ToList();
            int productCount = productList.Count;

            var salesList  = collection.Where(o => o.TableName == "salesinfo" && o.Event == "insert").ToList();
            int salesCount = salesList.Count;

            //
            lblEmployee.Text = string.Format("{0}({1})", "Employee", empCount);

            lblKiosk.Text = string.Format("{0}({1})", "Kiosk", kioskCount);

            lblItems.Text = string.Format("{0}({1})", "Items", productCount);

            lblSales.Text = string.Format("{0}({1})", "Sales", salesCount);
            ///
            CallEmployeeLog();
        }
示例#2
0
        /*
         * Pre: idea_num for non assigned project, idea_num + assigned_id and school_id for assigned project.
         * */
        private void LogEvent(IdeaView ideaView, string action)
        {
            Event_Log log = new Event_Log();

            //get user_id from userLoggedIn session
            log.User_id     = db.Users.Where(u => u.Name == User.Identity.Name).Select(u => u.User_id).FirstOrDefault();
            log.Idea_num    = ideaView.Idea_num;
            log.Assigned_id = ideaView.Assigned_id;
            log.Title       = db.Ideas.Where(i => i.Idea_num == ideaView.Idea_num).Select(i => i.Title).FirstOrDefault();
            log.School_id   = ideaView.School_id;
            log.Access_date = DateTime.Now;
            log.Action      = db.Codes.Where(c => c.Code_def == action).Select(c => c.Code_id).FirstOrDefault();
            db.Event_Log.Add(log);
            db.SaveChanges();
        }