public static Page CreatePage(string pageType)
        {
            Console.WriteLine($"Creating a {pageType} page.");
            Page page = null;

            switch (pageType.ToLower())
            {
            case "cover letter":
                page = new CoverLetter();
                break;

            case "references":
                page = new References();
                break;

            case "work history":
                page = new WorkHistory();
                break;

            case "summary":
                page = new Summary();
                break;

            default:
                break;
            }

            return(page);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutWorkHistory([FromRoute] Guid id, [FromBody] WorkHistory workHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != workHistory.WorkHistoryId)
            {
                return(BadRequest());
            }

            try
            {
                await _repo.WorkHistory.UpdateWorkHistoryAsync(workHistory);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkHistoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
        public WorkHistory GetWorkHistoryById(int id)
        {
            using (var conn = Connection)
            {
                conn.Open();
                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                       SELECT Id, UserId, JobTitle, Company, Location, StartMonth, StartYear, EndMonth, EndYear, [Current], Description
                         FROM WorkHistory
                        WHERE Id = @Id";

                    DbUtils.AddParameter(cmd, "@Id", id);

                    WorkHistory workHistory = null;

                    var reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        workHistory = NewWorkHistoryFromReader(reader);
                    }
                    reader.Close();

                    return(workHistory);
                }
            }
        }
        public async Task <ActionResult <WorkHistory> > PostWorkHistory(WorkHistory workHistory)
        {
            _context.WorkHistories.Add(workHistory);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWorkHistory", new { id = workHistory.Id }, workHistory));
        }
Exemplo n.º 5
0
        private void ICD_ProcWorkHistory(int clientID, HEADER obj)
        {
            string    user   = obj.msgUser;
            int       taskID = int.Parse(obj.ext1);
            DataTable table  = DatabaseMgr.GetTaskHistory(taskID);

            if (table == null)
            {
                return;
            }

            List <WorkHistory> vec = new List <WorkHistory>();

            foreach (DataRow item in table.Rows)
            {
                WorkHistory his = new WorkHistory();
                his.recordID   = (int)item["recordID"];
                his.taskID     = (int)item["taskID"];
                his.time       = item["time"].ToString();;
                his.editor     = item["user"].ToString();
                his.columnName = item["columnName"].ToString();
                his.fromInfo   = item["fromInfo"].ToString();
                his.toInfo     = item["toInfo"].ToString();

                vec.Add(his);
            }

            WorkHistoryList msg = new WorkHistoryList();

            msg.FillServerHeader(DEF.CMD_TaskHistory, 0);
            msg.workHistory = vec.ToArray();
            sendMsg(user, msg);
        }
        public async Task <IActionResult> PutWorkHistory(int id, WorkHistory workHistory)
        {
            if (id != workHistory.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public static Page CreatePage(string type)
        {
            Page page = null;

            switch (type)
            {
            case "Work History":
                page = new WorkHistory();
                break;

            case "Education":
                page = new Education();
                break;

            case "Cover Letter":
                page = new CoverLetter();
                break;

            case "Volunteer":
                page = new Volunteer();
                break;

            default:
                break;
            }

            return(page);
        }
Exemplo n.º 8
0
        public void ChangeTracking_EntitySubCollectionTracking()
        {
            var wh = new WorkHistory {
                Name = "Avanade"
            };
            var pd = new PersonDetail {
                History = new WorkHistoryCollection {
                    wh
                }
            };

            pd.AcceptChanges();
            Assert.IsFalse(pd.IsChanged);
            Assert.IsFalse(pd.History.IsChanged);
            Assert.IsFalse(wh.IsChanged);

            pd.TrackChanges();
            wh.Name = "Accenture";
            Assert.IsTrue(wh.IsChanged);
            Assert.AreEqual(new System.Collections.Specialized.StringCollection {
                "Name"
            }, wh.ChangeTracking);
            Assert.IsTrue(pd.History.IsChanged);
            Assert.IsNull(pd.History.ChangeTracking); // Collections always return null.
            Assert.IsTrue(pd.IsChanged);
            Assert.AreEqual(new System.Collections.Specialized.StringCollection {
                "History"
            }, pd.ChangeTracking);
        }
Exemplo n.º 9
0
        public void Add(WorkHistory workHistory)
        {
            using (var conn = Connection)
            {
                conn.Open();
                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"INSERT INTO WorkHistory (JobTitle, UserId, Company, Location, StartMonth,
                                                                 StartYear, EndMonth, EndYear, [Current], Description)
                                        OUTPUT INSERTED.ID
                                        VALUES (@JobTitle, @UserId, @Company, @Location, @StartMonth, @StartYear, @EndMonth, @EndYear, @Current, @Description)";
                    DbUtils.AddParameter(cmd, "@JobTitle", workHistory.JobTitle);
                    DbUtils.AddParameter(cmd, "@UserId", workHistory.UserId);
                    DbUtils.AddParameter(cmd, "@Company", workHistory.Company);
                    DbUtils.AddParameter(cmd, "@Location", workHistory.Location);
                    DbUtils.AddParameter(cmd, "@StartMonth", workHistory.StartMonth);
                    DbUtils.AddParameter(cmd, "@StartYear", workHistory.StartYear);
                    DbUtils.AddParameter(cmd, "@EndMonth", workHistory.EndMonth);
                    DbUtils.AddParameter(cmd, "@EndYear", workHistory.EndYear);
                    DbUtils.AddParameter(cmd, "@Current", workHistory.Current);
                    DbUtils.AddParameter(cmd, "@Description", workHistory.Description);

                    workHistory.Id = (int)cmd.ExecuteScalar();
                }
            }
        }
Exemplo n.º 10
0
        public Result <WorkHistory> Save(WorkHistory userinfo)
        {
            var result = new Result <WorkHistory>();

            try
            {
                _context.workHistories.FirstOrDefault(u => u.UserId == userinfo.UserId);
                var objtosave = _context.workHistories.FirstOrDefault(u => u.UserId == userinfo.UserId);
                if (objtosave == null)
                {
                    objtosave = new WorkHistory();
                    _context.workHistories.Add(objtosave);
                }
                objtosave.CompanyName = userinfo.CompanyName;
                objtosave.Position    = userinfo.Position;
                objtosave.Experience  = userinfo.Experience;
                objtosave.UserId      = userinfo.UserId;



                if (!IsValid(objtosave, result))
                {
                    return(result);
                }
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                result.HasError = true;
                result.Message  = ex.Message;
            }
            return(result);
        }
Exemplo n.º 11
0
        public ActionResult DeleteConfirmed(int id)
        {
            WorkHistory workHistory = db.WorkHistories.Find(id);

            db.WorkHistories.Remove(workHistory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
 public WorkHistoryList(int n = 1)
 {
     workHistory = new WorkHistory[n];
     for (int i = 0; i < n; ++i)
     {
         workHistory[i] = new WorkHistory();
     }
 }
Exemplo n.º 13
0
    public static void GenerateWorkHistoryRepository(ACSContext Context)
    {
        //все должности
        var query = (from dUser in DataLoader1C.Data.Сотрудники
                     from wh in dUser.КадроваяИстория
                     orderby wh.Дата
                     select new
        {
            КодПодразделения = wh.КодПодразделения,
            Должность = wh.Должность,
            КодФизЛицо = dUser.КодФизЛицо,
            Код = Guid.Parse(dUser.Код),
            ДатаНачала = wh.Дата,
            ДатаОкончания = GetEndDateWorkHistory(dUser, wh),
            Ставка = wh.Ставка
        });

        foreach (var WorkHistory in query)
        {
            if (string.IsNullOrEmpty(WorkHistory.КодПодразделения.ToString()))
            {
                continue;
            }

            Department department = Context.Departments.FirstOrDefault(d => d.Code1C == WorkHistory.КодПодразделения);

            if (department == null)
            {
                continue;
            }

            //КодДолжности1С
            PostsEmployeesСode1С PUC = Context.PostsEmployeesСode1С.FirstOrDefault
                                           (puc => puc.CodePost1C == WorkHistory.Код);

            if (PUC == null)
            {
                continue;
            }

            var wh = new WorkHistory()
            {
                Department = department,
                PostName   = WorkHistory.Должность,
                StartDate  = XMLDataTypeConverter.GetDateTime(WorkHistory.ДатаНачала),
                EndDate    = WorkHistory.ДатаОкончания,
                Rate       = double.Parse(WorkHistory.Ставка),

                PostsEmployeesСode1С = PUC,
                s_AuthorID           = 1,
                s_EditorID           = 1
            };


            Context.WorkHistories.Add(wh);
            Context.SaveChanges();
        }
    }
Exemplo n.º 14
0
 public IActionResult Put(int id, WorkHistory workHistory)
 {
     if (id != workHistory.Id)
     {
         return(BadRequest());
     }
     _workHistoryRepo.Update(workHistory);
     return(NoContent());
 }
Exemplo n.º 15
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            WorkHistory workHistory = await db.WorkHistories.FindAsync(id);

            db.WorkHistories.Remove(workHistory);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 16
0
        protected override void Seed(CmsDbContext context)
        {
            var customers = new Customer[] {
                new Customer {
                    Name = "東京太郎", Address = "東京都"
                },
                new Customer {
                    Name = "埼玉太郎", Address = "埼玉県"
                },
                new Customer {
                    Name = "千葉太郎", Address = "千葉県"
                },
            };

            foreach (var c in customers)
            {
                context.Customers.Add(c);
            }
            context.SaveChanges();
            var cars = new Car[] {
                new Car {
                    Customer = customers[0], Number = "東京50 あ 46-49", Name = "クラウン1", Color = "黒", StoredDate = DateTime.Today
                },
                new Car {
                    Customer = customers[0], Number = "東京50 あ 46-50", Name = "クラウン2", Color = "黒", StoredDate = DateTime.Today
                },
                new Car {
                    Customer = customers[0], Number = "東京50 あ 46-51", Name = "クラウン3", Color = "黒", StoredDate = DateTime.Today
                },
                new Car {
                    Customer = customers[1], Number = "埼玉50 あ 46-49", Name = "クラウン4", Color = "赤", StoredDate = DateTime.Today
                },
                new Car {
                    Customer = customers[2], Number = "千葉50 あ 46-49", Name = "クラウン5", Color = "白", StoredDate = DateTime.Today
                },
            };

            foreach (var c in cars)
            {
                context.Cars.Add(c);
            }
            context.SaveChanges();
            var histories = new WorkHistory[] {
                new WorkHistory {
                    Car = cars[0], DistanceTraveled = 123, Quantity = 4, UnitCost = 5000, Size = "10", Work = "タイヤ交換"
                },
                new WorkHistory {
                    Car = cars[0], DistanceTraveled = 123, Quantity = 4, UnitCost = 1000, Size = "-", Work = "掃除"
                },
            };

            foreach (var h in histories)
            {
                context.WorkHistories.Add(h);
            }
            context.SaveChanges();
        }
Exemplo n.º 17
0
 /// <summary>
 /// To update work history details of the jobseeker
 /// </summary>
 /// <param name="id">WorkHistoryId</param>
 /// <param name="jobSeekerWorkHistoryObj">WorkHistoryObject</param>
 public void Put(string id, WorkHistory jobSeekerWorkHistoryObj)
 {
     try
     {
         jobSeekerWorkHistoryObj.JobSeekerId = SkillsmartUser.GuidStr(HttpContext.Current.User);
         jobSeekerWorkHistoryObj.Id          = new Guid(id);
         ServiceFactory.GetJobSeekerWorkHistory().Update(jobSeekerWorkHistoryObj);
     }
     catch (Exception exp) {}
 }
Exemplo n.º 18
0
 public ActionResult Edit([Bind(Include = "Id,Employer,Title,StartDate,EndDate,Description")] WorkHistory workHistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workHistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workHistory));
 }
Exemplo n.º 19
0
            private void AddReportState(WorkHistory workHis)
            {
                string[]   data = workHis.toInfo.Split(',', (char)2);
                ReportInfo rep  = new ReportInfo();

                rep.time    = DateTime.Parse(data[0]);
                rep.type    = workHis.columnName;
                rep.message = data[1];
                reports.Add(rep);
            }
Exemplo n.º 20
0
        public CalendarViewModel GetCalendarViewModel(bool displayX = true, int?height = null)
        {
            CalendarViewModel viewModel = new CalendarViewModel();

            viewModel.WorkHistory   = WorkHistory.Where(p => p.Status == PomodoroStatus.Completed);
            viewModel.Mode          = CalendarViewMode.ViewNumber;
            viewModel.ContainerType = PomodoroContainerType.Workspace;
            viewModel.DisplayX      = displayX;
            viewModel.Height        = height;
            return(viewModel);
        }
Exemplo n.º 21
0
        public async Task <IActionResult> PostWorkHistory([FromBody] WorkHistory workHistory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _repo.WorkHistory.CreateWorkHistoryAsync(workHistory);

            return(CreatedAtAction("GetWorkHistory", new { id = workHistory.WorkHistoryId }, workHistory));
        }
Exemplo n.º 22
0
        public ActionResult FormAddWork(WorkHistory workHistory)
        {
            if (workHistory == null)
            {
                workHistory = new WorkHistory();
            }

            MasterModel.Work = workHistory;

            return(PartialView("Partials/_AddWork", workHistory));
        }
Exemplo n.º 23
0
        public ActionResult Create([Bind(Include = "Id,Employer,Title,StartDate,EndDate,Description")] WorkHistory workHistory)
        {
            if (ModelState.IsValid)
            {
                db.Resumes.FirstOrDefault().WorkHistoryList.Add(workHistory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(workHistory));
        }
Exemplo n.º 24
0
        public WorkHistoryDTO PostDeleteWorkHistory(WorkHistoryDTO workHistoryData)
        {
            WorkHistory deletedEntry = new WorkHistory();

            deletedEntry = db.WorkHistories.Where(x => x.workId == workHistoryData.workId).FirstOrDefault();
            if (deletedEntry.workId != Guid.Empty)
            {
                db.WorkHistories.Remove(deletedEntry);
                db.SaveChanges();
            }
            return(MapperFacade.MapperConfiguration.Map <WorkHistory, WorkHistoryDTO>(deletedEntry));
        }
Exemplo n.º 25
0
 public ActionResult Edit([Bind(Include = "WorkHistoryId,MNumber,LastName,CompanyId,CompanyName,TitleId,TitleName,StartDate,EndDate,FTE,Compensation")] WorkHistory workHistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workHistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyId = new SelectList(db.Companies, "CompanyId", "CompanyName", workHistory.CompanyId);
     ViewBag.MNumber   = new SelectList(db.StudentAlums, "MNumber", "LastName", workHistory.MNumber);
     ViewBag.TitleId   = new SelectList(db.Titles, "TitleId", "TitleName", workHistory.TitleId);
     return(View(workHistory));
 }
Exemplo n.º 26
0
        public async Task <ActionResult> Edit([Bind(Include = "MNumber,CompanyName,TitleName,StartDate,EndDate,FTE")] WorkHistory workHistory)
        {
            if (ModelState.IsValid)
            {
                db.Entry(workHistory).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CompanyName = new SelectList(db.Companies, "CompanyName", "CompanyName", workHistory.CompanyName);
            ViewBag.TitleName   = new SelectList(db.Titles, "TitleName", "TitleName", workHistory.TitleName);
            ViewBag.MNumber     = new SelectList(db.Users, "MNumber", "LastName", workHistory.MNumber);
            return(View(workHistory));
        }
Exemplo n.º 27
0
        //{
        //    var workHistories = db.WorkHistories.Include(w => w.Company).Include(w => w.Title).Include(w => w.User);
        //    return View(await workHistories.ToListAsync());
        //}

        // GET: WorkHistories/Details/5
        public async Task <ActionResult> Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkHistory workHistory = await db.WorkHistories.FindAsync(id);

            if (workHistory == null)
            {
                return(HttpNotFound());
            }
            return(View(workHistory));
        }
Exemplo n.º 28
0
        // GET: WorkHistories/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkHistory workHistory = db.WorkHistories.Find(id);

            if (workHistory == null)
            {
                return(HttpNotFound());
            }
            return(View(workHistory));
        }
Exemplo n.º 29
0
        public ActionResult Create([Bind(Include = "MNumber,CompanyName,TitleName,StartDate,EndDate,FTE")] WorkHistory workHistory)
        {
            if (ModelState.IsValid)
            {
                db.WorkHistories.Add(workHistory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CompanyName = new SelectList(db.Companies, "CompanyName", "CompanyName", workHistory.CompanyName);
            ViewBag.TitleName   = new SelectList(db.Titles, "TitleName", "TitleName", workHistory.TitleName);
            ViewBag.MNumber     = new SelectList(db.Users, "MNumber", "LastName", workHistory.MNumber);
            return(View(workHistory));
        }
Exemplo n.º 30
0
        public async Task SaveWorkItem(WorkHistory entity, int id)
        {
            if (entity.Id == default)
            {
                entity.EmployeeId            = id;
                _context.Entry(entity).State = EntityState.Added;
            }
            else
            {
                entity.EmployeeId            = id;
                _context.Entry(entity).State = EntityState.Modified;
            }

            await _context.SaveChangesAsync();
        }