/// <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; }
/// <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; }
static void Main(string[] args) { HR hr = new HR(); hr.Show(); ITC.Hyd.Employee employee = new ITC.Hyd.Employee(); employee.Show(); }
public async Task <ActionResult> DeleteConfirmed(int id) { HR hr = await db.HRs.FindAsync(id); db.HRs.Remove(hr); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
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); }
public IActionResult Register([FromBody] HR value) { HR hr = HrService.Register(value); if (hr == null) { return(StatusCode(400)); } return(StatusCode(201)); }
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")); }
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)); }
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); }
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"); }
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); }
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(); }
// 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)); }
// 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)); }
/// <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 }; }
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(); }
// 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)); }
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")); }
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; } } } }
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")); }
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)); } }
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)); }
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); }
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; }
//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); } } } }
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); } } } }
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)); }
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"); }
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); }
internal ClrDiagnosticsException(string message, HR hr) : base(message) { base.HResult = (int)hr; }
/// <summary> /// GET /employees/{Id} /// </summary> public EmployeeResponse Get(HR.Dto.Employee request) { return new EmployeeResponse { Employee = _dataLayer.GetEmployeeById(request.Id).Translate() }; }
/// <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; }
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) } }*/ }; }