Пример #1
0
 public void UpdateInformation(GeneralInformation GeneralInfo,
                               MapInformation MapInfo,
                               CharacterInformation CharInfo)
 {
     if (InvokeRequired)
     {
         Invoke(InvokeControls, GeneralInfo, MapInfo, CharInfo);
     }
     else
     {
         listView1.Items.Clear();
         foreach (string thread in InformationCollecter.Instance.Threads.Keys)
         {
             listView1.Items.Add(new ListViewItem(thread));
         }
         listView2.Clear();
         foreach (string str in GeneralInfo.ToString().Split('\n'))
         {
             listView2.Items.Add(new ListViewItem(str));
         }
         foreach (string str in CharInfo.ToString().Split('\n'))
         {
             listView2.Items.Add(new ListViewItem(str));
         }
         foreach (string str in MapInfo.ToString().Split('\n'))
         {
             listView2.Items.Add(new ListViewItem(str));
         }
     }
 }
Пример #2
0
 private static void BuildPages()
 {
     EnviromentSelection          = new EnviromentSelection();
     GeneralInformation           = new GeneralInformation();
     ListOfMenusAuthorizedForUser = new ListOfMenusAuthorizedForUser();
     Login = new Login();
 }
        public async Task <IActionResult> PostGeneralInformation([FromBody] GeneralInformation generalInformation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.GeneralInformation.Add(generalInformation);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (GeneralInformationExists(generalInformation.AccountId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }
            return(CreatedAtAction("GetGeneralInformation", new { id = generalInformation.AccountId }, generalInformation));
        }
Пример #4
0
        public void AddPublicationToUser(GeneralInformation information, string userId)
        {
            var publication = (TypeOfPublication)System.Enum.Parse(typeof(TypeOfPublication), information.TypeOfPublication);

            if (publication == TypeOfPublication.Article)
            {
                var newspaper = _newspaperRepository.GetNewspaperByArticleId(information.PublicationId);
                _userRepository.AddNewspaperToUser(new UserNewspaper()
                {
                    NewspaperId = newspaper.Id, UserId = userId
                });
            }
            if (publication == TypeOfPublication.Journal)
            {
                _userRepository.AddJournalToUser(new UserJournal()
                {
                    JournalId = information.PublicationId, UserId = userId
                });
            }
            if (publication == TypeOfPublication.Book)
            {
                _userRepository.AddBookToUser(new UserBook()
                {
                    BookId = information.PublicationId, UserId = userId
                });
            }
        }
Пример #5
0
        public ActionResult GeneralInfo(String mensaje)
        {
            if (String.IsNullOrEmpty(mensaje))
            {
                mensaje = "Please, fill your general information in Report Settings.";
            }
            else
            {
                mensaje = mensaje.Trim();
            }

            int contador         = db.GeneralInformations.Count();
            GeneralInformation G = new GeneralInformation();

            if (contador > 0)
            {
                G = db.GeneralInformations.Find(1);
                G.InformacionGen  = mensaje;
                db.Entry(G).State = EntityState.Modified;
                db.SaveChanges();
            }
            else
            {
                G.InformacionGen = mensaje;
                db.GeneralInformations.Add(G);
                db.SaveChanges();
            }
            ViewBag.mensaje = mensaje;
            return(View("Index", db.Services.ToList()));
        }
Пример #6
0
        public async Task <IActionResult> GetListStudent([FromRoute] int roleId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var accountRoles = _context.AccountRoles.Where(ar => ar.RoleId == roleId);

            if (accountRoles == null || accountRoles.Count() == 0)
            {
                return(NotFound());
            }
            var listStudents = new List <GeneralInformation>();

            foreach (var ar in accountRoles)
            {
                var acId = ar.AccountId;
                GeneralInformation listStudent = _context.GeneralInformation.SingleOrDefault(st => st.AccountId == acId);
                if (listStudent == null)
                {
                    return(NotFound());
                }
                listStudents.Add(listStudent);
            }
            if (listStudents == null || listStudents.Count() == 0)
            {
                return(NotFound("yes"));
            }
            return(Ok(listStudents));
        }
Пример #7
0
        public ActionResult EditGeneralInformation(GeneralInformation model)
        {
            if (ModelState.IsValid)
            {
                if (model.UploadImage != null)
                {
                    string newFileName = null;
                    if (_generalHelper.SaveFile(model.UploadImage, ApplicationConstants.InformationDeskResourcesFolder,
                                                out newFileName, model.DefaultImageFilelName))
                    {
                        model.DefaultImageFilelName = newFileName;
                    }
                }

                //working with the description..
                if (String.IsNullOrWhiteSpace(model.ShortDescription))
                {
                    //getting the short description from the description...
                    model.ShortDescription = _generalHelper.ConvertHtmlToPlainText(model.Content, SummaryLength);
                }

                var isSaved = _coreRepository.SaveOrUpdate(model);
                if (isSaved)
                {
                    TempData[ApplicationConstants.SuccessNotification] = ApplicationConstants.SuccessSaveMessage;
                    return(RedirectToAction("GeneralInformation", new { id = model.Id }));
                }
            }

            TempData[ApplicationConstants.ErrorNotification] = ApplicationConstants.ErrorSaveMessage;

            return(View(model));
        }
        public IResult Update(GeneralInformation generalInformation)
        {
            var newGeneralInformation = GetEntityWithMapper(generalInformation);

            _generalInformationDal.Update(newGeneralInformation);

            return(new SuccessResult());
        }
 public void BeginThreads()
 {
     Threads.Add("MapleStory", new Thread(new ThreadStart(() =>
     {
         while (true)
         {
             try
             {
                 Process MapleStory        = Process.GetProcessById(ProcessID);
                 ProcessHandle             = MapleStory.Handle;
                 MainWindowHandle          = MapleStory.MainWindowHandle;
                 GeneralInfo.ProcessHandle = ProcessHandle;
             }
             catch { Environment.Exit(0); }
             Thread.Sleep(100);
         }
     })));
     GeneralInfo = new GeneralInformation();
     Threads.Add("GeneralInformation", new Thread(
                     new ThreadStart(UpdateGeneralInformation)));
     MapInfo = new MapInformation();
     Threads.Add("MapInformation", new Thread(
                     new ThreadStart(UpdateMapInformation)));
     CharInfo = new CharacterInformation();
     Threads.Add("CharacterInformation", new Thread(
                     new ThreadStart(UpdateCharacterInformation)));
     Threads.Add("Position", new Thread(new ThreadStart(() =>
     {
         int CharacterBase = (int)BasePointer.CharacterBase;
         int MonsterBase   = (int)BasePointer.MonsterBase;
         int Mob1          = (int)Offset.Mob1,
         Mob2                  = (int)Offset.Mob2,
         Mob3                  = (int)Offset.Mob3,
         Mob4                  = (int)Offset.Mob4;
         int MouseBase         = (int)BasePointer.MouseBase;
         int MouseLocationBase = (int)Offset.MouseLocation;
         while (true)
         {
             CharInfo.Position = new Point(
                 ReadInt32Pointer(CharacterBase, (int)Offset.CharacterX),
                 ReadInt32Pointer(CharacterBase, (int)Offset.CharacterY));
             UpdatePosition();
             CharInfo.MouseAnimation = ReadInt32Pointer(MouseBase, (int)Offset.MouseAnimation);
             CharInfo.MouseLocation  = new Point(
                 ReadInt32MultiPointer(MouseBase, new int[] { MouseLocationBase, (int)Offset.MouseX }),
                 ReadInt32MultiPointer(MouseBase, new int[] { MouseLocationBase, (int)Offset.MouseY }));
             MapInfo.MobPosition = new Point(
                 ReadInt32MultiPointer(MonsterBase, new int[] { Mob1, Mob2, Mob3, Mob4, (int)Offset.MobX }),
                 ReadInt32MultiPointer(MonsterBase, new int[] { Mob1, Mob2, Mob3, Mob4, (int)Offset.MobY }));
             Thread.Sleep(1);
         }
     })));
     foreach (Thread thread in Threads.Values)
     {
         thread.Start();
     }
 }
Пример #10
0
        public void InsertGeneralInformation(int id, GeneralInformation generalInformation)
        {
            var entity = context.Patients.FirstOrDefault(t => t.Id == id);

            if (entity == null)
            {
                throw new NullReferenceException();
            }

            generalInformation.Id     = 0;
            entity.GeneralInformation = generalInformation;

            context.SaveChanges();
        }
Пример #11
0
        public IHttpActionResult DeleteGeneralDelete(int id)
        {
            //int GeneralInformationId = Convert.ToInt32(id);  
            GeneralInformation generalinformation = objEntity.GeneralInformations.Find(id);

            if (generalinformation == null)
            {
                return(NotFound());
            }

            objEntity.GeneralInformations.Remove(generalinformation);
            objEntity.SaveChanges();

            return(Ok(generalinformation));
        }
Пример #12
0
        public void DeletePublicationFromUser(GeneralInformation information, string userId)
        {
            var publication = (TypeOfPublication)System.Enum.Parse(typeof(TypeOfPublication), information.TypeOfPublication);

            if (publication == TypeOfPublication.Newspaper)
            {
                _userRepository.DeleteNewspaperFromUser(information.PublicationId, userId);
            }
            if (publication == TypeOfPublication.Journal)
            {
                _userRepository.DeleteJournalFromUser(information.PublicationId, userId);
            }
            if (publication == TypeOfPublication.Book)
            {
                _userRepository.DeleteBookFromUser(information.PublicationId, userId);
            }
        }
Пример #13
0
        public IHttpActionResult PostGeneral(GeneralInformation data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                objEntity.GeneralInformations.Add(data);
                objEntity.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }



            return(Ok(data));
        }
Пример #14
0
        public IHttpActionResult GetGeneralById(string generalId)
        {
            GeneralInformation objGen = new GeneralInformation();
            int ID = Convert.ToInt32(generalId);

            try
            {
                objGen = objEntity.GeneralInformations.Find(ID);
                if (objGen == null)
                {
                    return(NotFound());
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(Ok(objGen));
        }
        /// <summary>
        /// If overriding don't forget to call base.Load() or make sure to
        /// assign the WrappedElement.
        /// </summary>
        /// <returns></returns>
        public override ILoadableComponent Load()
        {
            base.Load();
            GeneralInformation.Load();
            GiftCard.Load();
            DownloadableProduct.Load();
            RecurringProduct.Load();
            Rental.Load();
            Prices.Load();
            TierPrices.Load();
            AssociatedProducts.Load();
            Inventory.Load();
            Shipping.Load();
            Mapping.Load();
            AccessControlList.Load();
            RequireOtherProducts.Load();
            RelatedProducts.Load();

            return(this);
        }
Пример #16
0
        public static GeneralInformationView EntityToView(this GeneralInformation entity)
        {
            if (entity != null)
            {
                return(new GeneralInformationView
                {
                    Id = entity.Id,
                    Birthday = entity.Bithday,
                    Weight = entity.Weight,
                    Height = entity.Height,
                    ArterialPressure = entity.ArterialPressure,
                    BloodType = entity.BloodType,
                    PatientId = entity.PatientId,
                    Fluorographies = entity.Fluorographies.EntityToView() ?? new List <FluorographyView>(),
                    VaccinationStatuses = entity.VaccinationStatuses.EntityToView() ?? new List <VaccinationStatusView>(),
                    SurgicalIntervention = entity.SurgicalIntervention.EntityToView() ?? new List <SurgicalInterventionView>()
                });
            }

            return(null);
        }
        /// <remarks>
        /// All models need to have "model" in their variable name
        /// </remarks>
        public IActionResult Index(Statute model, string handler, GeneralInformation generalModel)
        {
            if (generalModel != null)
            {
                model.GeneralInformation = generalModel;
            }



            if (handler == "findPurpose")
            {
                model.PurposeInformation.FindPurpose();
            }
            else if (handler == "finalSubmit")
            {
                var doc = new TextGeneration.Document
                {
                    FontName       = "Verdana",
                    FontSize       = 22,
                    FontSizeHeader = 24
                };

                foreach (string paragraphFileName in Program.GetParagraphResources())
                {
                    var paragraphInfo = Program.ReadJson <TextGeneration.Data.Paragraph>(paragraphFileName);
                    doc.Paragraphs.Add(paragraphInfo.BuildDocumentParagraph(model));
                }

                byte[] result;

                result = System.Text.Encoding.ASCII.GetBytes(doc.Build(model));

                return(File(result, "application/rtf", $"Satzung - {model.GeneralInformation.ClubName}.rtf", true));
            }


            return(View(model));
        }
Пример #18
0
        public IHttpActionResult PutGeneralMaster(GeneralInformation generalinformation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                GeneralInformation objGen = new GeneralInformation();
                objGen = objEntity.GeneralInformations.Find(generalinformation.GeneralInformationID);
                if (objGen != null)
                {
                    objGen.GeneralDesc = generalinformation.GeneralDesc;
                }
                int i = objEntity.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
            return(Ok(generalinformation));
        }
Пример #19
0
        public void AllAttachedFiles_Tests()
        {
            //arrange
            var id   = 1;
            var type = InformationDeskType.GeneralInformation;
            var path = "";

            var generalInformation = new GeneralInformation()
            {
                Id = 1
            };

            var generalInformationAttachements = new List <GeneralInformationAttachment>()
            {
                new GeneralInformationAttachment()
                {
                    FileName         = "fileName",
                    UserFriendlyName = "Friendly Name",
                    Id                 = 15,
                    FileType           = "pdf",
                    GeneralInformation = generalInformation,
                }
            };

            generalInformation.GeneralInformationAttachments.AddAll(generalInformationAttachements);

            _coreRepo.Setup(x => x.Get <GeneralInformation>(id)).Returns(generalInformation);
            _generalHelper.Setup(x => x.GetFolderAndUrlPath(AttachmentType.GeneralInformation, out path, out path));

            //act
            var result = informationDeskController.AllAttachedFiles(id, type) as ViewResult;

            //assert
            Assert.IsNotNull(result, "A View is Important");
            Assert.IsNotNull(result.Model, "We need to have a Model Present");
        }
 private T GetDtoWithMapper <T>(GeneralInformation generalInformation) where T : new()
 {
     return(Mapper.Map <GeneralInformation, T>(GetSingleData(), new T()));
 }
        //[EnableCors("AllowAny")]
        public async Task <IActionResult> PostGeneralInformationInformation([FromRoute] string accountType, [FromBody] GeneralInformation generalInformation)
        {
            string[] allType = { "STU", "MNG", "ADM" };
            if (!allType.Contains(accountType))
            {
                return(BadRequest());
            }

            var numb = await _context.Account.CountAsync(a => a.Id.Contains(accountType)) + 1;

            //Random string
            string RandomString(int length, string method)
            {
                string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

                if (method == "taging")
                {
                    chars = "0123456789";
                }

                Random random = new Random();

                return(new string(Enumerable.Repeat(chars, length)
                                  .Select(s => s[random.Next(s.Length)]).ToArray()));
            }

            //Remove Unsign
            string convertToUnSign3(string s)
            {
                Regex  regex = new Regex("\\p{IsCombiningDiacriticalMarks}+");
                string temp  = s.Normalize(NormalizationForm.FormD);

                return(regex.Replace(temp, String.Empty).Replace('\u0111', 'd').Replace('\u0110', 'D'));
            }

            //Create userName and ID
            var    str      = generalInformation.LastName.Split(" ");
            string userName = generalInformation.FirstName;

            foreach (var item in str)
            {
                if (item.Any())
                {
                    userName += item[0];
                }
            }

            while (true)
            {
                string taging = RandomString(4, "taging");
                taging += convertToUnSign3(generalInformation.FirstName[0].ToString());
                generalInformation.AccountId = accountType + taging;
                if ((await _context.Account.FindAsync(generalInformation.AccountId)) == null)
                {
                    userName = convertToUnSign3(userName) + taging;
                    break;
                }
            }

            var salt = SecurityHandle.PasswordHandle.GetInstance().GenerateSalt();
            // Create PW
            var password = RandomString(8, "PW");


            Account account = new Account()
            {
                Id       = generalInformation.AccountId,
                Username = userName.ToLower(),
                Email    = userName.ToLower() + generalInformation.AccountId.ToLower() + "@gmail.com",
                Salt     = salt,
                Password = SecurityHandle.PasswordHandle.GetInstance().EncryptPassword(password, salt)
            };

            _context.Account.Add(account);
            _context.GeneralInformation.Add(generalInformation);
            AccountRole ar = new AccountRole()
            {
                AccountId = account.Id,
                RoleId    = (accountType == "STU" ? 3 :(accountType == "MNG" ? 2 : 1))
            };

            _context.AccountRoles.Add(ar);
            LoginInformation responceInformation = new LoginInformation()
            {
                Username = account.Username,
                Password = password,
                ClientId = accountType
            };

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException e)
            {
                if (GeneralInformationExists(generalInformation.AccountId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    if (e.InnerException.Message.Contains("Phone"))
                    {
                        return(BadRequest("Số điện thoại không hợp lệ hoặc đã tồn tại."));
                    }

                    return(BadRequest(e.InnerException.Message));
                }
            }


            return(Created("", responceInformation));
        }
Пример #22
0
 public Character(RaceEnum race)
 {
     GeneralInformation = new GeneralInformation();
     Attributes         = Race.GetRace(race).Attributes;
 }
Пример #23
0
 public Character()
 {
     GeneralInformation = new GeneralInformation();
     Attributes         = new StatBlock();
 }
        public async Task <IActionResult> PutGeneralInformation([FromRoute] string id, [FromBody] GeneralInformation generalInformation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != generalInformation.AccountId)
            {
                return(BadRequest());
            }

            _context.Entry(generalInformation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GeneralInformationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }