public ActionResult Create(PersonFile File)
        {
            string fileName = File.Name;

            string path  = string.Format("~\\images\\{0}\\", File.Name);
            string Dpath = Server.MapPath(path);

            if (!Directory.Exists(Dpath))
            {
                Directory.CreateDirectory(Dpath);
            }
            string adharfile = Path.GetFileName(File.Adhar.FileName);
            string panfile   = Path.GetFileName(File.Pan.FileName);
            string voterfile = Path.GetFileName(File.Voter.FileName);

            File.Adhar.SaveAs(Dpath + adharfile);
            File.Pan.SaveAs(Dpath + panfile);
            File.Voter.SaveAs(Dpath + voterfile);

            if (File != null)
            {
                var data = File;
                data.Name         = File.Name;
                data.AdharCardPDF = fileName + "/" + adharfile;
                data.PanCard      = fileName + "/" + panfile;
                data.VoterCard    = fileName + "/" + voterfile;
                db.PersonFiles.Add(data);
                db.SaveChanges();
            }

            ModelState.Clear();

            return(View());
        }
Пример #2
0
        public bool AddPersonDetails(PersonDetail objPerson, HttpPostedFileBase file)
        {
            var db = new PersonDetailsDBEntities();

            using (var transaction = _dbContext.Database.BeginTransaction())
            {
                try
                {
                    _dbPerson.Insert(objPerson);

                    _unitOfWork.SaveChanges();

                    PersonFile objFile = UploadFile(objPerson, file);

                    _dbFile.Insert(objFile);
                    _unitOfWork.SaveChanges();
                    transaction.Commit();

                    return(true);
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    //log status
                }
            }
        }
Пример #3
0
        public MainWindow()
        {
            InitializeComponent( );

            IData personFile = new PersonFile();

            IView view = new View.View();

            Controller.Controller controller = new Controller.Controller(window: this, person_file: personFile, view: view);

            controller.ImageArray.Add(Image.folder, "../Image/folder.png");
            controller.ImageArray.Add(Image.music, "../Image/music.png");
            controller.ImageArray.Add(Image.textFile, "../Image/document.png");
            controller.ImageArray.Add(Image.hard_drive, "../Image/drive.png");

            controller.printFile("\\");

            file_list.MouseDoubleClick += list_Item_Selected;

            ButtonBack.Click += pressButtonBack;

            MenuItemOpen.Click += pressButtonMenuItemListViewOpen;

            /*MenuItemCopy.Click += pressButtonMenuItemListViewCopy;
             *
             * MenuItemDelete.Click += pressButtonMenuItemListViewDelete;
             *
             * MenuItemMove.Click += pressButtonMenuItemListViewMove;
             */
            MenuItemProperty.Click += pressButtonMenuItemListViewProperty;
        }
Пример #4
0
    void LoadingFromFile(Person person, PersonFile pF)
    {
        _person = person;
        LoadAttributes(pF.ProfessionProp);

        //so the detecting CheckIfShouldReDoProf() works
        FindSpawnersToMine();
    }
Пример #5
0
    private void LoadingFromFile(Person person, PersonFile pF)
    {
        _wasLoaded = true;

        _person = person;
        LoadAttributes(pF.ProfessionProp);
        InitForLoading();
    }
Пример #6
0
    void FileNewOnClick(object objSrc, EventArgs args)
    {
        PersonFile persfile = new PersonFile();

        persfile.Persons.Add(new Person());

        bindsrc.DataSource = persfile;
        bindsrc.DataMember = "Persons";
    }
Пример #7
0
        public void TestMethod2()
        {
            PersonFile file = new PersonFile( );

            string path = "D:\\Test";

            string msg = path + "\\1.txt";

            Assert.AreEqual(msg, file.getFile(path) [1]);
        }
Пример #8
0
 public static void InitPerson()
 {
     string[] skills = Directory.GetFiles(PERSON_PATH, DATAEXT);
     PERSONS = new List <Person>();
     foreach (string path in skills)
     {
         PersonFile pf = new PersonFile(path);
         PERSONS.AddRange(pf.persons);
     }
 }
Пример #9
0
 public Builder(Person person, PersonFile pF)
 {
     if (pF == null)
     {
         CreatingNew(person);
     }
     else
     {
         LoadingFromFile(person, pF);
     }
 }
Пример #10
0
        public ActionResult Index(int?Id)
        {
            PersonFile person = new PersonFile();

            var idFile = db.PersonFiles.ToList();

            ViewBag.Names = new SelectList(idFile, "FileID", "Name");
            var files = db.PersonFiles.FirstOrDefault(p => p.FileID == Id);

            return(View());
        }
Пример #11
0
 public FisherMan(Person person, PersonFile pF)
 {
     if (pF == null)
     {
         CreatingNew(person);
     }
     else
     {
         LoadingFromFile(person, pF);
     }
 }
Пример #12
0
    private void LoadingFromFile(Person person, PersonFile pF)
    {
        _person = person;
        LoadAttributes(pF.ProfessionProp);

        //needs to redo the Family on _constructing
        var oldBuild = Brain.GetBuildingFromKey(_person.Brain.MoveToNewHome.OldHomeKey);
        var myFamily = oldBuild.FindMyFamilyChecksFamID(_person);

        //var newFam = new Family(3, _constructing.MyId);
        //_constructing.Families = new Family[]{newFam};
    }
Пример #13
0
 public WheelBarrow(Person person, PersonFile pF)
 {
     if (pF == null)
     {
         _person = person;
         Init();
     }
     else
     {
         LoadingFromFile(person, pF);
     }
 }
Пример #14
0
    private void LoadingFromFile(Person person, PersonFile pF)
    {
        _wasLoaded = true;

        _person = person;
        LoadAttributes(pF.ProfessionProp);

        if (_destinyBuild == null || _sourceBuild == null)
        {
            _takeABreakNow = true;
            return;
        }

        InitRoute();
    }
Пример #15
0
        private static PersonFile UploadFile(PersonDetail objPerson, HttpPostedFileBase file)
        {
            var fileName = Path.GetFileName(file.FileName);
            var path     = Path.Combine(HttpContext.Current.Server.MapPath("~/PersonFiles"), fileName);

            file.SaveAs(path);
            var objFile = new PersonFile()
            {
                FileName = fileName,
                IsActive = true,
                PersonId = objPerson.Id
            };

            return(objFile);
        }
Пример #16
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PersonFile = await _context.PersonFile.AsNoTracking()
                         .Include(p => p.Person).FirstOrDefaultAsync(m => m.Id == id);

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

            return(PhysicalFile(_appFileHandler.GetFilePath(PersonFile), "image/jpeg"));
        }
Пример #17
0
        public async Task <IActionResult> OnPostAsync(Guid?id, Guid personId)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PersonFile = await _context.PersonFile.FindAsync(id);

            if (PersonFile != null)
            {
                PersonFile.IsDeleted = true;
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index", new { personId }));
        }
Пример #18
0
        public async Task <IActionResult> OnGetAsync(Guid?id, Guid personId)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PersonFile = await _context.PersonFile
                         .Include(p => p.Person).FirstOrDefaultAsync(m => m.Id == id);

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

            ViewData["PersonId"] = personId;
            return(Page());
        }
        /// <summary>
        /// 获取会员档案
        /// </summary>
        /// <returns></returns>
        public BaseResponse <PersonFile> GetFileInfo(string idno)
        {
            Random rd        = new Random();
            var    once      = rd.Next().ToString();
            var    timeStamp = string.Format("{0:yyyyMMddHHmmss}", DateTime.Now);
            var    token     = Util.GetHealthToken(HealthRecordSecretKey, timeStamp, once);

            BaseResponse <PersonFile> response = new BaseResponse <PersonFile>();
            string Address = string.Format("{0}/api/hlthrecord/person?idno={1}&appid={2}&timeStamp={3}&once={4}&token={5}", Url, idno, AppID, timeStamp, once, token);
            string Json    = CallService(Address);
            WebPersonFileResponse JsonData   = (WebPersonFileResponse)JsonConvert.DeserializeObject(Json, typeof(WebPersonFileResponse));
            PersonFile            PersonFile = JsonData.Data;

            if (PersonFile == null)
            {
                PersonFile = new PersonFile();
            }
            response.Data = PersonFile;
            return(response);
        }
Пример #20
0
    private void LoadingFromFile(Person person, PersonFile pF)
    {
        _person = person;

        LoadAttributes(pF.ProfessionProp);

        //so drops stuff in there
        BuildToGoBackTo = BuildToGoBackToDefine();

        var router1    = Router1 == null && Router1.TheRoute == null;
        var routerBack = RouterBack == null && RouterBack.TheRoute == null;

        if (_person.PrevJob == Job.Farmer && _person.Work != null && _person.Work.MyId.Contains("Farm") &&
            WorkerTask == HPers.None   //standing in field
            )
        {
            FinRoutePoint = DefineFinRoute();
            InitRoute();
        }
    }
Пример #21
0
    /// <summary>
    /// Loading
    /// </summary>
    /// <param name="brain"></param>
    /// <param name="person"></param>
    /// <param name="moveToNewHome"></param>
    /// <param name="pF"></param>
    public MajorityAgeReached(Brain brain, Person person, MoveToNewHome moveToNewHome, PersonFile pF)
    {
        _person        = person;
        _brain         = brain;
        _moveToNewHome = moveToNewHome;

        MajorityAgeRecentReached = pF._brain.MajorAge.MajorityAgeRecentReached;
    }
Пример #22
0
 void LoadingFromFile(Person person, PersonFile pF)
 {
     _person = person;
     LoadAttributes(pF.ProfessionProp);
 }
Пример #23
0
        public void TestMethod3()
        {
            PersonFile file = new PersonFile( );

            Assert.AreEqual(String.Empty, file.fileRead(String.Empty));
        }