Esempio n. 1
0
        public ActionResult CreateJobTitle(string organizationID)
        {
            var orgID = 0;
            var model = new CreateEditJobTitleViewModel();

            if (organizationID != null)
            {
                orgID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(organizationID));
            }
            model.OrganizationID = Convert.ToString(orgID);
            model.ValidFrom      = DateTime.Now;

            return(PartialView("CreateEditJobTitle", model));
        }
Esempio n. 2
0
        public IActionResult EditJobTitle([FromBody] CreateEditJobTitleViewModel model)
        {
            if (model == null)
            {
                return(BadRequest(" Job Title is null."));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var decryptedID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(model.ID));

            model.ID = decryptedID.ToString();
            var jobTitle    = _organizationUnitProvider.GetJobTitleDetail(Convert.ToInt32(model.ID));
            var gradeMapper = _mapper.Map(model, jobTitle);

            _organizationUnitProvider.EditJobTitle(gradeMapper);
            return(Ok());
        }
Esempio n. 3
0
        public IActionResult AddLocation([FromBody] CreateEditJobTitleViewModel location)
        {
            var model = new OrganizationListLocation();

            if (location is null)
            {
                return(BadRequest("Location is null."));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            location.OrganizationID = EncryptionHelper.DecryptUrlParam(location.OrganizationID);
            int headerID = Int32.Parse(location.OrganizationID);

            var locationMapper = _mapper.Map(location, model);

            _organizationUnitProvider.AddLocation(locationMapper);
            return(Ok(location));
        }
Esempio n. 4
0
        public ActionResult EditJobTitle(CreateEditJobTitleViewModel model)
        {
            var jsonViewModel = new AjaxViewModel();

            try
            {
                string json     = JsonConvert.SerializeObject(model);
                var    endpoint = String.Format("{0}/EditJobTitle", url);

                model = Utilities.RestAPIHelper <CreateEditJobTitleViewModel>
                        .Submit(json, Method.PUT, endpoint);

                jsonViewModel.SetValues(true, null, "Saved");
            }
            catch (Exception ex)
            {
                jsonViewModel.SetValues(false, null, String.Format("Failed\\nMessage: {0}", ex.GetBaseException().Message));
            }
            return(Json(jsonViewModel));
        }
Esempio n. 5
0
        public ActionResult EditJobTitle(string id)
        {
            var jsonViewModel = new AjaxViewModel();
            CreateEditJobTitleViewModel model = new CreateEditJobTitleViewModel();

            try
            {
                int decryptID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(id));
                var endpoint  = String.Format("{0}/GetJobTitle/{1}", url, decryptID);

                model = Utilities.RestAPIHelper <CreateEditJobTitleViewModel>
                        .Submit("", Method.GET, endpoint);

                string encryptID = EncryptionHelper.EncryptUrlParam(model.OrganizationID);
            }
            catch (Exception ex)
            {
                jsonViewModel.SetValues(false, null, String.Format("Failed\\nMessage: {0}", ex.GetBaseException().Message));
            }
            return(PartialView("CreateEditJobTitle", model));
        }
Esempio n. 6
0
        public IActionResult AddJobTitle([FromBody] CreateEditJobTitleViewModel model)
        {
            var orgListJobTitle = new OrganizationListJobtitle();

            if (model is null)
            {
                return(BadRequest("Job Title is null."));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            //jobTitle.OrganizationID = EncryptionHelper.DecryptUrlParam(jobTitle.OrganizationID);
            var jobTitleMapper = _mapper.Map(model, orgListJobTitle);

            orgListJobTitle.Id             = 0;
            orgListJobTitle.OrganizationId = Convert.ToInt32(model.OrganizationID);
            orgListJobTitle.BeginEff       = model.ValidFrom;
            orgListJobTitle.LastEff        = model.ValidTo;
            _organizationUnitProvider.AddJobTitle(jobTitleMapper);
            var orgID = orgListJobTitle.Id.ToString();

            return(Ok(orgID));
        }