Beispiel #1
0
    private void SendData2(IntPtr hWnd, int id, queueData qData)
    {
        COPYDATASTRUCT2 data = new COPYDATASTRUCT2();

        data.dwData = id;    // 3; // whatever value (have to match receiver end)
        data.cbData = 256;   //System.Runtime.InteropServices.Marshal.SizeOf(UserData2);// size of UserData struct

        UserData2 userData = new UserData2();

        if (qData.sIP.Length > 240)
        {
            qData.sIP = qData.sIP.Substring(0, 240);
        }

        userData.sIP            = qData.sIP;
        userData.iPingCount     = qData.iPingCount;
        userData.iPingReplies   = qData.iPingReplies;
        userData.iPingReplyTime = qData.iPingReplyTime;
        userData.iPingTimeout   = qData.iPingTimeout;

        //copy data to unmanaged pointers
        data.lpData = Marshal.AllocCoTaskMem(data.cbData);
        Marshal.StructureToPtr(userData, data.lpData, false);

        IntPtr lpData = Marshal.AllocCoTaskMem(Marshal.SizeOf(data));

        Marshal.StructureToPtr(data, lpData, false);

        Message msg1 = Message.Create(hWnd, WM_COPYDATA, lpData, lpData);

        MessageWindow.SendMessage(ref msg1);

        Marshal.FreeCoTaskMem(data.lpData);
        Marshal.FreeCoTaskMem(lpData);
    }
Beispiel #2
0
        protected override void WndProc(ref Message m)
        {
            int iMsg = m.Msg;

            System.Diagnostics.Debug.WriteLine("WndProc called...");
            switch (iMsg)
            {
            case WM_COPYDATA:
                System.Diagnostics.Debug.WriteLine("WndProc sending notification ...");
                // extract the own data from the Windows Message m
                //COPYDATASTRUCT data = (COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT));
                COPYDATASTRUCT2 data = (COPYDATASTRUCT2)Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT2));
                //UserData userData = (UserData)Marshal.PtrToStructure(data.lpData, typeof(UserData));
                UserData2 userData = (UserData2)Marshal.PtrToStructure(data.lpData, typeof(UserData2));

                //this._bgThread2.NotifyData(data.dwData, userData.msg);
                this._bgThread2.NotifyData(userData);
                m.Result = IntPtr.Zero;
                break;

            default:
                base.WndProc(ref m);
                break;
            }
        }
Beispiel #3
0
 private void Init()
 {
     if (!_initialized)
     {
         _userData    = JsonConvert.DeserializeObject <UserData2>(UserData);
         _initialized = true;
     }
 }
        public AAA2ErrorCode AddUserData(AAA2Credential userCredential, UserData2[] data)
        {
            User2 user;
            AAA2ErrorCode error = GetUser(userCredential, out user);

            if (error != AAA2ErrorCode.OK)
                return error;

            user.Data.Add(data);

            return AAA2ErrorCode.OK;
        }
Beispiel #5
0
        public LibraryGateReplaceRequest MakeModuleReplaceRequest()
        {
            var oldData = UserData1.CommaSeparatedStringToList();
            var newData = UserData2.CommaSeparatedStringToList();

            return(new LibraryGateReplaceRequest
            {
                SourceNetlist = SelectedNetlist,
                TargetNetlist = TargetSaveFile,
                GateToReplace = oldData[0],
                NewGate = newData[0],
                PortsMapping = MakePortMapping(oldData, newData)
            });
        }
        /// <summary>
        /// Kullanıcı ekle
        /// </summary>
        /// <param name="loginCredential">İşlem yapacak kullanıcının bilgileri</param>
        /// <param name="userToAdd">Eklenecek kullanıcı</param>
        /// <param name="data">Eklenen kullanıcıya ait bilgiler</param>
        /// <returns></returns>
        public AAA2ErrorCode AddUser(AAA2Credential loginCredential, AAA2Credential userToAdd, UserData2[] data)
        {
            User2 user;
            AAA2ErrorCode error = GetUser(loginCredential, out user);

            if (error != AAA2ErrorCode.OK)
                return error;

            if (!user.AddUser)
                return AAA2ErrorCode.PermissionRequired;

            user = new User2(userToAdd);
            user.Data.Add(data);

            if (_users.TryAdd(user.Credential.Username, user))
            {
                return AAA2ErrorCode.OK;
            }
            else
            {
                return AAA2ErrorCode.AlreadyExists;
            }
        }
Beispiel #7
0
    private void NotifyData(UserData2 u2Data)
    {
        BgThreadEventArgs _bgThread2EventArgs;

        //is there any subscriber
        if (this.bgThread2Event == null)
        {
            return;
        }
        try
        {
            queueData qData = new queueData();
            qData.sIP            = u2Data.sIP;
            qData.iPingCount     = u2Data.iPingCount;
            qData.iPingReplies   = u2Data.iPingReplies;
            qData.iPingReplyTime = u2Data.iPingReplyTime;
            qData.iPingTimeout   = u2Data.iPingTimeout;
            _bgThread2EventArgs  = new BgThreadEventArgs(qData);
            this.bgThread2Event(this, _bgThread2EventArgs);
        }
        catch (MissingMethodException)
        {
        }
    }
        public IActionResult Profile(UserData2 userdata)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                _logger.LogError("1:" + userdata.jiaose);
                _logger.LogError("1.5:" + JsonConvert.SerializeObject(AuthContextService.CurrentUser));

                var guid = AuthContextService.CurrentUser.Guid;
                _logger.LogError("2:" + guid);
                var user = _dbContext.SystemUser.FirstOrDefaultAsync(x => x.SystemUserUuid == guid).Result;
                _logger.LogError("3:" + user);

                if (user.RealName != "超级管理员")
                {
                    var dd = user.SystemRoleUuid;
                    _logger.LogError("4:");

                    var ss = _dbContext.SystemRolePermissionMapping.Where(x => x.SystemRoleUuid.ToString() == dd).ToList();

                    _logger.LogError("5:" + ss.Count);

                    if (ss.Count > 0)
                    {
                        _logger.LogError("6:");

                        for (int i = 0; i < ss.Count; i++)
                        {
                            _logger.LogError("7:");

                            var gg = _dbContext.SystemPermission.Where(x => x.SystemPermissionUuid == ss[i].SystemPermissionUuid).ToList();
                            _logger.LogError("8:" + gg.Count);

                            if (gg.Count > 0)
                            {
                                _logger.LogError("9:");

                                for (int r = 0; r < gg.Count; r++)
                                {
                                    _logger.LogError("10:");

                                    if (gg[r].Name == "查看")
                                    {
                                        _logger.LogError("11:");

                                        var qq = _dbContext.SystemMenu.FirstOrDefault(x => x.SystemMenuUuid == gg[r].SystemMenuUuid);
                                        _logger.LogError("12:" + qq.Name);

                                        if (userdata.jiaose == qq.Name)
                                        {
                                            response.SetData("ok");
                                            return(Ok(response));
                                        }
                                        else
                                        {
                                            //response.SetFailed("没有相关权限");
                                            //return Ok(response);
                                        }
                                    }
                                    else
                                    {
                                        //response.SetFailed("没有相关权限");
                                        //return Ok(response);
                                    }
                                }
                            }
                            else
                            {
                                //response.SetFailed("没有相关权限");
                                //return Ok(response);
                            }
                        }
                    }
                }
                else
                {
                    response.SetData("ok");
                    return(Ok(response));
                }
            }
            response.SetFailed("没有相关权限");
            return(Ok(response));
        }
Beispiel #9
0
        // GET: Budgets/Details/5
        public ActionResult Details(int?id)
        {
            var userId = User.Identity.GetUserId();
            List <UserData2> UserChartList = new List <UserData2>();   //Finding Chart Data for Users in a household's spending amounts
            var       Budget = db.Budgets.Find(id);
            UserData2 Users;
            Household household        = db.Users.FirstOrDefault(u => u.Id == userId).Household;
            var       userobject       = db.Users.Find(userId);
            var       userTransactions = db.Transactions.Where(t => t.SubmitterUserId == userId);

            foreach (var user in household.Users)
            {
                Users       = new UserData2();
                Users.label = user.FullName;
                Users.value = user.Transactions.Where(t => t.BudgetId == Budget.Id).Where(t => t.Void != true).Select(t => t.Amount).ToList().Sum(s => Convert.ToInt32(s));

                UserChartList.Add(Users);
            }

            //for each user in the user chart list, if none of them have a value greater than 0, then give the current user setting it up a value of 100
            bool usersHaveTransactions = false;

            foreach (var user in UserChartList)
            {
                if (user.value != 0)
                {
                    usersHaveTransactions = true;
                }
            }

            //This is because the morris chart disappears and throws an error if there is no data
            if (!usersHaveTransactions)
            {
                foreach (var user in UserChartList)
                {
                    if (user.label == userobject.FullName)
                    {
                        user.label = "None";
                        user.value = 0;
                        break;
                    }
                }
            }
            ;
            ViewBag.ArrData2 = UserChartList.ToArray();
            List <UserData2> ExpenseChartList = new List <UserData2>();   //Finding Chart Data for a users spending per category
            var       Budget2 = db.Budgets.Find(id);
            UserData2 Expenses;
            Household household2            = db.Users.FirstOrDefault(u => u.Id == userId).Household;
            var       HouseholdUserIds      = db.Users.Where(u => u.HouseholdId == household2.Id).Select(s => s.Id);
            var       BudgetCategories      = Budget2.Transactions.Select(t => t.TransactionCategory).Distinct().Where(tc => tc != null);
            var       DistinctCategoryNames = BudgetCategories.Select(bc => bc.Name).Distinct().ToList();

            //a new budget does not have any transaction categories
            if (DistinctCategoryNames != null && DistinctCategoryNames.Count == 0)
            {
                DistinctCategoryNames.Add("No Categories");
            }

            foreach (var transactioncategory in DistinctCategoryNames)
            {
                Expenses       = new UserData2();
                Expenses.label = transactioncategory;
                var ExpenseList = db.Transactions.ToList().Where(t => t.BudgetId == Budget.Id).Where(t => t.Void != true).Where(t => t.TransactionCategory != null && t.TransactionCategory.Name == transactioncategory).Select(p => p.Amount).Sum(s => Convert.ToInt32(s));

                if (ExpenseList == 0)
                {
                    Expenses.value = 0;
                    Expenses.label = "None";
                }
                else
                {
                    Expenses.value = ExpenseList;
                }

                ExpenseChartList.Add(Expenses);
            }

            ViewBag.ArrData3 = ExpenseChartList.ToArray();

            List <UserData2> DaysLeftList = new List <UserData2>();   //Finding Days Left in Budget Period
            var       Budget3             = db.Budgets.Find(id);
            UserData2 Days;
            string    start          = Budget3.BudgetStartDate.ToShortDateString();
            DateTime  startdate      = DateTime.Parse(start);
            DateTime  expirydate     = Budget3.BudgetEnd;
            string    enddate        = expirydate.ToShortDateString();
            DateTime  now            = DateTime.Now;
            TimeSpan  x              = expirydate - now;
            TimeSpan  y              = now - startdate;
            int       daysremain     = x.Days;
            int       daysintobudget = y.Days;

            Days       = new UserData2();
            Days.label = "Days Remaining in Budget";
            Days.value = daysremain;
            DaysLeftList.Add(Days);

            Days       = new UserData2();
            Days.label = "Days Into Budget";
            Days.value = daysintobudget;
            DaysLeftList.Add(Days);
            ViewBag.ArrData4 = DaysLeftList.ToArray();

            decimal expenditures = 0;

            if (db.Transactions.Where(t => t.BudgetId == id).Any())
            {
                expenditures = db.Transactions.Where(t => t.BudgetId == id).Select(t => t.Amount).Sum();
            }
            if (expenditures == 0)
            {
                ViewBag.TotalExpenses = 0;
            }
            else
            {
                ViewBag.TotalExpenses = expenditures;
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Budget budget = db.Budgets.Find(id);

            if (budget == null)
            {
                return(HttpNotFound());
            }
            return(View(budget));
        }
Beispiel #10
0
        public ActionResult Landing()
        {
            List <TicketData> TicketChartList = new List <TicketData>();



            TicketData TicketData1 = new TicketData();

            var dateago  = DateTime.Now.Date.AddDays(-7).ToString("d");
            var dateago2 = DateTime.Now.Date.AddDays(-6).ToString("d");
            var dateago3 = DateTime.Now.Date.AddDays(-5).ToString("d");
            var dateago4 = DateTime.Now.Date.AddDays(-4).ToString("d");
            var dateago5 = DateTime.Now.Date.AddDays(-3).ToString("d");
            var dateago6 = DateTime.Now.Date.AddDays(-2).ToString("d");
            var dateago7 = DateTime.Now.Date.AddDays(-1).ToString("d");
            var tickets  = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago)
                {
                    tickets.Add(ticket);
                }
            }

            TicketData1.DayofWeek = DateTime.Now.Date.AddDays(-7).DayOfWeek.ToString();
            if (tickets.Count() != 0)
            {
                TicketData1.StatusA = tickets.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData1.StatusB = tickets.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData1.StatusC = tickets.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData1);
            }
            else
            {
                TicketData1.StatusA = 0;
                TicketData1.StatusB = 0;     //makes sense go ahead and apply this to every case ok
                TicketData1.StatusC = 0;
                TicketChartList.Add(TicketData1);
            }

            var tickets2 = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago2)
                {
                    tickets2.Add(ticket);
                }
            }

            TicketData TicketData3 = new TicketData();

            TicketData3.DayofWeek = DateTime.Now.Date.AddDays(-6).DayOfWeek.ToString();
            if (tickets2.Count() != 0)
            {
                TicketData3.StatusA = tickets2.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData3.StatusB = tickets2.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData3.StatusC = tickets2.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData3);
            }
            else
            {
                TicketData3.StatusA = 0;
                TicketData3.StatusB = 0;
                TicketData3.StatusC = 0;
                TicketChartList.Add(TicketData3);
            }

            var tickets3 = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago3)
                {
                    tickets3.Add(ticket);
                }
            }

            TicketData TicketData4 = new TicketData();

            TicketData4.DayofWeek = DateTime.Now.Date.AddDays(-5).DayOfWeek.ToString();

            if (tickets3.Count() != 0)
            {
                TicketData4.StatusA = tickets3.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData4.StatusB = tickets3.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData4.StatusC = tickets3.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData4);
            }
            else
            {
                TicketData4.StatusA = 0;
                TicketData4.StatusB = 0;
                TicketData4.StatusC = 0;
                TicketChartList.Add(TicketData4);
            }


            var tickets4 = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago4)
                {
                    tickets4.Add(ticket);
                }
            }


            TicketData TicketData5 = new TicketData();

            TicketData5.DayofWeek = DateTime.Now.Date.AddDays(-4).DayOfWeek.ToString();
            if (tickets4.Count() != 0)
            {
                TicketData5.StatusA = tickets4.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData5.StatusB = tickets4.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData5.StatusC = tickets4.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData5);
            }
            else
            {
                TicketData5.StatusA = 0;
                TicketData5.StatusB = 0;
                TicketData5.StatusC = 0;
                TicketChartList.Add(TicketData5);
            }


            var tickets5 = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago5)
                {
                    tickets5.Add(ticket);
                }
            }

            TicketData TicketData6 = new TicketData();

            TicketData6.DayofWeek = DateTime.Now.Date.AddDays(-3).DayOfWeek.ToString();
            if (tickets5.Count() != 0)
            {
                TicketData6.StatusA = tickets5.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData6.StatusB = tickets5.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData6.StatusC = tickets5.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData6);
            }
            else
            {
                TicketData6.StatusA = 0;
                TicketData6.StatusB = 0;
                TicketData6.StatusC = 0;
                TicketChartList.Add(TicketData6);
            }

            var tickets6 = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago6)
                {
                    tickets6.Add(ticket);
                }
            }

            TicketData TicketData7 = new TicketData();

            TicketData7.DayofWeek = DateTime.Now.Date.AddDays(-2).DayOfWeek.ToString();
            if (tickets6.Count() != 0)
            {
                TicketData7.StatusA = tickets6.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData7.StatusB = tickets6.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData7.StatusC = tickets6.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData7);
            }
            else
            {
                TicketData7.StatusA = 0;
                TicketData7.StatusB = 0;
                TicketData7.StatusC = 0;
                TicketChartList.Add(TicketData7);
            }

            var tickets7 = new List <Ticket>();

            foreach (var ticket in db.Tickets)
            {
                if (ticket.CreatedDate.ToString("d") == dateago7)
                {
                    tickets7.Add(ticket);
                }
            }

            TicketData TicketData8 = new TicketData();

            TicketData8.DayofWeek = DateTime.Now.Date.AddDays(-1).DayOfWeek.ToString();
            if (tickets7.Count() != 0)
            {
                TicketData8.StatusA = tickets7.Where(t => t.TicketPriority.Name == "Urgent").Count();
                TicketData8.StatusB = tickets7.Where(t => t.TicketPriority.Name == "Normal").Count();
                TicketData8.StatusC = tickets7.Where(t => t.TicketPriority.Name == "Low").Count();
                TicketChartList.Add(TicketData8);
            }
            else
            {
                TicketData8.StatusA = 0;
                TicketData8.StatusB = 0;
                TicketData8.StatusC = 0;
                TicketChartList.Add(TicketData8);
            }


            List <UserData2> UserChartList = new List <UserData2>();
            UserRolesHelper  UH            = new UserRolesHelper(db);

            UserData2 User1      = new UserData2();
            var       AdminCount = UH.UsersInRole("Admin").Count();

            User1.label = "Administrator";
            User1.value = AdminCount;
            UserChartList.Add(User1);

            UserData2 User2     = new UserData2();
            var       DevCount1 = UH.UsersInRole("Developer1").Count();
            var       DevCount2 = UH.UsersInRole("Developer2").Count();
            var       DevCount3 = UH.UsersInRole("Developer3").Count();
            var       DevCount4 = UH.UsersInRole("Developer4").Count();

            User2.label = "Developers";
            User2.value = DevCount1 + DevCount2 + DevCount3 + DevCount4;
            UserChartList.Add(User2);

            UserData2 User3    = new UserData2();
            var       PMCount1 = UH.UsersInRole("Project Manager1").Count();
            var       PMCount2 = UH.UsersInRole("Project Manager2").Count();
            var       PMCount3 = UH.UsersInRole("Project Manager3").Count();


            User3.label = "Project Managers";
            User3.value = PMCount1 + PMCount2 + PMCount3;
            UserChartList.Add(User3);


            UserData2 User4          = new UserData2();
            var       SubmitterCount = UH.UsersInRole("Submitter").Count();

            User4.label = "Submitter";
            User4.value = SubmitterCount;
            UserChartList.Add(User4);



            ViewBag.ArrData2 = UserChartList.ToArray();
            ViewBag.ArrData  = TicketChartList.ToArray();

            UserRolesHelper     helper                    = new UserRolesHelper(db);
            ProjectAssignHelper ph                        = new ProjectAssignHelper();
            var                    userId                 = User.Identity.GetUserId();
            var                    user                   = db.Users.Find(userId);
            var                    userroleAdmin          = helper.IsUserInRole(userId, "Admin") || helper.IsUserInRole(userId, "Administrator");
            var                    userroleDeveloper      = helper.IsUserInRole(userId, "Developer1") || helper.IsUserInRole(userId, "Developer2") || helper.IsUserInRole(userId, "Developer3") || helper.IsUserInRole(userId, "Developer4");
            var                    userroleProjectManager = helper.IsUserInRole(userId, "Project Manager1") || helper.IsUserInRole(userId, "Project Manager2") || helper.IsUserInRole(userId, "Project Manager3");
            var                    userroleSubmitter      = helper.IsUserInRole(userId, "Submitter");
            List <Project>         DeveloperProjects      = new List <Project>();
            List <ApplicationUser> Developers             = helper.UsersInRole("Developer1").Concat(helper.UsersInRole("Developer2")).Concat(helper.UsersInRole("Developer3")).Concat(helper.UsersInRole("Developer4")).ToList();



            List <Ticket>  usertickets  = new List <Ticket>();
            List <Project> userprojects = new List <Project>();

            if (helper.IsUserInRole(userId, "Admin") || helper.IsUserInRole(userId, "Administrator"))
            {
                foreach (var project in db.Projects)
                {
                    if (ph.IsUserOnAProject(userId, project.Id))
                    {
                        userprojects.Add(project);
                    }
                }


                foreach (var ticket in db.Tickets)
                {
                    usertickets.Add(ticket);
                }
                var nonarchivedtickets = usertickets.Where(t => t.TicketStatus.Name != "Archived");
                var urgenttickets      = nonarchivedtickets.Where(t => t.TicketPriority.Name == "Urgent");
                var unassignedtickets  = nonarchivedtickets.Where(t => t.TicketStatus.Name == "Unassigned");
                ViewBag.unassignedticketcount = unassignedtickets.Count();
                ViewBag.ticketcount           = nonarchivedtickets.Count();
                ViewBag.urgentticketcount     = urgenttickets.Count();
                ViewBag.projectcount          = userprojects.Count();
                ViewBag.message           = "in the Bug Tracker system currently.";
                ViewBag.ticketmessage     = "in the Bug Tracker system currently.";
                ViewBag.unassignedmessage = "Unassigned tickets in the Bug Tracker system";
                if (urgenttickets.Count() == 0)
                {
                    ViewBag.urgentmessage = "There are no urgent tickets.";
                }
                else
                {
                    ViewBag.urgentmessage = "Please attend to these tickets if you are assigned to them.";
                }
                return(View(userprojects));
            }

            else if (userroleProjectManager)
            {
                foreach (var x in db.Projects)
                {
                    if (ph.IsUserOnAProject(userId, x.Id))
                    {
                        userprojects.Add(x);
                    }
                }

                foreach (var project in userprojects)
                {
                    foreach (var ticket in project.Tickets)
                    {
                        usertickets.Add(ticket);
                    }
                }
                var nonarchivedtickets = usertickets.Where(t => t.TicketStatus.Name != "Archived");
                var urgenttickets      = nonarchivedtickets.Where(t => t.TicketPriority.Name == "Urgent");
                var unassignedtickets  = nonarchivedtickets.Where(t => t.TicketStatus.Name == "Unassigned");
                ViewBag.unassignedticketcount = unassignedtickets.Count();
                ViewBag.ticketcount           = nonarchivedtickets.Count();
                ViewBag.urgentticketcount     = urgenttickets.Count();
                ViewBag.projectcount          = userprojects.Count();
                ViewBag.ticketmessage         = "for projects that you're working on.";
                ViewBag.message           = "that you're working on.";
                ViewBag.unassignedmessage = "Unassigned tickets in the Bug Tracker system";
                if (urgenttickets.Count() == 0)
                {
                    ViewBag.urgentmessage = "There are no urgent tickets.";
                }
                else
                {
                    ViewBag.urgentmessage = "Please attend to these tickets if you are assigned to them.";
                }

                return(View(userprojects));
            }


            else if (userroleDeveloper)
            {
                foreach (var x in db.Projects)
                {
                    if (ph.IsUserOnAProject(userId, x.Id))
                    {
                        userprojects.Add(x);
                    }
                }

                foreach (var project in userprojects)
                {
                    foreach (var ticket in project.Tickets)
                    {
                        usertickets.Add(ticket);
                    }
                }

                var nonarchivedtickets = usertickets.Where(t => t.TicketStatus.Name != "Archived");
                var urgenttickets      = nonarchivedtickets.Where(t => t.TicketPriority.Name == "Urgent");

                var unassignedtickets = nonarchivedtickets.Where(t => t.TicketStatus.Name == "Unassigned");
                ViewBag.unassignedticketcount = unassignedtickets.Count();
                ViewBag.ticketcount           = nonarchivedtickets.Count();
                ViewBag.urgentticketcount     = urgenttickets.Count();
                var urgentticketscount = urgenttickets.Count();
                ViewBag.projectcount      = userprojects.Count();
                ViewBag.unassignedmessage = "Unassigned tickets in the Bug Tracker system";
                ViewBag.ticketmessage     = "for projects that you're working on.";
                ViewBag.message           = "that you're working on.";
                if (urgentticketscount == 0)
                {
                    ViewBag.urgentmessage = "There are no urgent tickets.";
                }
                else
                {
                    ViewBag.urgentmessage = "Please attend to these tickets if you are assigned to them.";
                }
                return(View(userprojects));
            }

            else if (userroleSubmitter)
            {
                var submittertickets = db.Tickets.Where(t => t.SubmitterUserId == userId).ToList();

                var nonarchivedtickets = submittertickets.Where(t => t.TicketStatus.Name != "Archived");
                var urgenttickets      = nonarchivedtickets.Where(t => t.TicketPriority.Name == "Urgent");
                var unassignedtickets  = nonarchivedtickets.Where(t => t.TicketStatus.Name == "Unassigned");
                ViewBag.unassignedticketcount = unassignedtickets.Count();
                ViewBag.ticketcount           = nonarchivedtickets.Count();
                ViewBag.urgentticketcount     = urgenttickets.Count();
                ViewBag.projectcount          = userprojects.Count();
                ViewBag.ticketmessage         = "that you've submitted.";
                ViewBag.projectmessage        = "N/A";
                ViewBag.urgentmessage         = "N/A";
                ViewBag.unassignedmessage     = "Unassigned tickets in the Bug Tracker system";

                var projects = db.Projects.ToList();
                return(View(projects));
            }
            return(RedirectToAction("Index", "Home"));
        }
        // GET: Budgets/Details/5
        public ActionResult Details(int?id)
        {
            var userId = User.Identity.GetUserId();
            List <UserData2> UserChartList = new List <UserData2>();   //Finding Chart Data for Users in a household's spending amounts
            var       Budget = db.Budgets.Find(id);
            UserData2 Users;
            Household household        = db.Users.FirstOrDefault(u => u.Id == userId).Household;
            var       userobject       = db.Users.Find(userId);
            var       userTransactions = db.Transactions.Where(t => t.SubmitterUserId == userId);

            foreach (var user in household.Users)

            {
                Users       = new UserData2();
                Users.label = user.FullName;
                Users.value = user.Transactions.Where(t => t.BudgetId == Budget.Id).Where(t => t.Void != true).Select(t => t.Amount).ToList().Sum(s => Convert.ToInt32(s));
                UserChartList.Add(Users);
            }

            ViewBag.ArrData2 = UserChartList.ToArray();

            List <UserData2> ExpenseChartList = new List <UserData2>();   //Finding Chart Data for a users spending per category
            var       Budget2 = db.Budgets.Find(id);
            UserData2 Expenses;
            Household household2            = db.Users.FirstOrDefault(u => u.Id == userId).Household;
            var       HouseholdUserIds      = db.Users.Where(u => u.HouseholdId == household2.Id).Select(s => s.Id);
            var       BudgetCategories      = Budget2.Transactions.Select(t => t.TransactionCategory).Distinct().Where(tc => tc != null);
            var       DistinctCategoryNames = BudgetCategories.Select(bc => bc.Name).Distinct().ToList();

            foreach (var transactioncategory in DistinctCategoryNames)
            {
                Expenses       = new UserData2();
                Expenses.label = transactioncategory;
                var ExpenseList = db.Transactions.ToList().Where(t => t.BudgetId == Budget.Id).Where(t => t.Void != true).Where(t => t.TransactionCategory != null && t.TransactionCategory.Name == transactioncategory).Select(p => p.Amount).Sum(s => Convert.ToInt32(s));
                Expenses.value = ExpenseList;
                ExpenseChartList.Add(Expenses);
            }

            ViewBag.ArrData3 = ExpenseChartList.ToArray();

            List <UserData2> DaysLeftList = new List <UserData2>();   //Finding Days Left in Budget Period
            var       Budget3             = db.Budgets.Find(id);
            UserData2 Days;
            string    start          = Budget3.BudgetStartDate.ToShortDateString();
            DateTime  startdate      = DateTime.Parse(start);
            DateTime  expirydate     = Budget3.BudgetEnd;
            string    enddate        = expirydate.ToShortDateString();
            DateTime  now            = DateTime.Now;
            TimeSpan  x              = expirydate - now;
            TimeSpan  y              = now - startdate;
            int       daysremain     = x.Days;
            int       daysintobudget = y.Days;

            Days       = new UserData2();
            Days.label = "Days Remaining in Budget";
            Days.value = daysremain;
            DaysLeftList.Add(Days);

            Days       = new UserData2();
            Days.label = "Days Into Budget";
            Days.value = daysintobudget;
            DaysLeftList.Add(Days);
            ViewBag.ArrData4 = DaysLeftList.ToArray();


            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Budget budget = db.Budgets.Find(id);

            if (budget == null)
            {
                return(HttpNotFound());
            }
            return(View(budget));
        }
 private void NotifyData(UserData2 u2Data)
 {
     BgThreadEventArgs _bgThread2EventArgs;
     //is there any subscriber
     if (this.bgThread2Event == null)
     {
         return;
     }
     try
     {
         queueData qData = new queueData();
         qData.sIP = u2Data.sIP;
         qData.iPingCount = u2Data.iPingCount;
         qData.iPingReplies = u2Data.iPingReplies;
         qData.iPingReplyTime = u2Data.iPingReplyTime;
         qData.iPingTimeout = u2Data.iPingTimeout;
         _bgThread2EventArgs = new BgThreadEventArgs(qData);
         this.bgThread2Event(this, _bgThread2EventArgs);
     }
     catch (MissingMethodException)
     {
     }
 }
        private void SendData2(IntPtr hWnd, int id, queueData qData)
        {
            COPYDATASTRUCT2 data = new COPYDATASTRUCT2();

            data.dwData = id;// 3; // whatever value (have to match receiver end)
            data.cbData = 256; //System.Runtime.InteropServices.Marshal.SizeOf(UserData2);// size of UserData struct

            UserData2 userData = new UserData2();
            if (qData.sIP.Length > 240)
            {
                qData.sIP = qData.sIP.Substring(0, 240);
            }

            userData.sIP = qData.sIP;
            userData.iPingCount = qData.iPingCount;
            userData.iPingReplies = qData.iPingReplies;
            userData.iPingReplyTime = qData.iPingReplyTime;
            userData.iPingTimeout = qData.iPingTimeout;

            //copy data to unmanaged pointers
            data.lpData = Marshal.AllocCoTaskMem(data.cbData);
            Marshal.StructureToPtr( userData, data.lpData, false);

            IntPtr lpData = Marshal.AllocCoTaskMem(Marshal.SizeOf(data));
            Marshal.StructureToPtr(data, lpData, false);

            Message msg1 = Message.Create(hWnd, WM_COPYDATA, lpData, lpData);
            MessageWindow.SendMessage(ref msg1);

            Marshal.FreeCoTaskMem(data.lpData);
            Marshal.FreeCoTaskMem(lpData);
        }
Beispiel #14
0
        /// <summary>
        /// Anahtar kelime üzerinde sorgulama.
        /// </summary>
        /// <param name="loginCredential">İşlemi yapacak olan kullanıcı</param>
        /// <param name="keyOfUser">Key name (örnek: "PLAKA")</param>
        /// <param name="valueOfKey">Key değeri (örnek: "06be5409")</param>
        /// <param name="queryStringOfKey">İlgili key ile ilişkili kullanıcının verileri üzerinde yapılacak sorgu</param>
        /// <param name="data">UserData</param>
        /// <returns></returns>
        public AAA2ErrorCode UserQueryByKey(AAA2Credential loginCredential, string keyOfUser, string valueOfKey, string queryStringOfKey, out UserData2[] data)
        {
            data = null;

            User2 user;
            AAA2ErrorCode error = GetUser(loginCredential, out user);

            if (error != AAA2ErrorCode.OK)
                return error;

            if (!user.KeyQuery)
                return AAA2ErrorCode.PermissionRequired;

            Key k;

            if (_keys.TryGetKey(keyOfUser, out k))
            {
                if (k.Get(valueOfKey, out user))
                {
                    data = user.Data.Search(queryStringOfKey);
                    return AAA2ErrorCode.OK;
                }
                else
                {
                    return AAA2ErrorCode.KeyNotFound;
                }
            }
            else
            {
                return AAA2ErrorCode.KeyNotFound;
            }
        }
Beispiel #15
0
        public AAA2ErrorCode UserQuery(AAA2Credential userCredential, string queryString, out UserData2[] data)
        {
            data = null;

            User2 user;
            AAA2ErrorCode error = GetUser(userCredential, out user);

            if (error != AAA2ErrorCode.OK)
                return error;

            data = user.Data.Search(queryString);

            return AAA2ErrorCode.OK;
        }