public ActionResult EditHumanResourcePosition(HumanResource HumanResourcePositionmodel)
        {
            if (ModelState.IsValid)
            {
                if (RouteData.Values["id"] != null)
                {
                    int  nid      = 0;
                    bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
                    if (isnumber)
                    {
                        HumanResourcePositionmodel.Id = nid;

                        ViewBag.ProcessMessage = HumanResourceManager.EditHumanResourcePosition(HumanResourcePositionmodel);
                        return(View(HumanResourcePositionmodel));
                    }
                    else
                    {
                        ViewBag.ProcessMessage = false;
                        return(View(HumanResourcePositionmodel));
                    }
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }

            return(View());
        }
        public HttpResponseMessage UpdateEmployee(HumanResource employee)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var emp = session.Get <HumanResource>(employee.Id);
                    emp.Fullname = employee.Fullname;
                    emp.Email    = employee.Email;
                    emp.Phone    = employee.Phone;
                    emp.Status   = employee.Status;

                    using (ITransaction transaction = session.BeginTransaction())
                    {
                        session.Save(emp);
                        transaction.Commit();
                    }
                    return(Request.CreateResponse(HttpStatusCode.OK, "Success"));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Error !"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("id,Age,BusinessTravel,Department,DistanceFromHome,EducationField,EmployeeNumber,Gender,JobRole,MaritalStatus,NumCompaniesWorked,OverTime,TotalWorkingYears,TrainingTimesLastYear,YearsAtCompany,YearsInCurrentRole,YearsSinceLastPromotion,YearsWithCurrManager")] HumanResource humanResource)
        {
            if (id != humanResource.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(humanResource);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HumanResourceExists(humanResource.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(humanResource));
        }
        public IHttpActionResult PutHumanResource(int id, HumanResource humanResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != humanResource.Id)
            {
                return(BadRequest());
            }

            db.Entry(humanResource).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HumanResourceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult Index(HumanResource record)
        {
            ViewBag.ProcessMessage = HumanResourceManager.EditHumanResource(record);


            return(View());
        }
        public static bool AddHumanResourcePosition(HumanResource record)
        {
            using (MainContext db = new MainContext())
            {
                try
                {
                    if (!record.TimeCreated.HasValue)
                    {
                        record.TimeCreated = DateTime.Now;
                    }

                    record.Online = true;
                    db.HumanResource.Add(record);
                    db.SaveChanges();

                    LogtrackManager logkeeper = new LogtrackManager();
                    logkeeper.LogDate    = DateTime.Now;
                    logkeeper.LogProcess = EnumLogType.InsanKaynaklari.ToString();
                    logkeeper.Message    = LogMessages.HumanResourcePositionAdded;
                    logkeeper.User       = HttpContext.Current.User.Identity.Name;
                    logkeeper.Data       = record.PositionName;
                    logkeeper.AddInfoLog(logger);


                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
 public static HumanResource GetHRByLanguage(string language)
 {
     using (MainContext db = new MainContext())
     {
         HumanResource instional_info = db.HumanResource.SingleOrDefault();
         return(instional_info);
     }
 }
Beispiel #8
0
        public async Task <IActionResult> Create([Bind("id,Age,BusinessTravel,Department,DistanceFromHome,EducationField,EmployeeNumber,Gender,JobRole,MaritalStatus,NumCompaniesWorked,OverTime,TotalWorkingYears,TrainingTimesLastYear,YearsAtCompany,YearsInCurrentRole,YearsSinceLastPromotion,YearsWithCurrManager")] HumanResource humanResource)
        {
            if (ModelState.IsValid)
            {
                _context.Add(humanResource);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(humanResource));
        }
        public IHttpActionResult GetHumanResource(int id)
        {
            HumanResource humanResource = db.HumanResources.Find(id);

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

            return(Ok(humanResource));
        }
        public IHttpActionResult PostHumanResource(HumanResource humanResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.HumanResources.Add(humanResource);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = humanResource.Id }, humanResource));
        }
Beispiel #11
0
        private void loginBtn_Click(object sender, RoutedEventArgs e)
        {
            LoginController lc         = LoginController.getInstance();
            int             employeeID = 0;

            try
            {
                employeeID = Int32.Parse(idField.Text);
            }
            catch
            {
                employeeID = -1;
            }

            Employee loggedIn = lc.doLogin(employeeID, passwordField.Password);

            if (loggedIn != null)
            {
                Window newWindow;
                //MessageBox.Show(loggedIn.EmployeePosition);
                if (loggedIn.EmployeePosition == "Attraction")
                {
                    newWindow = new Attraction();
                    newWindow.Show();
                }
                else if (loggedIn.EmployeePosition == "Front Office")
                {
                    newWindow = new FrontOffice();
                    newWindow.Show();
                }
                else if (loggedIn.EmployeePosition == "Ride")
                {
                    newWindow = new RideAndAttraction();
                    newWindow.Show();
                }
                else if (loggedIn.EmployeePosition == "Sales And Advertisement")
                {
                    newWindow = new SalesAndAdvertisement();
                    newWindow.Show();
                }
                else if (loggedIn.EmployeePosition == "Human Resource")
                {
                    newWindow = new HumanResource();
                    newWindow.Show();
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("ID or password is incorrect. Please try again.");
            }
        }
        public IHttpActionResult DeleteHumanResource(int id)
        {
            HumanResource humanResource = db.HumanResources.Find(id);

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

            db.HumanResources.Remove(humanResource);
            db.SaveChanges();

            return(Ok(humanResource));
        }
 public ActionResult AddHumanResourcePosition(HumanResource newmodel)
 {
     if (ModelState.IsValid)
     {
         newmodel.SortOrder     = 9999;
         newmodel.TimeCreated   = DateTime.Now;
         ViewBag.ProcessMessage = HumanResourceManager.AddHumanResourcePosition(newmodel);
         ModelState.Clear();
         // Response.Redirect("/yonetim/haberduzenle/" + newsmodel.NewsId);
         return(View());
     }
     else
     {
         return(View());
     }
 }
        public void TestLogWithEntityframeworkExtend()
        {
            sb.Clear();

            using (var db = new HumanResource())
            {
                db.TestTable.Add(new Person { Name = "Name 1" });
                db.TestTable.Add(new Person { Name = "Name 2" });
                db.TestTable.Add(new Person { Name = "Name 3" });
                db.TestTable.Add(new Person { Name = "Name 3" });
                db.TestTable.Add(new Person { Name = "Name 3" });
                db.SaveChanges();
            }

            //according batch operation (update or delete), databaselog can't log any sql statement.

            using (var db = new HumanResource())
            {
                db.TestTable.AsNoTracking().Where(x => x.Name == "Name 3").Delete();
            }

            using (var db = new HumanResource())
            {
                db.TestTable.AsNoTracking().Where(x => x.Name == "Name 3").Delete();
            }

            using (var db = new HumanResource())
            {
                db.TestTable.Where(x => x.Name == "Name 2").Delete();
            }

            using (var db = new HumanResource())
            {
                db.TestTable.Where(x => x.Name == "Name 2").Delete();
            }
            using (var db = new HumanResource())
            {
                var q = db.TestTable.Where(x => x.Name != "Name 2");
                var q1 = q.FutureCount();
                var q2 = q.OrderBy(x => x.Age).Skip(5).Take(1).Future();

                var v = q1.Value;
            }

            Console.WriteLine(sb.ToString());
        }
        static void Main(string[] args)
        {
            HumanResource hr = new HumanResource();

            ////Add Candiates to the Human Resource
            //hr.AddCandidate(CandiatesRepo.GetCandidatesList());

            //Add the Strategy to get the candidates
            hr.AddRecruitedStrategy(new MinimumThreeSkilsset());

            var selectedCandidates = hr.GetCandiatesByStrategy();

            Console.WriteLine("MinimumThreeSkilsset");
            foreach (var candidate in selectedCandidates)
            {
                Console.WriteLine($"Name of the Canidate {candidate.Name}");
            }

            Console.WriteLine("----------------------------------------------------------------");

            Console.WriteLine("ReferralStrategyWith2SkillSet");
            hr.AddRecruitedStrategy(new ReferralStrategyWith2SkillSet());
            selectedCandidates = hr.GetCandiatesByStrategy();

            foreach (var candidate in selectedCandidates)
            {
                Console.WriteLine($"Name of the Canidate {candidate.Name}");
            }

            Console.WriteLine("----------------------------------------------------------------");
            Console.WriteLine("ThreeYearsExperienceStrategy");
            hr.AddRecruitedStrategy(new ThreeYearsExperienceStrategy());
            selectedCandidates = hr.GetCandiatesByStrategy();

            foreach (var candidate in selectedCandidates)
            {
                Console.WriteLine($"Name of the Canidate {candidate.Name}");
            }

            Console.ReadLine();
        }
        public static bool EditHumanResource(HumanResource record)
        {
            using (MainContext db = new MainContext())
            {
                HumanResource editrecord = db.HumanResource.SingleOrDefault();

                if (editrecord == null)
                {
                    editrecord         = new HumanResource();
                    editrecord.Content = record.Content;
                    db.HumanResource.Add(editrecord);
                }
                else
                {
                    editrecord.Content = record.Content;
                }

                db.SaveChanges();

                return(true);
            }
        }
 public static HumanResource GetHumanResourcePositionById(int nid)
 {
     using (MainContext db = new MainContext())
     {
         try
         {
             HumanResource record = db.HumanResource.Where(d => d.Id == nid).SingleOrDefault();
             if (record != null)
             {
                 return(record);
             }
             else
             {
                 return(null);
             }
         }
         catch (Exception ex)
         {
             return(null);
         }
     }
 }
 public ActionResult EditHumanResourcePosition()
 {
     if (RouteData.Values["id"] != null)
     {
         int  nid      = 0;
         bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid);
         if (isnumber)
         {
             HumanResource editHumanResourcePosition = HumanResourceManager.GetHumanResourcePositionById(nid);
             return(View(editHumanResourcePosition));
         }
         else
         {
             return(View());
         }
     }
     else
     {
         return(View());
     }
     return(View());
 }
Beispiel #19
0
 public BusinessLayer.Entities.HumanResource TranslateHumanResourceGPToLocal(Generated.Mulesoft.Staff humGP)
 {
     try
     {
         if (humGP != null)
         {
             HumanResource humLocal = new HumanResource()
             {
                 Name                 = humGP.Name,
                 PersonnelNumber      = humGP.Personal_number,
                 ProfessionalNumberId = humGP.Professional_number,
                 Title                = humGP.Title,
                 HumanResourceId      = humGP.Id,
             };
             return(humLocal);
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine("Erro a realizar o convert de HumanResourceCore (GP) para HumanResource (local)");
     }
     return(null);
 }
 public HttpResponseMessage AddNewEmployee(HumanResource employee)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (ITransaction transaction = session.BeginTransaction())
             {
                 session.Save(employee);
                 transaction.Commit();
             }
             return(Request.CreateResponse(HttpStatusCode.OK, "Success"));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Error !"));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
 public static bool SortRecords(string[] idsList)
 {
     using (MainContext db = new MainContext())
     {
         try
         {
             int row = 0;
             foreach (string id in idsList)
             {
                 int           mid           = Convert.ToInt32(id);
                 HumanResource sortingrecord = db.HumanResource.SingleOrDefault(d => d.Id == mid);
                 sortingrecord.SortOrder = Convert.ToInt32(row);
                 db.SaveChanges();
                 row++;
             }
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
        public static bool EditHumanResourcePosition(HumanResource HumanResourcePositionmodel)
        {
            using (MainContext db = new MainContext())
            {
                try
                {
                    HumanResource record = db.HumanResource.Where(d => d.Id == HumanResourcePositionmodel.Id).SingleOrDefault();
                    if (record != null)
                    {
                        record.Content      = HumanResourcePositionmodel.Content;
                        record.PositionName = HumanResourcePositionmodel.PositionName;



                        db.SaveChanges();

                        LogtrackManager logkeeper = new LogtrackManager();
                        logkeeper.LogDate    = DateTime.Now;
                        logkeeper.LogProcess = EnumLogType.InsanKaynaklari.ToString();
                        logkeeper.Message    = LogMessages.HumanResourcePositionEdited;
                        logkeeper.User       = HttpContext.Current.User.Identity.Name;
                        logkeeper.Data       = record.PositionName;
                        logkeeper.AddInfoLog(logger);

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //DocumentRatingModel rating = new DocumentRatingModel();
            //rating.DocumentAverageRate(2);

            ErrorLoging.WriteLog("test phat", System.Diagnostics.EventLogEntryType.Information);

            //DocumentModel docModel = new DocumentModel();
            //CallMethodByText(docModel, "GetDocumentById", new object[] { 2 });
            //Testing(docModel.GetType(), docModel);

            //dynamic dym = CallMethodByString("BusinessLogicLayer.DocumentModel", "GetDocumentList");

            //String path = new Uri("http://*****:*****@"(page=)\d{1,9}");
            String s  = rg.Replace(Request.Url.OriginalString, "page=4");
        }
 public IActionResult ShowDetails(HumanResource resourceDetails)
 {
     return(View(viewName: "ResourceDetails", model: resourceDetails));
 }
 public IActionResult Register([Bind("ResourceName, Age, Department, Position, JoiningDate, Gender, HighestQualifications")] HumanResource newResource)
 {
     return(RedirectToAction("ShowDetails", routeValues: newResource));
 }