Пример #1
0
        /// <summary>
        /// DELETE /employees{Id}
        /// </summary>
        public object Delete(HR.Dto.Employee request)
        {
            var result = _dataLayer.DeleteEmployee(request.Id);

            HttpResult httpResult = ValidateResult(request, result, HttpStatusCode.NoContent);

            return httpResult;
        }
Пример #2
0
        /// <summary>
        /// POST /employees
        /// </summary>
        public object Post(HR.Dto.Employee request)
        {
            var newEmployeeId = _dataLayer.CreateNewEmployee(request.Translate());

            HttpResult httpResult = ValidateResult(request, newEmployeeId, HttpStatusCode.Created);

            return httpResult;
        }
Пример #3
0
        static void Main(string[] args)
        {
            HR hr = new HR();

            hr.Show();
            ITC.Hyd.Employee employee = new ITC.Hyd.Employee();

            employee.Show();
        }
Пример #4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            HR hr = await db.HRs.FindAsync(id);

            db.HRs.Remove(hr);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #5
0
        public IActionResult LoginHr([FromBody] HR hr)
        {
            HR hrcheck = HrService.LoginHr(hr);

            if (hrcheck == null)
            {
                return(StatusCode(201));
            }
            return(Ok(hrcheck));
        }
        public IActionResult IndexHR()
        {
            HR hr = _context.HRs.FirstOrDefault(u => u.NameId == HttpContext.User.Claims.First(claim => claim.Type.Contains("nameidentifier")).Value);
            List <JobOffer> jobOffers = _context.JobOffers.ToList().FindAll(x => x.HRId == hr.Id);


            List <JobApplication> searchResult = _context.JobApplications.ToList().FindAll(x => jobOffers.Any(y => y.Id == x.OfferId));

            return(View("~/Views/JobApplication/IndexHR.cshtml", searchResult));
        }
        public ReportingSection()
        {
            _teamLeader    = new TeamLeader();
            _projectLeader = new ProjectLeader();
            _hr            = new HR();

            _teamLeader.SetNextSupervisor(_projectLeader);
            _projectLeader.SetNextSupervisor(_hr);
            _hr.SetNextSupervisor(null);
        }
Пример #8
0
        public IActionResult Register([FromBody] HR value)
        {
            HR hr = HrService.Register(value);

            if (hr == null)
            {
                return(StatusCode(400));
            }
            return(StatusCode(201));
        }
Пример #9
0
        public IActionResult Edit(HR model)
        {
            var hr = _context.HRs.FirstOrDefault(x => x.Id == model.Id);

            hr.EmailAddress = model.EmailAddress;
            hr.LastName     = model.LastName;
            hr.PhoneNumber  = model.PhoneNumber;
            _context.Update(hr);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #10
0
 public ActionResult Edit([Bind(Include = "Id,EmployID,Department,Hours,Days")] HR hR)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hR).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployID = new SelectList(db.Employs, "Id", "UserName", hR.EmployID);
     return(View(hR));
 }
Пример #11
0
        string colonizeTime(int time, ColonType cType = ColonType.MIN2HR)
        {
            string result = "";
            int    HR, min, sec;
            string strHR, strMin, strSec;
            bool   isHr, isMin;

            switch (cType)
            {
            case ColonType.MIN2HR:
                HR     = time / 60;
                strHR  = (HR == 0) ? ":" : (HR.ToString() + ":");
                strMin = (time % 60).ToString().PadLeft(2, '0');;
                result = strHR + strMin;
                break;

            case ColonType.SEC4DIGITS:       // 13500 = 135min 0sec
                min = time / 100;
                sec = time % 100;
                if (sec >= 60)
                {
                    min += sec / 60; sec = sec % 60;
                }
                HR     = min / 60;
                isHr   = HR != 0;  isMin = min != 0;
                strHR  = !isHr ? (isMin ? ":" : "") : HR.ToString() + ":";
                strMin = !isMin ? "::" : (min.ToString().PadLeft(2, '0') + "::");
                strSec = sec.ToString().PadLeft(2, '0');
                result = strHR + strMin + strSec;
                break;

            case ColonType.SEC_ONLY:       // 123 = 2min 3sec
                min = time / 60;
                sec = time % 60;
                if (sec >= 60)
                {
                    min += sec / 60; sec = sec % 60;
                }
                HR     = min / 60;
                min    = min % 60;
                isHr   = HR != 0;  isMin = min != 0;
                strHR  = !isHr ? (isMin ? ":" : "") : HR.ToString() + ":";
                strMin = !isMin ? "::" : (min.ToString().PadLeft(2, '0') + "::");
                strSec = sec.ToString().PadLeft(2, '0');
                result = strHR + strMin + strSec;
                break;

            default:
                return("");
            }

            return(result);
        }
Пример #12
0
        public HrDto LoginHr(HR value)
        {
            HR HrCheck = Unitofwork.hrrepo.getAll().FirstOrDefault(hr => hr.Name == value.Name && hr.Password == value.Password);

            if (HrCheck == null)
            {
                return(null);
            }
            HrDto HrReturn = _mapper.Map <HrDto>(HrCheck);

            return(HrReturn);
        }
    public void Refresh()
    {
        AB = PA - BB;

        AVGText.text = ((float)H / AB).ToString("n3") + "(" + AB + "-" + H + ")";
        HRText.text  = HR.ToString();
        RBIText.text = RBI.ToString();
        float OBP = (float)(H + BB) / PA;

        OBPText.text = OBP.ToString("n3");
        OPSText.text = (CalculateSLG() + OBP).ToString("n3");
    }
Пример #14
0
        public HrDto Register(HR value)
        {
            HR HrCheck = Unitofwork.hrrepo.getAll().FirstOrDefault(hr => hr.Name == value.Name);

            if (HrCheck == null)
            {
                Unitofwork.hrrepo.Add(value);
                Unitofwork.Commit();
                HrDto HrReturn = _mapper.Map <HrDto>(value);
                return(HrReturn);
            }
            return(null);
        }
Пример #15
0
        static void Main(string[] args)
        {
            FullTimeEmployee ft = new FullTimeEmployee();

            ft.EmployeeId = 1001;
            ft.FirstName  = "Mary";
            ft.LastName   = "Mitchell";
            ft.Salary     = 80000;
            ft.PrintFullName();
            ft.Salary5();

            Console.WriteLine("**************");

            PartTimeEmployee pt = new PartTimeEmployee();

            pt.EmployeeId = 2001;
            pt.FirstName  = "Peter";
            pt.LastName   = "Parker";
            pt.Salary     = 50000;
            pt.PrintFullName();
            pt.Salary5();


            Console.WriteLine("**********");

            SesonalWorker sw = new SesonalWorker();

            sw.EmployeeId = 3001;
            sw.FirstName  = "Chris";
            sw.LastName   = "Hamliton";
            sw.Salary     = 30000;
            sw.PrintFullName();
            sw.Salary5();



            Console.WriteLine("**********");

            HR h = new HR();

            h.FirstName  = "Ezzy";
            h.LastName   = "Money";
            h.EmployeeId = 4001;
            h.Salary     = 50000;
            h.PrintFullName();
            h.Salary5();



            Console.ReadLine();
        }
Пример #16
0
        // GET: HRs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HR hR = db.HRs.Find(id);

            if (hR == null)
            {
                return(HttpNotFound());
            }
            return(View(hR));
        }
Пример #17
0
        // GET: /Employee/Details/5

        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HR hr = await db.HRs.FindAsync(id);

            if (hr == null)
            {
                return(HttpNotFound());
            }
            return(View(hr));
        }
Пример #18
0
        /// <summary>
        /// GET /employees 
        /// GET /employees/employeetype/{EmployeeTypeId} 
        /// </summary>
        public EmployeesResponse Get(HR.Dto.Employees request)
        {
            IList<HR.Dto.Employee> employees;
            if (request.EmployeeTypeId.HasValue)
            {
                employees = _dataLayer.GetEmployeesByEmployeeType(request.EmployeeTypeId.Value).Select(x=>x.Translate()).ToList();
            }
            else
            {
                employees = _dataLayer.GetAllEmployees().Select(x => x.Translate()).ToList();
            }

            return new EmployeesResponse { Employees = employees };
        }
Пример #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HR db = new HR();

            GridView2.DataSource = db.EMPLOYEES.ToList();
            GridView2.DataBind();

            PdfPrintOptions option = new PdfPrintOptions()
            {
                DPI = 300
            };

            AspxToPdf.RenderThisPageAsPdf();
        }
Пример #20
0
        // GET: HRs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HR hR = db.HRs.Find(id);

            if (hR == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EmployID = new SelectList(db.Employs, "Id", "UserName", hR.EmployID);
            return(View(hR));
        }
Пример #21
0
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(BadRequest($"id should not be null"));
            }
            HR hr = _context.HRs.FirstOrDefault(u => u.Id == id.Value);

            if (hr == null)
            {
                return(NotFound($"id doesn't exist"));
            }
            _context.HRs.Remove(hr);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #22
0
 protected void FindDefinitions()
 {
     for (int i = 0; i < literalsKey.Length; ++i)
     {
         literalsSolutions[i] = SymbolIs.Unknown;
         foreach (HornRule HR in KB)
         {
             SymbolIs solution = HR.DefinesLiteral(literalsKey[i]);
             if (solution != SymbolIs.Unknown)
             {
                 literalsSolutions[i] = solution;
                 break;
             }
         }
     }
 }
Пример #23
0
        public IActionResult AddHR(HR model)
        {
            HR hr = new HR
            {
                NameId       = model.NameId,
                Name         = model.Name,
                LastName     = model.LastName,
                PhoneNumber  = model.PhoneNumber,
                EmailAddress = model.EmailAddress,
                CompanyId    = model.CompanyId
            };

            _context.HRs.Add(hr);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #24
0
        public async Task <IActionResult> Details(int id)
        {
            Role role = await AuthorizationTools.GetRoleAsync(User, _context);

            ViewData.Add("role", role);
            ViewData.Add("id", AuthorizationTools.GetUserDbId(User, _context, role));
            string email = AuthorizationTools.GetEmail(User);

            if (role == Role.ADMIN)
            {
                return(new UnauthorizedResult());
            }

            Application app = _context.JobApplications
                              .Include(x => x.JobOffer)
                              .Include(x => x.Candidate)
                              .Include(x => x.JobOffer.HR)
                              .Include(x => x.JobOffer.HR.Company)
                              .Include(x => x.Comments)
                              .Where(a => a.Id == id)
                              .FirstOrDefault();

            if (app == null)
            {
                return(new NotFoundResult());
            }
            if (role == Role.HR)
            {
                HR us = _context.HRs.Where(c => c.EmailAddress == email).FirstOrDefault();
                if (us == null || us.Id != app.JobOffer.HR.Id)
                {
                    return(new UnauthorizedResult());
                }
                ApplicationWithComment appWithComm = new ApplicationWithComment(app);
                return(View("DetailsHR", appWithComm));
            }
            else
            {
                Candidate us = _context.Candidates.Where(c => c.EmailAddress == email).FirstOrDefault();
                if (us == null || us.Id != app.Candidate.Id)
                {
                    return(new UnauthorizedResult());
                }

                return(View("DetailsCandidate", app));
            }
        }
Пример #25
0
        public async Task <IActionResult> Index([FromQuery(Name = "search")] string searchString)
        {
            Role role = await AuthorizationTools.GetRoleAsync(User, _context);

            ViewData.Add("role", role);
            ViewData.Add("id", AuthorizationTools.GetUserDbId(User, _context, role));
            List <JobOffer> searchResult;

            if (string.IsNullOrEmpty(searchString))
            {
                searchResult = await _context.JobOffers
                               .Include(x => x.HR)
                               .Include(x => x.HR.Company)
                               .ToListAsync();
            }
            else
            {
                searchResult = await _context
                               .JobOffers
                               .Include(x => x.HR)
                               .Include(x => x.HR.Company)
                               .Where(o => o.JobTitle.Contains(searchString, StringComparison.OrdinalIgnoreCase) ||
                                      o.HR.Company.Name.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                               .ToListAsync();
            }
            string email = AuthorizationTools.GetEmail(User);

            if (role == Role.HR)
            {
                JobOfferIndexHRView jobOfferIndexHRView = new JobOfferIndexHRView();
                jobOfferIndexHRView.Offers = searchResult;
                HR us = _context.HRs.Where(h => h.EmailAddress == email).First();
                jobOfferIndexHRView.HR = us;
                return(View("IndexHR", jobOfferIndexHRView));
            }
            else if (role == Role.CANDIDATE)
            {
                JobOfferIndexCandidateView jobOfferIndexCandidateView = new JobOfferIndexCandidateView();
                jobOfferIndexCandidateView.Offers = searchResult;
                Candidate us = _context.Candidates.Where(c => c.EmailAddress == email).First();
                jobOfferIndexCandidateView.Candidate = us;
                return(View("IndexCandidate", jobOfferIndexCandidateView));
            }
            //role == Role.ADMIN
            return(View("IndexAdmin", searchResult));
        }
Пример #26
0
        public override int AddPort(IDebugPortRequest2 request, out IDebugPort2 port)
        {
            string name;

            HR.Check(request.GetPortName(out name));

            AD7Port newPort = new SSHPort(this, name, isInAddPort: true);

            if (newPort.IsConnected)
            {
                port = newPort;
                return(HR.S_OK);
            }

            port = null;
            return(HR.E_REMOTE_CONNECT_USER_CANCELED);
        }
Пример #27
0
 public Recruitment(Applicant applicant, HR hr, Work work, AgeException AgeExept, CitizenshipException CitizenExept)
 {
     try
     {
         AgeExept.Age(Applicant.Age);
         CitizenExept.Citizenship(Applicant.Сitizenship);
     }
     catch
     {
     }
     HR = hr;
     applicant.WorkExperience[applicant.WorkExperience.Length] =
         new WorkExperience(applicant.CurrentWork, applicant.RecruitmentDate, DateTime.Now);
     applicant.RecruitmentDate         = DateTime.Now;
     applicant.CurrentWork             = work;
     work.Workers[work.Workers.Length] = applicant;
 }
Пример #28
0
        //public static List<Chats> GetChats(string userName)
        //{
        //    using (SqlConnection conn = new SqlConnection(CONN_STRING)) {
        //        using (SqlCommand cmd = new SqlCommand(" select * from Room where UserID1 = @BEID or UserID2 = @BEID", conn)) {
        //            int BEID = GetBEID(userName);
        //            cmd.Parameters.AddWithValue("@BEID", BEID);
        //            conn.Open();
        //            using (SqlDataReader dr = cmd.ExecuteReader()) {
        //                List<Chats> chats = new List<Chats>();
        //                while (dr.Read()) {
        //                    Chats chat = new Chats(dr.GetInt32(0), dr.GetInt32(1), dr.GetInt32(2));
        //                    chats.Add(chat);
        //                }
        //                return chats;
        //            }
        //        }
        //    }
        //}

        public static object GetOpenPositions()
        {
            using (SqlConnection conn = new SqlConnection(CONN_STRING)) {
                using (SqlCommand cmd = new SqlCommand(" SELECT * FROM Positions where PositionStatus = 'open';", conn)) {
                    conn.Open();
                    using (SqlDataReader dr = cmd.ExecuteReader()) {
                        List <HR> openPositions = new List <HR>();
                        while (dr.Read())
                        {
                            HR openPosition = new HR(dr.GetInt32(0), dr.GetString(1), dr.GetInt16(2), dr.GetString(3), dr.GetString(4), dr.GetString(5));
                            openPositions.Add(openPosition);
                        }

                        return(openPositions);
                    }
                }
            }
        }
Пример #29
0
        public static object GetCandidate()
        {
            using (SqlConnection conn = new SqlConnection(CONN_STRING)) {
                using (SqlCommand cmd = new SqlCommand(" Select JobCandidateID,Resume from HumanResources.JobCandidate ", conn)) {
                    conn.Open();
                    using (SqlDataReader dr = cmd.ExecuteReader()) {
                        List <HR> candidates = new List <HR>();
                        while (dr.Read())
                        {
                            HR candidate = new HR(dr.GetInt32(0), dr.GetString(1));
                            candidates.Add(candidate);
                        }

                        return(candidates);
                    }
                }
            }
        }
Пример #30
0
        public async Task <IActionResult> Index([FromQuery(Name = "search")] string searchString)
        {
            Role role = await AuthorizationTools.GetRoleAsync(User, _context);

            ViewData.Add("role", role);
            ViewData.Add("id", AuthorizationTools.GetUserDbId(User, _context, role));
            List <Application> searchResult;

            if (string.IsNullOrEmpty(searchString))
            {
                searchResult = await _context.JobApplications
                               .Include(x => x.JobOffer)
                               .Include(x => x.JobOffer.HR)
                               .Include(x => x.JobOffer.HR.Company)
                               .Include(x => x.Comments)
                               .ToListAsync();
            }
            else
            {
                searchResult = await _context
                               .JobApplications
                               .Include(x => x.JobOffer)
                               .Include(x => x.JobOffer.HR)
                               .Include(x => x.JobOffer.HR.Company)
                               .Include(x => x.Comments)
                               .Where(o => o.LastName.Contains(searchString, StringComparison.OrdinalIgnoreCase))
                               .ToListAsync();
            }
            if (role == Role.HR)
            {
                string email = AuthorizationTools.GetEmail(User);
                HR     us    = _context.HRs.Where(h => h.EmailAddress == email).First();
                searchResult = searchResult.Where(a => a.JobOffer.HR == us).ToList();
                return(View("IndexHR", searchResult));
            }
            else if (role == Role.CANDIDATE)
            {
                string    email = AuthorizationTools.GetEmail(User);
                Candidate us    = _context.Candidates.Where(c => c.EmailAddress == email).First();
                searchResult = searchResult.Where(a => a.Candidate == us).ToList();
                return(View("IndexCandidate", searchResult));
            }
            return(View("IndexAdmin", searchResult));
        }
Пример #31
0
        static void Main(string[] args)
        {
            Dictionary <string, string> connStrings = new Dictionary <string, string>();

            char[] splitter = { '=' };
            foreach (string line in File.ReadAllLines(@"c:\Lab\ConnString.txt"))
            {
                string[] KV = line.Split(splitter, 2);
                connStrings.Add(KV[0], KV[1]);
            }

            HRDataAccess util =
                new HRDataAccess(
                    connStrings["HR"]);
            HR myDS = util.GetFullHRDataSet();

            Console.WriteLine(myDS.EMPLOYEES.Count);
            myDS.WriteXml(@"C:\\Lab\myDS.xml");
        }
Пример #32
0
        public void hr_test()
        {
            HR            hr           = new HR();
            IIterator     hrIterator   = hr.CreateIterator();
            List <string> fromIterator = new List <string>();

            fromIterator.Add(hrIterator.Next());
            Assert.AreEqual(fromIterator.Count(), 1);
            Assert.AreEqual(hrIterator.IsDone(), false);
            fromIterator.Add(hrIterator.Next());
            Assert.AreEqual(fromIterator.Count(), 2);
            Assert.AreEqual(hrIterator.IsDone(), false);
            fromIterator.Add(hrIterator.Next());
            Assert.AreEqual(fromIterator.Count(), 3);
            Assert.AreEqual(hrIterator.IsDone(), false);
            fromIterator.Add(hrIterator.Next());
            Assert.AreEqual(fromIterator.Count(), 4);
            Assert.AreEqual(hrIterator.IsDone(), true);
        }
        public override MainParentClass Menu_Virtual(ProgressOfUpdateAtStructAttribute Parent)
        {
            HR HR = new HR();
            ProgressOfUpdateAtStructAttribute Progress = Parent.NonSerializedConfig.GetOnEntry;

            Progress.SetName(nameof(HR_Methods));
            Progress.NonSerializedConfig.Method = new Action(() =>
            {
                Tuple <SQLiteConnection, string> tuple = ConnectToDataBase.TryToConnectToSQLite(LocalSettings.NewBasePath);

                using (SQLiteConnection SQLiteConnection = tuple.Item1)
                {
                    HR.Workers_Hierarchy = GetWorkers(SQLiteConnection);
                    HR.Groups            = GetGroups(SQLiteConnection);
                }
            });
            Progress.Start();

            return(HR);
        }
Пример #34
0
 internal ClrDiagnosticsException(string message, HR hr)
     : base(message)
 {
     base.HResult = (int)hr;
 }
Пример #35
0
 /// <summary>
 /// GET /employees/{Id}
 /// </summary>
 public EmployeeResponse Get(HR.Dto.Employee request)
 {
     return new EmployeeResponse { Employee = _dataLayer.GetEmployeeById(request.Id).Translate() };
 }
Пример #36
0
        /// <summary>
        /// PUT /employees/{Id}
        /// </summary>
        public object Put(HR.Dto.Employee request)
        {
            var result = _dataLayer.UpdateEmployee(request.Translate());

            HttpResult httpResult = ValidateResult(request, result, HttpStatusCode.NoContent);

            return httpResult;
        }
Пример #37
0
        private HttpResult ValidateResult(HR.Dto.Employee request, int result, HttpStatusCode successStatusCode)
        {
            HttpResult httpResult;
            HttpStatusCode statusCode;
            int id;
            if (result > 0)
            {
                id = result;
                statusCode = successStatusCode;
            }
            else
            {
                id = request.Id;
                statusCode = HttpStatusCode.InternalServerError;
            }

            var response = new EmployeeResponse { Employee = request };

            return new HttpResult(response)
            {
                StatusCode = statusCode//,
               /* Headers = {
                    {
                        HttpHeaders.Location, base.Request.AbsoluteUri.CombineWith(id)
                    }
                }*/
            };
        }