public ActionResult ShowDetail(string ID = null)
        {
            int res = Check();

            if (res == 1)
            {
                return(RedirectToAction("Index", "Login"));
            }
            else if (res == 2)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                if (ID == null)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                CommonWork();
                getDepartmentList();

                using (TeacherRewardEntities db = new TeacherRewardEntities()) {
                    AllInfo allinfo = new AllInfo();
                    allinfo.TInfo      = db.TeacherInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TCTask     = db.TeacherCrosswiseTaskInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TPrize     = db.TeacherPrizeInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TProject   = db.TeacherProjectInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TPThesis   = db.TeacherPublishThesisInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TTThesis   = db.TeacherTeachThesisInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TTask      = db.TeacherTaskInfo.Where(x => x.ID == ID).FirstOrDefault();
                    allinfo.TDeduction = db.Deduction.Where(x => x.ID == ID).FirstOrDefault();
                    return(View(allinfo));
                }
            }
        }
Example #2
0
        public async void OnNavigatedTo(INavigationParameters parameters)
        {
            if (App.User == null)
            {
                var response = parameters.GetValue <Player>("player");

                var user = new ViewPlayer
                {
                    Id        = response.Id,
                    FirstName = response.FirstName,
                    LastName  = response.LastName,
                    Picture   = response.Picture,
                    Login     = response.Login
                };

                App.User = user;
            }

            this.User = App.User;
            AllInfo   = await _playerService.GetMobileInfo(this.User.Id);

            PreviousGames = new ObservableCollection <Game>(AllInfo.Where(g => AllInfo.IndexOf(g) != 0));
            var actualGame = AllInfo.Where(g => DateTime.Now >= g.CreationDate && g.FinalTime == null).ToList();

            if (actualGame == null && !actualGame.Any())
            {
                IsInGame = false;
            }
            else
            {
                IsInGame = true;
            }
        }
Example #3
0
        //all data
        private string allData2jsonstr()
        {
            AllInfo allinfo = new AllInfo();

            allinfo.appkey = UmsManager.appkey;
            string ret = "";
            IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;

            if (settings.Contains("clientdata"))
            {
                List <ClientData> list_client_data = (List <ClientData>)settings["clientdata"];
                allinfo.clientData = list_client_data;
            }

            if (settings.Contains("tagdata"))
            {
                List <Tag> list_tag_data = (List <Tag>)settings["tagdata"];
                allinfo.tagListInfo = list_tag_data;
            }


            if (settings.Contains("eventdata"))
            {
                List <Event> list_event_data = (List <Event>)settings["eventdata"];
                allinfo.eventInfo = list_event_data;
            }


            try
            {
                string    err_str = CrashListener.CheckForPreviousException();
                ErrorInfo error   = UmsJson.Deserialize <ErrorInfo>(err_str);
                if (error != null)
                {
                    List <ErrorInfo> err_list = new List <ErrorInfo>();
                    err_list.Add(error);
                    allinfo.errorInfo = err_list;
                }
            }
            catch (Exception e)
            {
                DebugTool.Log(e.Message);
            }


            if (settings.Contains("pageinfo"))
            {
                List <PageInfo> list_pageinfo_data = (List <PageInfo>)settings["pageinfo"];

                allinfo.activityInfo = list_pageinfo_data;
            }
            ret = UmsJson.Serialize(allinfo);
            return(ret);
        }
 private void debug_program()
 {
     allinfo = new AllInfo();
     listview.ItemsSource = allinfo;
     this.type            = 3;
     this.ExtraMsg        = "1 \n 2 \r 333 \n 五山 \n 777 \n 大学城南 \r 3 \n 三号线 \n 703 \n 汉溪长隆 \n" +
                            "7 \n 七号线 \n 14 \n 00:45:00 \n 6.6 \r 3 \n 三号线 \n 1003 \n 这是哪儿 \n" +
                            "10 \n 十号线 \n 18 \n 01:06:00 \n 6.9 \\ 2 \n 2 \r 333 \n 五山 \n 777 \n 大学城南 \r 3 \n 三号线 \n 888 \n 客村 \n" +
                            "8 \n 八号线 \n 401 \n 万胜围 \n 4 \n 四号线 \n 12 \n 00:42:00 \n 6.5 \r 3 \n 三号线 \n 555 \n 珠江新城 \n" +
                            "5 \n 五号线 \n 501 \n 车陂南 \n 4 \n 四号线 \n 12 \n 00:44:00 \n 6.52 ";
     InitListView();
 }
Example #5
0
 /// <summary>
 /// Fonction appelée quand l'utilisateur veut aller sur la page du jeu actuel.
 /// </summary>
 /// <param name="parameters">Id du jeu</param>
 void GoToActualGame(object parameters)
 {
     if (this.IsInGame == true)
     {
         var navigationParams = new NavigationParameters
         {
             { "user", User },
             { "allInfo", AllInfo.FirstOrDefault() }
         };
         this.NavigationService.NavigateAsync(nameof(GamePage), navigationParams);
     }
 }
 private void putCrosswiseTaskInfo(ref AllInfo form, int CTaskLevel)
 {
     if (form.TCTask.CTaskName == null)
     {
         form.TCTask.CTaskName = "无";
     }
     if (form.TCTask.CTaskStartTime == null)
     {
         form.TCTask.CTaskStartTime = "无";
     }
     if (form.TCTask.CTaskEndTime == null)
     {
         form.TCTask.CTaskEndTime = "无";
     }
     form.TCTask.CTaskLevel = ViewBag.CrosswiseTaskList_[CTaskLevel];
 }
        private void putPublishThesisInfo(ref AllInfo form, int[] PThesis, int[] PThesisLevels)
        {
            for (int i = 0; i < 4; i++)
            {
                switch (i)
                {
                case 0:
                    if (form.TPThesis.PublishThesis1Name == null)
                    {
                        form.TPThesis.PublishThesis1Name = "无";
                    }
                    form.TPThesis.PublishThesis1Author = ViewBag.ThesisAuthorList_[PThesis[i]];
                    form.TPThesis.PublishThesis1Type   = ViewBag.PublishThesisLevelList_[PThesisLevels[i]];
                    break;

                case 1:
                    if (form.TPThesis.PublishThesis2Name == null)
                    {
                        form.TPThesis.PublishThesis2Name = "无";
                    }
                    form.TPThesis.PublishThesis2Author = ViewBag.ThesisAuthorList_[PThesis[i]];
                    form.TPThesis.PublishThesis2Type   = ViewBag.PublishThesisLevelList_[PThesisLevels[i]];
                    break;

                case 2:
                    if (form.TPThesis.PublishThesis3Name == null)
                    {
                        form.TPThesis.PublishThesis3Name = "无";
                    }
                    form.TPThesis.PublishThesis3Author = ViewBag.ThesisAuthorList_[PThesis[i]];
                    form.TPThesis.PublishThesis3Type   = ViewBag.PublishThesisLevelList_[PThesisLevels[i]];
                    break;

                case 3:
                    if (form.TPThesis.PublishThesis4Name == null)
                    {
                        form.TPThesis.PublishThesis4Name = "无";
                    }
                    form.TPThesis.PublishThesis4Author = ViewBag.ThesisAuthorList_[PThesis[i]];
                    form.TPThesis.PublishThesis4Type   = ViewBag.PublishThesisLevelList_[PThesisLevels[i]];
                    break;

                default:
                    break;
                }
            }
        }
        private void putTeachThesisInfo(ref AllInfo form, int[] TThesis, int[] TThesisLevels)
        {
            for (int i = 0; i < MAXINPUT; i++)
            {
                switch (i)
                {
                case 0:
                    if (form.TTThesis.TeachThesis1Name == null)
                    {
                        form.TTThesis.TeachThesis1Name = "无";
                    }
                    form.TTThesis.TeachThesis1Author = ViewBag.ThesisAuthorList_[TThesis[i]];
                    form.TTThesis.TeachThesis1Type   = ViewBag.ThesisorMaterialList_[TThesisLevels[i]];
                    break;

                case 1:
                    if (form.TTThesis.TeachThesis2Name == null)
                    {
                        form.TTThesis.TeachThesis2Name = "无";
                    }
                    form.TTThesis.TeachThesis2Author = ViewBag.ThesisAuthorList_[TThesis[i]];
                    form.TTThesis.TeachThesis2Type   = ViewBag.ThesisorMaterialList_[TThesisLevels[i]];
                    break;

                case 2:
                    if (form.TTThesis.TeachThesis3Name == null)
                    {
                        form.TTThesis.TeachThesis3Name = "无";
                    }
                    form.TTThesis.TeachThesis3Author = ViewBag.ThesisAuthorList_[TThesis[i]];
                    form.TTThesis.TeachThesis3Type   = ViewBag.ThesisorMaterialList_[TThesisLevels[i]];
                    break;

                case 3:
                    if (form.TTThesis.TeachThesis4Name == null)
                    {
                        form.TTThesis.TeachThesis4Name = "无";
                    }
                    form.TTThesis.TeachThesis4Author = ViewBag.ThesisAuthorList_[TThesis[i]];
                    form.TTThesis.TeachThesis4Type   = ViewBag.ThesisorMaterialList_[TThesisLevels[i]];
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// 以下收集详细信息
        /// </summary>
        private void putPrizeInfo(ref AllInfo form, int[] Prizes, int[] PrizeLevels)
        {
            for (int i = 0; i < MAXINPUT; i++)
            {
                switch (i)
                {
                case 0:
                    if (form.TPrize.Prize1Name == null)
                    {
                        form.TPrize.Prize1Name = "无";
                    }
                    form.TPrize.Prize1Level = ViewBag.PrizeLevelList_[PrizeLevels[i]];
                    form.TPrize.Prize1Rank  = ViewBag.PrizeList_[Prizes[i]];
                    break;

                case 1:
                    if (form.TPrize.Prize2Name == null)
                    {
                        form.TPrize.Prize2Name = "无";
                    }
                    form.TPrize.Prize2Level = ViewBag.PrizeLevelList_[PrizeLevels[i]];
                    form.TPrize.Prize2Rank  = ViewBag.PrizeList_[Prizes[i]];
                    break;

                case 2:
                    if (form.TPrize.Prize3Name == null)
                    {
                        form.TPrize.Prize3Name = "无";
                    }
                    form.TPrize.Prize3Level = ViewBag.PrizeLevelList_[PrizeLevels[i]];
                    form.TPrize.Prize3Rank  = ViewBag.PrizeList_[Prizes[i]];
                    break;

                case 3:
                    if (form.TPrize.Prize4Name == null)
                    {
                        form.TPrize.Prize4Name = "无";
                    }
                    form.TPrize.Prize4Level = ViewBag.PrizeLevelList_[PrizeLevels[i]];
                    form.TPrize.Prize4Rank  = ViewBag.PrizeList_[Prizes[i]];
                    break;

                default:
                    break;
                }
            }
        }
Example #10
0
        public async Task <IActionResult> ManualRegister(AllInfo student)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            else
            {
                //Remove any spaces in the first
                student.newStudnet.Id         = student.newStudnet.Id.Trim();
                student.newStudnet.Name       = student.newStudnet.Name.Trim();
                student.newStudnet.Pass       = student.newStudnet.Pass.Trim();
                student.newStudnet.RepeatPass = student.newStudnet.RepeatPass.Trim();

                //check if the target user is used before or not
                var targetUser = _dbContext.InfoTable.SingleOrDefault(i => i.Id.Equals(student.newStudnet.Id, StringComparison.CurrentCulture));
                var targetGPA  = _dbContext.InfoTable.SingleOrDefault(i => i.Id.Equals(student.newStudnet.Id, StringComparison.CurrentCulture));
                if (targetUser != null)
                {
                    ViewBag.IdTarget = "This ID is already used";
                    return(View());
                }
                //hash password
                var hasher = new PasswordHasher <InfoTable>();
                targetUser = new InfoTable {
                    Id = student.newStudnet.Id, Name = student.newStudnet.Name, RoleId = 2
                };
                targetUser.Pass = hasher.HashPassword(targetUser, student.newStudnet.Pass);

                //chech the GPA
                if (student.newStudnet.StudentGPA != double.NaN)
                {
                    await GpaSet(student.newStudnet);
                }
                await _dbContext.InfoTable.AddAsync(targetUser);

                await _dbContext.SaveChangesAsync();

                ViewBag.templist = true;
                TempRepository.AddStudent(student.newStudnet);
                ViewBag.inserted = true;
                return(View(new AllInfo
                {
                    Studentslist = TempRepository.Inserted
                }));
            }
        }
 public LineSelect(ClientWindow.TicketQueryInfo ticketQueryInfo, string ExtraMsg,
                   ClientWindow.AllBuyTicket allBuyTicket, int type, string UserID, IPAddress myIPAddress, TcpListener tcpListener
                   , int MyPort, int ServerPort)
 {
     InitializeComponent();
     this.ticketQueryInfo = ticketQueryInfo;
     this.ExtraMsg        = ExtraMsg;
     this.allBuyTicket    = allBuyTicket;
     this.type            = type;
     this.UserID          = UserID;
     this.myIPAddress     = myIPAddress;
     this.tcpListener     = tcpListener;
     this.MyPort          = MyPort;
     this.ServerPort      = ServerPort;
     allinfo = new AllInfo();
     listview.ItemsSource = allinfo;
     InitListView();
 }
        private static void ShowBountyProps(Mobile from, object targeted)
        {
            var pm = targeted as PlayerMobile;

            if (pm == null)
            {
                from.SendMessage("Only players can have bounties.");
                return;
            }

            var bounty = AllInfo.FirstOrDefault(x => x.BountyPlayer == pm);

            if (bounty == null)
            {
                from.SendMessage("That player has no bounty.");
                return;
            }

            from.SendGump(new PropertiesGump(from, bounty));
        }
Example #13
0
        public static void ShowResultsOnConsole(AllInfo a, double[] w, double[] h, double[] d, double[] x, double[] y, double[] z, int[] bno)
        {
            //Show the results of the test on the console window.

            Console.WriteLine("######################################################################################");
            Console.WriteLine("n" + "\t" + "W" + "\t" + "H" + "\t" + "D");
            Console.WriteLine(a.N.ToString() + "\t" + a.W.ToString() + "\t" + a.H.ToString() + "\t" + a.D.ToString());

            Console.WriteLine("w" + "\t" + "h" + "\t" + "d" + "\t" + "x" + "\t" + "y" + "\t" + "z" + "\t" + "bno");
            for (int i = 0; i < a.N; i++)
            {
                Console.WriteLine(w[i].ToString() + "\t" + h[i].ToString() + "\t" + d[i].ToString() + "\t" +
                                  x[i].ToString() + "\t" + y[i].ToString() + "\t" + z[i].ToString() + "\t" +
                                  bno[i].ToString());
            }
            Console.WriteLine("######################################################################################");

            Console.WriteLine("Lower bound:" + "\t" + (a.Stopped ? a.Lb : a.Z).ToString());
            Console.WriteLine("Upper bound:" + "\t" + a.Z.ToString());
            Console.WriteLine("######################################################################################");
            Console.WriteLine("Nodes:" + "\t" + a.Nodes.ToString());
            Console.WriteLine("Subnodes:" + "\t" + a.SubNodes.ToString());
            Console.WriteLine("Iterations:" + "\t" + a.Iterat.ToString());
            Console.WriteLine("Subiterations:" + "\t" + a.SubIterat.ToString());
            Console.WriteLine("######################################################################################");
            Console.WriteLine("Calls to FitsTwo:" + "\t" + a.CallsFitsTwo.ToString());
            Console.WriteLine("Calls to FitsThree:" + "\t" + a.CallsFitsThree.ToString());
            Console.WriteLine("Calls to FitsMore:" + "\t" + a.CallsFitsMore.ToString());
            Console.WriteLine("######################################################################################");
            Console.WriteLine("Overall time:" + "\t" + a.Time.ToString());
            Console.WriteLine("Heuristic time:" + "\t" + a.LayHeurTime.ToString());
            if (a.PackType == 1)
            {
                Console.WriteLine("Robot pack time:" + "\t" + a.RobotTime.ToString());
            }
            else
            {
                Console.WriteLine("General pack time:" + "\t" + a.GeneralTime.ToString());
            }
            Console.WriteLine("######################################################################################");
        }
Example #14
0
        //all data
        private async Task <string> allData2jsonstr()
        {
            AllInfo allinfo = new AllInfo();

            allinfo.appkey = UmsManager.appkey;
            string ret = "";

            Windows.Storage.ApplicationDataContainer settings = Windows.Storage.ApplicationData.Current.LocalSettings;

            allinfo.clientData = await ApplicationSettings.GetSettingFromXmlFileAsync <List <ClientData> >(SettingKeys.CLIENT_DATA, null);

            allinfo.eventInfo = await ApplicationSettings.GetSettingFromXmlFileAsync <List <Event> >(SettingKeys.EVENT_DATA, null);

            allinfo.activityInfo = await ApplicationSettings.GetSettingFromXmlFileAsync <List <PageInfo> >(SettingKeys.PAGE_INFO, null);

            //patch: we nolonger use in storage settings anymore, just remove it for old versions
            ApplicationSettings.RemoveSetting(SettingKeys.CLIENT_DATA);
            ApplicationSettings.RemoveSetting(SettingKeys.EVENT_DATA);
            ApplicationSettings.RemoveSetting(SettingKeys.PAGE_INFO);

            try
            {
                string    err_str = CrashListener.CheckForPreviousException();
                ErrorInfo error   = UmsJson.Deserialize <ErrorInfo>(err_str);
                if (error != null)
                {
                    List <ErrorInfo> err_list = new List <ErrorInfo>();
                    err_list.Add(error);
                    allinfo.errorInfo = err_list;
                }
            }
            catch (Exception e)
            {
                DebugTool.Log(e.Message);
            }

            ret = UmsJson.Serialize(allinfo);
            return(ret);
        }
Example #15
0
 private string makePrintable(AllInfo cuAllInfo)
 {
     return("Name : " + cuAllInfo.name + "\n" + "ID : " + cuAllInfo.id + "\nMobile : " + cuAllInfo.mobile + "\nAge : " + cuAllInfo.age + "\nAddress : " + cuAllInfo.address + "\nGPA : " + cuAllInfo.gpaPoint + "\n");;
 }
        public ActionResult Submit(AllInfo form, int Project1Level, int Project2Level, int Project3Level, int Project4Level, int Task1Level, int Task2Level, int Task3Level, int Task4Level, int CTask, int Task1, int Task2, int Task3, int Task4, int PThesisLevel1, int PThesisLevel2, int PThesisLevel3, int PThesisLevel4, int PThesis1, int PThesis2, int PThesis3, int PThesis4, int TeachingAward, int TeachThesis1Type, int TeachThesis2Type, int TeachThesis3Type, int TeachThesis4Type, int TeachThesis1, int TeachThesis2, int TeachThesis3, int TeachThesis4, int Project1, int Project2, int Project3, int Project4, int PrizeLevel1, int PrizeLevel2, int PrizeLevel3, int PrizeLevel4, int Prize1, int Prize2, int Prize3, int Prize4)
        {
            CommonWork();
            getListsReady();

            //计算各分值
            int[] TeachingTimeScore = Cal_TeachingTimeScore(Convert.ToInt32(form.TInfo.baseTeachingTime));
            int   PrizeScore        = Cal_PrizeScore(new int[] { Prize1, Prize2, Prize3, Prize4 }, new int[] { PrizeLevel1, PrizeLevel2, PrizeLevel3, PrizeLevel4 });

            double[] ProjectScore       = Cal_ProjectScore(new int[] { Project1, Project2, Project3, Project4 });
            int[]    TeachThesisScore   = Cal_TeachThesisScore(new int[] { TeachThesis1, TeachThesis2, TeachThesis3, TeachThesis4 }, new int[] { TeachThesis1Type, TeachThesis2Type, TeachThesis3Type, TeachThesis4Type });
            int      TeachingAwardScore = Cal_TeachingAwardScore(TeachingAward);

            double[] PublishThesisScore = Cal_PublishThesisScore(new int[] { PThesisLevel1, PThesisLevel2, PThesisLevel3, PThesisLevel4 }, new int[] { PThesis1, PThesis2, PThesis3, PThesis4 });
            double[] TaskScore          = Cal_TaskScore(new int[] { Task1, Task2, Task3, Task4 });
            double   CrosswiseTaskScore = Cal_CrosswiseTaskScore(CTask);

            //竞赛、项目、教学论文/教材、发表论文、纵向课题、横向课题的详细信息
            putPrizeInfo(ref form, new int[] { Prize1, Prize2, Prize3, Prize4 }, new int[] { PrizeLevel1, PrizeLevel2, PrizeLevel3, PrizeLevel4 });
            putProjectInfo(ref form, new int[] { Project1, Project2, Project3, Project4 }, new int[] { Project1Level, Project2Level, Project3Level, Project4Level });
            putTeachThesisInfo(ref form, new int[] { TeachThesis1, TeachThesis2, TeachThesis3, TeachThesis4 }, new int[] { TeachThesis1Type, TeachThesis2Type, TeachThesis3Type, TeachThesis4Type });
            putPublishThesisInfo(ref form, new int[] { PThesis1, PThesis2, PThesis3, PThesis4 }, new int[] { PThesisLevel1, PThesisLevel2, PThesisLevel3, PThesisLevel4 });
            putTaskInfo(ref form, new int[] { Task1, Task2, Task3, Task4 }, new int[] { Task1Level, Task2Level, Task3Level, Task4Level });
            putCrosswiseTaskInfo(ref form, CTask);
            form.TCTask.ID = form.TPrize.ID = form.TProject.ID = form.TPThesis.ID = form.TTask.ID = form.TTThesis.ID = userDetails.ID;

            TeacherRewardEntities db = new TeacherRewardEntities();
            //新数据
            TeacherInfo              insertion            = new TeacherInfo();
            TeacherScore             newScore             = new TeacherScore();
            TeacherPrizeInfo         newPrizeInfo         = new TeacherPrizeInfo();
            TeacherProjectInfo       newProjectInfo       = new TeacherProjectInfo();
            TeacherTeachThesisInfo   newTeachThesisInfo   = new TeacherTeachThesisInfo();
            TeacherPublishThesisInfo newPublishThesisInfo = new TeacherPublishThesisInfo();
            TeacherTaskInfo          newTaskInfo          = new TeacherTaskInfo();
            TeacherCrosswiseTaskInfo newCTaskInfo         = new TeacherCrosswiseTaskInfo();
            //重新提交数据
            var curTeacherInfo = db.TeacherInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();
            var curPrizeInfo   = db.TeacherPrizeInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();
            var curProjectInfo = db.TeacherProjectInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();
            var curTThesisInfo = db.TeacherTeachThesisInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();
            var curPThesisInfo = db.TeacherPublishThesisInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();
            var curTaskInfo    = db.TeacherTaskInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();
            var curCTaskInfo   = db.TeacherCrosswiseTaskInfo.Where(x => x.ID == userDetails.ID).FirstOrDefault();

            if (curTeacherInfo != null)
            {
                curTeacherInfo.baseTeachingTime  = TeachingTimeScore[0];
                curTeacherInfo.extTeachingTime   = TeachingTimeScore[1];
                curTeacherInfo.Prize             = PrizeScore;
                curTeacherInfo.baseProject       = ProjectScore[0];
                curTeacherInfo.extProject        = ProjectScore[1];
                curTeacherInfo.baseTeachThesis   = TeachThesisScore[0];
                curTeacherInfo.extTeachThesis    = TeachThesisScore[1];
                curTeacherInfo.TeachingAward     = TeachingAwardScore;
                curTeacherInfo.basePublishThesis = PublishThesisScore[0];
                curTeacherInfo.extPublishThesis  = PublishThesisScore[1];
                curTeacherInfo.baseTask          = TaskScore[0];
                curTeacherInfo.extTask           = TaskScore[1];
                curTeacherInfo.CrosswiseTask     = CrosswiseTaskScore;

                curPrizeInfo   = form.TPrize;
                curProjectInfo = form.TProject;
                curTThesisInfo = form.TTThesis;
                curPThesisInfo = form.TPThesis;
                curTaskInfo    = form.TTask;
                curCTaskInfo   = form.TCTask;
            }
            else
            {
                insertion.ID                = userDetails.ID;
                insertion.Name              = userDetails.Name;
                insertion.Depart            = userDepart.ID;
                insertion.baseTeachingTime  = TeachingTimeScore[0];
                insertion.extTeachingTime   = TeachingTimeScore[1];
                insertion.Prize             = PrizeScore;
                insertion.baseProject       = ProjectScore[0];
                insertion.extProject        = ProjectScore[1];
                insertion.baseTeachThesis   = TeachThesisScore[0];
                insertion.extTeachThesis    = TeachThesisScore[1];
                insertion.TeachingAward     = TeachingAwardScore;
                insertion.basePublishThesis = PublishThesisScore[0];
                insertion.extPublishThesis  = PublishThesisScore[1];
                insertion.baseTask          = TaskScore[0];
                insertion.extTask           = TaskScore[1];
                insertion.CrosswiseTask     = CrosswiseTaskScore;

                newScore.ID         = userDetails.ID;
                newScore.Name       = userDetails.Name;
                newScore.Depart     = userDepart.ID;
                newScore.isSelected = false;

                newCTaskInfo         = form.TCTask;
                newPrizeInfo         = form.TPrize;
                newProjectInfo       = form.TProject;
                newTeachThesisInfo   = form.TTThesis;
                newPublishThesisInfo = form.TPThesis;
                newTaskInfo          = form.TTask;
            }
            //写入数据库
            try {
                if (curTeacherInfo == null)                   //如果没有旧条目,则添加新条目
                {
                    db.TeacherInfo.Add(insertion);
                    db.TeacherScore.Add(newScore);
                    db.TeacherPrizeInfo.Add(newPrizeInfo);
                    db.TeacherProjectInfo.Add(newProjectInfo);
                    db.TeacherPublishThesisInfo.Add(newPublishThesisInfo);
                    db.TeacherTeachThesisInfo.Add(newTeachThesisInfo);
                    db.TeacherTaskInfo.Add(newTaskInfo);
                    db.TeacherCrosswiseTaskInfo.Add(newCTaskInfo);
                }
                db.SaveChanges();
                return(RedirectToAction("Success", "Home"));
            } catch (Exception) {
                return(RedirectToAction("Error", "Home"));
            } finally {
                db.Dispose();
            }
        }
        private void putProjectInfo(ref AllInfo form, int[] Projects, int[] ProjectLevels)
        {
            for (int i = 0; i < MAXINPUT; i++)
            {
                switch (i)
                {
                case 0:
                    if (form.TProject.Project1Name == null)
                    {
                        form.TProject.Project1Name = "无";
                    }
                    if (form.TProject.Project1StartTime == null)
                    {
                        form.TProject.Project1StartTime = "无";
                    }
                    if (form.TProject.Project1EndTime == null)
                    {
                        form.TProject.Project1EndTime = "无";
                    }
                    form.TProject.Project1Level = ViewBag.ProjectLevelList_[ProjectLevels[i]];
                    form.TProject.Project1Role  = ViewBag.ParticipateList_[Projects[i]];
                    break;

                case 1:
                    if (form.TProject.Project2Name == null)
                    {
                        form.TProject.Project2Name = "无";
                    }
                    if (form.TProject.Project2StartTime == null)
                    {
                        form.TProject.Project2StartTime = "无";
                    }
                    if (form.TProject.Project2EndTime == null)
                    {
                        form.TProject.Project2EndTime = "无";
                    }
                    form.TProject.Project2Level = ViewBag.ProjectLevelList_[ProjectLevels[i]];
                    form.TProject.Project2Role  = ViewBag.ParticipateList_[Projects[i]];
                    break;

                case 2:
                    if (form.TProject.Project3Name == null)
                    {
                        form.TProject.Project3Name = "无";
                    }
                    if (form.TProject.Project3StartTime == null)
                    {
                        form.TProject.Project3StartTime = "无";
                    }
                    if (form.TProject.Projectk3EndTime == null)
                    {
                        form.TProject.Projectk3EndTime = "无";
                    }
                    form.TProject.Project3Level = ViewBag.ProjectLevelList_[ProjectLevels[i]];
                    form.TProject.Project3Role  = ViewBag.ParticipateList_[Projects[i]];
                    break;

                case 3:
                    if (form.TProject.Project4Name == null)
                    {
                        form.TProject.Project4Name = "无";
                    }
                    if (form.TProject.Project4StartTime == null)
                    {
                        form.TProject.Project4StartTime = "无";
                    }
                    if (form.TProject.Project4EndTime == null)
                    {
                        form.TProject.Project4EndTime = "无";
                    }
                    form.TProject.Project4Level = ViewBag.ProjectLevelList_[ProjectLevels[i]];
                    form.TProject.Project4Role  = ViewBag.ParticipateList_[Projects[i]];
                    break;

                default:
                    break;
                }
            }
        }
        private void putTaskInfo(ref AllInfo form, int[] Tasks, int[] TaskLevels)
        {
            for (int i = 0; i < MAXINPUT; i++)
            {
                switch (i)
                {
                case 0:
                    if (form.TTask.Task1Name == null)
                    {
                        form.TTask.Task1Name = "无";
                    }
                    if (form.TTask.Task1StartTime == null)
                    {
                        form.TTask.Task1StartTime = "无";
                    }
                    if (form.TTask.Task1EndTime == null)
                    {
                        form.TTask.Task1EndTime = "无";
                    }
                    form.TTask.Task1Level = ViewBag.ProjectLevelList_[TaskLevels[i]];
                    form.TTask.Task1Role  = ViewBag.ParticipateList_[Tasks[i]];
                    break;

                case 1:
                    if (form.TTask.Task2Name == null)
                    {
                        form.TTask.Task2Name = "无";
                    }
                    if (form.TTask.Task2StartTime == null)
                    {
                        form.TTask.Task2StartTime = "无";
                    }
                    if (form.TTask.Task2EndTime == null)
                    {
                        form.TTask.Task2EndTime = "无";
                    }
                    form.TTask.Task2Level = ViewBag.ProjectLevelList_[TaskLevels[i]];
                    form.TTask.Task2Role  = ViewBag.ParticipateList_[Tasks[i]];
                    break;

                case 2:
                    if (form.TTask.Task3Name == null)
                    {
                        form.TTask.Task3Name = "无";
                    }
                    if (form.TTask.Task3StartTime == null)
                    {
                        form.TTask.Task3StartTime = "无";
                    }
                    if (form.TTask.Task3EndTime == null)
                    {
                        form.TTask.Task3EndTime = "无";
                    }
                    form.TTask.Task3Level = ViewBag.ProjectLevelList_[TaskLevels[i]];
                    form.TTask.Task3Role  = ViewBag.ParticipateList_[Tasks[i]];
                    break;

                case 3:
                    if (form.TTask.Task4Name == null)
                    {
                        form.TTask.Task4Name = "无";
                    }
                    if (form.TTask.Task4StartTime == null)
                    {
                        form.TTask.Task4StartTime = "无";
                    }
                    if (form.TTask.Task4EndTime == null)
                    {
                        form.TTask.Task4EndTime = "无";
                    }
                    form.TTask.Task4Level = ViewBag.ProjectLevelList_[TaskLevels[i]];
                    form.TTask.Task4Role  = ViewBag.ParticipateList_[Tasks[i]];
                    break;

                default:
                    break;
                }
            }
        }
Example #19
0
    public static void Calualation()
    {
        GameObject[]   gameObjects   = GameObject.FindObjectsOfType <GameObject> ();
        List <string>  materialnames = new List <string> ();
        List <string>  pngnames      = new List <string> ();
        List <AllInfo> calualation   = new List <AllInfo> ();

        for (int i = 0; i < gameObjects.Length; i++)
        {
            Renderer render = gameObjects[i].GetComponent <Renderer>();
            if (null != render)
            {
                Material   material  = render.sharedMaterial;
                Material[] materials = render.sharedMaterials;
                int        count     = materials.Length;
                for (int j = 0; j < count; j++)
                {
                    if (null != materials[j])
                    {
                        if (materialnames.Contains(materials[j].name))
                        {
                            ;
                        }
                        continue;
                    }
                    materialnames.Add(materials[j].name);
                    AllInfo allinfo = new AllInfo();
                    allinfo.Add(materials[j].name);
                    Shader shader = materials[j].shader;
                    if (null != shader)
                    {
                        int propertyNum = ShaderUtil.GetPropertyCount(shader);
                        for (int k = 0; k < propertyNum; k++)
                        {
                            if (ShaderUtil.GetPropertyType(shader, k) == ShaderUtil.ShaderPropertyType.TexEnv)
                            {
                                string  textureName = ShaderUtil.GetPropertyName(shader, k);
                                Texture texture     = materials[j].GetTexture(textureName);
                                if (null != texture)
                                {
                                    float  texturesize     = Profiler.GetRuntimeMemorySize(texture) / 2048.0f;
                                    string textureRealName = texture.name;
                                    if (!pngnames.Contains(textureRealName))
                                    {
                                        pngnames.Add(textureRealName);
                                        allinfo.Add(textureRealName, texturesize);
                                    }
                                }
                            }
                        }
                    }
                    allinfo.sort();
                    calualation.Add(allinfo);
                }
            }
        }
        AddByDescending(calualation);
        print(calualation);
        PrintToFile(calualation);
        UnityEngine.Debug.LogWarning("Material Number:" + materialnames.Count);
        UnityEngine.Debug.LogWarning("Textures Name:" + pngnames.Count);
        PrintResultes(materialnames, pngnames);
    }
Example #20
0
        /// <summary>
        /// Кнопка поиска
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonFind_Click(object sender, EventArgs e)
        {
            DiskInfo[] diskInfos = this.mFilmotecClass.DiskInfo;
            FilmInfo[] filmInfos = this.mFilmotecClass.GetFilmInfo(0, string.Empty, string.Empty);
            dataGridViewFindFilms.Rows.Clear();

            //
            // Создание полного списка фильмов и дисков
            //
            var result = new List <AllInfo>();

            for (int i = 0; i < filmInfos.Length; i++)
            {
                var temp = new AllInfo
                {
                    DiskNumber = filmInfos[i].Number,
                    DiskInfo   = GetDiskInfo(diskInfos, filmInfos[i].Number),
                    FilmInfo   = filmInfos[i].Info,
                    FilmName   = filmInfos[i].Name,
                    Genre      = filmInfos[i].Genre
                };
                result.Add(temp);
            }

            //
            // Выбрасывание фильмов с неподходящим номером диска
            //
            if (!string.IsNullOrEmpty(textBoxDiskNumber.Text))
            {
                string[] diskNumbers = Helper.ConvertDiskNumbersStringToArray(textBoxDiskNumber.Text);
                for (int i = 0; i < result.Count; i++)
                {
                    bool isNeedRemove = true;
                    foreach (string diskNumber in diskNumbers)
                    {
                        if (result[i].DiskNumber.ToString() == diskNumber)
                        {
                            isNeedRemove = false;
                            break;
                        }
                    }

                    if (isNeedRemove)
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим типом диска
            //
            if (comboBoxDiskInfo.SelectedIndex > 0)
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (!DiskInfoCompare(result[i].DiskInfo, comboBoxDiskInfo.Text))
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим названием фильма
            //
            if (!string.IsNullOrEmpty(textBoxFilmName.Text))
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (IsRemoveFilm(result[i].FilmName, textBoxFilmName.Text, checkBoxNameAll.Checked, checkBoxNameRegistry.Checked))
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим информацией о фильме
            //
            if (!string.IsNullOrEmpty(textBoxFilmInfo.Text))
            {
                for (int i = 0; i < result.Count; i++)
                {
                    if (IsRemoveFilm(result[i].FilmInfo, textBoxFilmInfo.Text, checkBoxInfoAll.Checked, checkBoxInfoRegistry.Checked))
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            //
            // Выбрасывание фильмов с неподходящим жанром
            //
            if (comboBoxFilterGenre.Text != "Все жанры")
            {
                GenreType genreType = Helper.StringToGenre(comboBoxFilterGenre.Text);
                for (int i = 0; i < result.Count; i++)
                {
                    if (result[i].Genre != genreType)
                    {
                        result.RemoveAt(i--);
                    }
                }
            }

            for (int i = 0; i < result.Count; i++)
            {
                var addParams = new[]
                {
                    result[i].DiskNumber.ToString(),
                    DiskTypeToString(result[i].DiskInfo),
                    result[i].FilmName,
                    result[i].FilmInfo
                };
                dataGridViewFindFilms.Rows.Add(addParams);
            }

            labelFindResult.Text = "Результат поиска: " + GetRightNumberCount(result.Count);
        }