Ejemplo n.º 1
0
        public ViewResult MiniProfile(int id)
        {
            var user = _userService.GetUser(id);

            if (user == null)
            {
                return(View("MiniUserNotFound"));
            }
            var       profile   = _profileService.GetProfile(user);
            UserImage userImage = null;

            if (profile.ImageID.HasValue)
            {
                userImage = _imageService.GetUserImage(profile.ImageID.Value);
            }
            var model = new DisplayProfile(user, profile, userImage);

            model.PostCount = _postService.GetPostCount(user);
            var viewingUser = _userRetrievalShim.GetUser(HttpContext);

            if (viewingUser == null)
            {
                model.ShowDetails = false;
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult ViewProfile(int id)
        {
            var user = _userService.GetUser(id);

            if (user == null)
            {
                return(NotFound());
            }
            var       profile   = _profileService.GetProfile(user);
            UserImage userImage = null;

            if (profile.ImageID.HasValue)
            {
                userImage = _imageService.GetUserImage(profile.ImageID.Value);
            }
            var model = new DisplayProfile(user, profile, userImage);

            model.PostCount  = _postService.GetPostCount(user);
            model.Feed       = _feedService.GetFeed(user);
            model.UserAwards = _userAwardService.GetAwards(user);
            var viewingUser = _userRetrievalShim.GetUser(HttpContext);

            if (viewingUser == null)
            {
                model.ShowDetails = false;
            }
            return(View(model));
        }
Ejemplo n.º 3
0
 void Start()
 {
     rand           = new System.Random();
     displayProfile = GameObject.Find("DisplayProfile").GetComponent <DisplayProfile> ();
     dogSprites     = new Sprite[4];
     sr.sprite      = dogSprites[rand.Next(0, 4)];
 }
Ejemplo n.º 4
0
 private bool GetProfileName()
 {
     Item.Outputs[0].Profile = DisplayProfile.GetProfileName(SelectedProfile);
     if (string.IsNullOrEmpty(Item.Outputs[0].Profile))
     {
         Description = "プロファイルを選択してください";
         return(false);
     }
     return(true);
 }
Ejemplo n.º 5
0
        public void TestDisplayProfile(uint serial, string header, string body, string footer)
        {
            Serial m        = serial;
            var    expected = new DisplayProfile(m, header, body, footer).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendDisplayProfile(m, header, body, footer);

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Ejemplo n.º 6
0
        public ActionResult View(Guid Id)
        {
            Person CU = reposetory.GetPersonComplete(Id);

            if (CU == null)
            {
                return(RedirectToAction("Index"));
            }

            DisplayProfile Profile = reposetory.GetPersonDisplayProfile(CU.PersonID);

            return(View(Profile));
        }
Ejemplo n.º 7
0
        public ActionResult ViewProfile(String Username)
        {
            Person CU = reposetory.GetPerson(Username);

            if (CU == null)
            {
                return(HttpNotFound());
            }

            DisplayProfile Profile = reposetory.GetPersonDisplayProfile(CU.PersonID);

            return(View("View", Profile));
        }
Ejemplo n.º 8
0
        public ActionResult Create(DisplayProfile displayProfile)
        {
            if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0)
            {
                var file = Request.Files[0];
                var reader = new BinaryReader(file.InputStream);
                displayProfile.Logo = reader.ReadBytes(file.ContentLength);
            }

            if (displayProfile.School != null)
            {
                displayProfile.SchoolMaster = true;
            }
            if (displayProfile.Unit != null)
            {
                //TODO: Do test to make sure a duplicate is not being created.

                if(Repository.OfType<DisplayProfile>().Queryable.Where(a => a.Unit == displayProfile.Unit).Any())
                {
                    ModelState.AddModelError("Department", "Display Profile has already been created for this Department.");
                }
            }

            MvcValidationAdapter.TransferValidationMessagesTo(ModelState, displayProfile.ValidationResults());

            //Moved to domain validation
            // atleast one must be selected
            //if (displayProfile.Unit == null && displayProfile.School == null)
            //{
            //    ModelState.AddModelError("Unit/School", "A Unit or School must be specified.");
            //}

            //// but not both
            //if (displayProfile.Unit != null && displayProfile.School != null)
            //{
            //    ModelState.AddModelError("Unit/School", "Unit and School cannot be selected together.");
            //}

            if (ModelState.IsValid)
            {
                Repository.OfType<DisplayProfile>().EnsurePersistent(displayProfile);
                Message = NotificationMessages.STR_ObjectCreated.Replace(NotificationMessages.ObjectType, "Display Profile");
                return this.RedirectToAction(a => List());
            }
            else
            {
                var viewModel = DisplayProfileViewModel.Create(Repository, _schoolRepository);
                viewModel.DisplayProfile = displayProfile;
                return View(viewModel);
            }
        }
Ejemplo n.º 9
0
        public void ChangeProfile(IEnumerable selectedItems, object profile)
        {
            var profileName = DisplayProfile.GetProfileName(profile);

            foreach (var item in selectedItems.OfType <DisplayQueueItem>().ToArray())
            {
                var file = item.Model;
                Model.Server?.ChangeItem(new ChangeItemData()
                {
                    ItemId     = file.Id,
                    ChangeType = ChangeItemType.Profile,
                    Profile    = profileName
                });
            }
        }
Ejemplo n.º 10
0
        public ViewResult MiniProfile(int id)
        {
            var user = _userService.GetUser(id);

            if (user == null)
            {
                return(View("MiniUserNotFound"));
            }
            var       profile   = _profileService.GetProfile(user);
            UserImage userImage = null;

            if (profile.ImageID.HasValue)
            {
                userImage = _imageService.GetUserImage(profile.ImageID.Value);
            }
            var model = new DisplayProfile(user, profile, userImage);

            model.PostCount = _postService.GetPostCount(user);
            return(View(model));
        }
Ejemplo n.º 11
0
        public ActionResult View(Guid?Id)
        {
            Person CU;

            if (Id == null || Id == Guid.Empty)
            {
                CU = reposetory.GetPersonComplete(CurrentProfile.PersonID);
            }
            else
            {
                CU = reposetory.GetPersonComplete((Guid)Id);
            }
            if (CU == null)
            {
                return(HttpNotFound());
            }

            DisplayProfile Profile = reposetory.GetPersonDisplayProfile(CU.PersonID);

            return(View(Profile));
        }
Ejemplo n.º 12
0
        public ViewResult ViewProfile(int id)
        {
            var user = _userService.GetUser(id);

            if (user == null)
            {
                return(this.NotFound("NotFound", null));
            }
            var       profile   = _profileService.GetProfile(user);
            UserImage userImage = null;

            if (profile.ImageID.HasValue)
            {
                userImage = _imageService.GetUserImage(profile.ImageID.Value);
            }
            var model = new DisplayProfile(user, profile, userImage);

            model.PostCount  = _postService.GetPostCount(user);
            model.Feed       = _feedService.GetFeed(user);
            model.UserAwards = _userAwardService.GetAwards(user);
            return(View(model));
        }
Ejemplo n.º 13
0
        public void TestDisplayProfile(string header, string body, string footer)
        {
            Serial m = 0x1000;

            var data = new DisplayProfile(m, header, body, footer).Compile();

            header ??= "";
            body ??= "";
            footer ??= "";

            var length = 12 + header.Length + footer.Length * 2 + body.Length * 2;

            Span <byte> expectedData = stackalloc byte[length];
            var         pos          = 0;

            expectedData.Write(ref pos, (byte)0xB8);     // Packet ID
            expectedData.Write(ref pos, (ushort)length); // Length
            expectedData.Write(ref pos, m);              // Mobile Serial or Serial.Zero
            expectedData.WriteAsciiNull(ref pos, header);
            expectedData.WriteBigUniNull(ref pos, footer);
            expectedData.WriteBigUniNull(ref pos, body);

            AssertThat.Equal(data, expectedData);
        }
Ejemplo n.º 14
0
        private void saveWorkexperinceDetails(ref SqlConnection _sqlconnection)
        {
            var _employeedetails = new EmployeeDetails();

            _employeedetails.WorkExperience = new Models.WorkExperience
            {
                FirstCompanyName = "Bally",
                From             = "2010",
                To       = "2012",
                Skillset = ".Net"
            };
            _sqlconnection.Open();
            SqlCommand _sqlcommandworkexperience = new SqlCommand("Insert into  WorkExperience(CompanyName,[From],[To],Skillset,EmployeeId) values(@CompanyName,@From,@To,@Skillset,@EmployeeId)", _sqlconnection);

            _sqlcommandworkexperience.Parameters.AddWithValue("@CompanyName", _employeedetails.WorkExperience.FirstCompanyName);
            _sqlcommandworkexperience.Parameters.AddWithValue("@From", Convert.ToInt16(_employeedetails.WorkExperience.From));
            _sqlcommandworkexperience.Parameters.AddWithValue("@To", Convert.ToInt16(_employeedetails.WorkExperience.To));
            _sqlcommandworkexperience.Parameters.AddWithValue("@Skillset", _employeedetails.WorkExperience.Skillset);
            _sqlcommandworkexperience.Parameters.AddWithValue("@EmployeeId", 1);
            var            _workexpereinceResult = _sqlcommandworkexperience.ExecuteNonQuery();
            DisplayProfile displayprofile        = new DisplayProfile();

            displayprofile.Show();
        }
Ejemplo n.º 15
0
        public async void MakeBatchFile()
        {
            string cur    = Directory.GetCurrentDirectory();
            string exe    = Path.GetDirectoryName(GetType().Assembly.Location);
            string dst    = Model.MakeScriptData.OutDir?.TrimEnd(Path.DirectorySeparatorChar);
            string prof   = DisplayProfile.GetProfileName(Model.MakeScriptData.SelectedProfile);
            string bat    = Model.MakeScriptData.Model.AddQueueBat;
            string nas    = null;
            string ip     = "localhost";
            int    port   = Model.ServerPort;
            string subnet = null;
            string mac    = null;
            bool   direct = Model.MakeScriptData.IsDirect;

            if (prof == null)
            {
                Description = "プロファイルを選択してください";
                return;
            }

            if (string.IsNullOrEmpty(dst))
            {
                Description = "出力先が設定されていません";
                return;
            }
            if (Directory.Exists(dst) == false)
            {
                Description = "出力先ディレクトリにアクセスできません";
                return;
            }

            if (Model.MakeScriptData.IsNasEnabled)
            {
                if (string.IsNullOrEmpty(Model.MakeScriptData.NasDir))
                {
                    Description = "NAS保存先を指定してください。";
                    return;
                }
                nas = Model.MakeScriptData.NasDir.TrimEnd(Path.DirectorySeparatorChar);;
            }

            if (IsRemoteClient)
            {
                ip = Model.ServerIP;
                if (Model.MakeScriptData.IsWakeOnLan)
                {
                    var localIP = Model.LocalIP;
                    if (localIP == null)
                    {
                        Description = "IPアドレス取得に失敗";
                        return;
                    }
                    if (localIP.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        Description = "IPv4以外の接続には対応していません";
                        return;
                    }
                    var subnetaddr = ServerSupport.GetSubnetMask(((IPEndPoint)localIP).Address);
                    if (subnetaddr == null)
                    {
                        Description = "サブネットマスク取得に失敗";
                        return;
                    }
                    subnet = subnetaddr.ToString();
                    var macbytes = Model.MacAddress;
                    if (macbytes == null)
                    {
                        Description = "MACアドレス取得に失敗";
                        return;
                    }
                    mac = string.Join(":", macbytes.Select(s => s.ToString("X")));
                }
            }

            Description = "";

            var sb = new StringBuilder();

            if (direct)
            {
                sb.Append("rem _EDCBX_DIRECT_\r\n");
            }
            sb.AppendFormat("\"{0}\\AmatsukazeAddTask.exe\"", exe)
            .AppendFormat(" -r \"{0}\"", cur)
            .AppendFormat(" -f \"{0}FilePath{0}\" -ip \"{1}\"", direct ? "%" : "$", ip)
            .AppendFormat(" -p {0}", port)
            .AppendFormat(" -o \"{0}\"", dst)
            .AppendFormat(" -s \"{0}\"", prof)
            .AppendFormat(" --priority {0}", Model.MakeScriptData.Priority);
            if (nas != null)
            {
                sb.AppendFormat(" -d \"{0}\"", nas);
            }
            if (mac != null)
            {
                sb.AppendFormat(" --subnet \"{0}\"", subnet)
                .AppendFormat(" --mac \"{0}\"", mac);
            }
            if (Model.MakeScriptData.MoveAfter == false)
            {
                sb.Append(" --no-move");
            }
            if (Model.MakeScriptData.ClearSucceeded)
            {
                sb.Append(" --clear-succeeded");
            }
            if (Model.MakeScriptData.WithRelated)
            {
                sb.Append(" --with-related");
            }
            if (!string.IsNullOrEmpty(bat))
            {
                sb.AppendFormat(" -b \"{0}\"", bat);
            }

            var saveFileDialog = new SaveFileDialog();

            saveFileDialog.FilterIndex = 1;
            saveFileDialog.Filter      = "バッチファイル(.bat)|*.bat|All Files (*.*)|*.*";
            bool?result = saveFileDialog.ShowDialog();

            if (result != true)
            {
                return;
            }

            try
            {
                File.WriteAllText(saveFileDialog.FileName, sb.ToString(), Encoding.Default);
            }
            catch (Exception e)
            {
                Description = "バッチファイル作成に失敗: " + e.Message;
                return;
            }

            var resvm = new MakeBatchResultViewModel()
            {
                Path = saveFileDialog.FileName
            };

            await Messenger.RaiseAsync(new TransitionMessage(
                                           typeof(Views.MakeBatchResultWindow), resvm, TransitionMode.Modal, "Key"));

            await Model.SendMakeScriptData();
        }