Ejemplo n.º 1
0
        public void Execute_TestFixtureSetup()
        {
            //Setup for testing
            //Setup for testing
            TestHelper helper = new TestHelper();

            servicesManager = helper.GetServicesManager();

            // implement_IHelper
            //create client
            _client        = helper.GetServicesManager().GetProxy <IRSAPIClient>(ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD);
            _eddsDbContext = helper.GetDBContext(-1);

            //Create workspace
            _workspaceId = CreateWorkspace.CreateWorkspaceAsync(_workspaceName, ConfigurationHelper.TEST_WORKSPACE_TEMPLATE_NAME, servicesManager, ConfigurationHelper.ADMIN_USERNAME, ConfigurationHelper.DEFAULT_PASSWORD).Result;
            dbContext    = helper.GetDBContext(_workspaceId);
            _client.APIOptions.WorkspaceID = _workspaceId;

            _rootFolderArtifactId = APIHelpers.GetRootFolderArtifactID(_client, _workspaceName);

            //Import Application containing script, fields, and choices
            Relativity.Test.Helpers.Application.ApplicationHelpers.ImportApplication(_client, _workspaceId, true, FilepathData);

            //Import custodians
            var custodians = GetCustodiansDatatable();

            var identityFieldArtifactId = GetArtifactIDOfCustodianField("Full Name", _workspaceId, _client);

            ImportAPIHelpers.ImportObjects(_workspaceId, "Custodian", identityFieldArtifactId, custodians, String.Empty);

            //Import Documents
            var documents = GetDocumentDataTable(_rootFolderArtifactId, _workspaceId);

            ImportAPIHelpers.CreateDocuments(_workspaceId, _rootFolderArtifactId, documents);
        }
        public async Task <ActionResult> ApproveLeave(Guid id, string email)
        {
            try
            {
                var data = await APIHelpers.GetAsync <bool>("api/Leave/ApproveLeaves/" + id);

                if (data == true)
                {
                    var emp = await APIHelpers.GetAsync <Employee>("api/Employee/GetEmployee?Email=" + email);

                    var leave = await APIHelpers.GetAsync <Leave>("api/Leave/Get/" + id);

                    //emp.AvailableLeaves = emp.AvailableLeaves - (leave.To.Day - leave.From.Day);
                    await APIHelpers.PutAsync <Employee>("api/Employee/Put", emp);

                    var subject = "Leave";
                    var body    = "Congratulations!! Your Leave has been Approved.";
                    //CommonHelper.SendMail(email, subject, body);
                    return(RedirectToAction("GetPendingLeave", "Leave"));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public async Task <ActionResult> Create(HttpPostedFileBase Logo, SettingView collection)
        {
            try
            {
                //HttpPostedFileBase file;
                //if (Logo != null && !string.IsNullOrEmpty(Logo.FileName)) {
                //Logo.SaveAs(Server.MapPath("~/Images/" + Logo.FileName));
                //collection.Logo = Logo.FileName;
                //}
                // TODO: Add insert logic here
                ModelState.Remove("Id");
                ModelState.Remove("Header");
                ModelState.Remove("SubHeader");
                ModelState.Remove("Logo");
                ModelState.Remove("ShowDate");
                if (ModelState.IsValid)
                {
                    await APIHelpers.PostAsync <SettingView>("api/Setting/Post", collection);

                    TempData["sucess"] = "Setting Updated Successfully";
                }
                return(RedirectToAction("Create"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        public async Task <ActionResult> Create(Interviewers model)
        {
            try
            {
                var fromtime = Request["FromTime"];
                var totime   = Request["ToTime"];
                //var ftime = TimeSpan.Parse(fromtime, CultureInfo.InvariantCulture);
                ModelState.Remove("FromTime");
                ModelState.Remove("ToTime");
                ModelState.Remove("Id");
                if (ModelState.IsValid)
                {
                    model.FromTime = DateTime.Parse(fromtime).TimeOfDay;
                    model.ToTime   = DateTime.Parse(totime).TimeOfDay;
                    if (model.Id == Guid.Empty)
                    {
                        await APIHelpers.PostAsync <Interviewers>("api/Interviewer/Post", model);

                        TempData["sucess"] = InterviewerResources.create;
                    }
                    else
                    {
                        await APIHelpers.PutAsync <Interviewers>("api/Interviewer/Put", model);

                        TempData["sucess"] = InterviewerResources.update;
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Ejemplo n.º 5
0
        private void SystemDebug_Awake(ILContext il)
        {
            Collection <Instruction> instructions = il.Body.Instructions;

            il.IL.InsertBefore(instructions[0], il.IL.Create(OpCodes.Call, APIHelpers.FindMethod("SystemDebug", "OnDebuggingEnabled"))); //this.OnDebuggingEnabled();
            il.IL.InsertBefore(instructions[0], il.IL.Create(OpCodes.Ldarg_0));                                                          //idk why this needs to happen but it do
        }
Ejemplo n.º 6
0
        public async Task <ActionResult> Create(TemplatesType collection)
        {
            try
            {
                ModelState.Remove("Id");
                if (ModelState.IsValid)
                {
                    if (collection.Id == Guid.Empty)
                    {
                        await APIHelpers.PostAsync <TemplatesType>("api/TemplateType/Post", collection);

                        TempData["sucess"] = TemplateTypeResources.create;
                    }
                    else
                    {
                        await APIHelpers.PutAsync <TemplatesType>("api/TemplateType/Put", collection);

                        TempData["sucess"] = TemplateResources.update;
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public void WhenIRetrieveAllLocations()
        {
            var path     = "locations";
            var response = APIHelpers.GetRequest <List <Location> >(path, token);

            _scenarioContext["Response"] = response;
        }
        public async Task <ActionResult> Post(IdentityRole role)
        {
            try
            {
                ModelState.Remove("Id");
                if (ModelState.IsValid)
                {
                    role.Id = Convert.ToString(Guid.NewGuid());
                    appcontext.Roles.Add(role);
                    await appcontext.SaveChangesAsync();

                    bool data = await APIHelpers.GetAsync <bool>("api/RolePermission/PostRoles/" + role.Id);

                    TempData["sucess"] = CommonResources.create;
                    return(RedirectToAction("Index"));
                }
                else
                {
                    TempData["error"] = CommonResources.error;
                    return(View(role));
                }
            }
            catch (Exception ex)
            {
                TempData["error"] = CommonResources.error;
                throw;
            }
        }
        public async Task <ActionResult> Contact()
        {
            try
            {
                var temp = CommonHelper.GetUser();
                ViewBag.User = this.applicationDbContext.Users.Select(x => new UserViewModel()
                {
                    Name = x.FirstName + " " + x.LastName, Id = x.Id
                }).ToList();
                //List<Report> Report = new List<Report>();
                //var user = CommonHelper.GetUser();
                //ViewBag.User = this.applicationDbContext.Users.Select(x => new UserViewModel() { Name = x.FirstName + " " + x.LastName, Id = x.Id }).ToList();
                //ReportFilter model = new ReportFilter();
                //model.IsSuperAdmin = user.IsSuperAdmin;
                //model.Report = new List<Report>();
                //if (user != null && user.IsSuperAdmin)
                //{
                //    return View(model);
                //}
                //else
                //{
                //    var id = Guid.Parse(user.Id);
                //    var data = this.applicationDbContext.TimeTrackings.Where(_ => _.UserId == id).ToList();
                //    model = NewMethod(model, data);
                //    return View(model);
                //}
                var data = await APIHelpers.GetAsync <ReportFilter>("api/Reports/Contect?admin=" + temp.IsSuperAdmin + "&id1=" + temp.Id);

                return(View(data));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public void WhenIRetrieveALocationForId(string id)
        {
            var path     = string.Format("locations/{0}", id);
            var response = APIHelpers.GetRequest <Location>(path, token);

            _scenarioContext["Response"] = response;
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> Create(States collection)
        {
            try
            {
                // TODO: Add insert logic here
                ModelState.Remove("Id");
                if (ModelState.IsValid)
                {
                    if (collection.Id == Guid.Empty)
                    {
                        await APIHelpers.PostAsync <States>("api/State/Post", collection);

                        TempData["sucess"] = StateResources.create;
                    }
                    else
                    {
                        await APIHelpers.PutAsync <States>("api/State/Put", collection);

                        TempData["sucess"] = StateResources.update;
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Ejemplo n.º 12
0
        public async Task <JsonResult> PostSkill(string name)
        {
            try
            {
                if (name != "")
                {
                    Skills skill = new Skills
                    {
                        Id   = Guid.Empty,
                        Name = name
                    };
                    await APIHelpers.PostAsync <Skills>("api/Skill/Post", skill);

                    return(Json(true, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(false, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 13
0
        public async Task <ActionResult> Create(Skills collection)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here
                    if (collection.Id == Guid.Empty)
                    {
                        await APIHelpers.PostAsync <Skills>("api/Skill/Post", collection);

                        TempData["sucess"] = SkillsResources.create;
                    }
                    else
                    {
                        await APIHelpers.PutAsync <Skills>("api/Skill/Put", collection);

                        TempData["sucess"] = SkillsResources.update;
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(collection));
                }
            }
            catch (Exception ex)
            {
                TempData["error"] = CommonResources.error;
                return(RedirectToAction("AccessDenied", "Error"));
            }
        }
        public async Task <ActionResult> Create(Interviews model)
        {
            try
            {
                //var c = Request["CandidateId"];
                var      stime = Request["Stime"];
                var      sdate = Request["Sdate"];
                DateTime time  = Convert.ToDateTime(DateTime.ParseExact(sdate, "MM/dd/yyyy", null) + DateTime.Parse(stime).TimeOfDay);
                ModelState.Remove("Id");
                ModelState.Remove("ScheduleTime");
                if (ModelState.IsValid)
                {
                    model.ScheduleTime = time;
                    if (model.Id == Guid.Empty)
                    {
                        await APIHelpers.PostAsync <Interviews>("api/Interview/Post", model);

                        TempData["sucess"] = InterviewResources.create;
                    }
                    else
                    {
                        await APIHelpers.PutAsync <Interviews>("api/Interview/Put", model);

                        TempData["sucess"] = InterviewResources.update;
                    }
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        // GET: RolePermission
        public async Task <ActionResult> Index()
        {
            //ViewBag.Roles = _applicationDbContext.Roles.Where(m => m.Name != "Admin").ToList();
            ViewBag.Roles = await APIHelpers.GetAsync <List <RolesViewModel> >("api/RolePermission/GetRoles");

            return(View());
        }
        // GET: Dashboard
        public async Task <ActionResult> Index()
        {
            try
            {
                var data = await APIHelpers.GetAsync <DashboardCounts>("api/Dashboard/DashboardCounts");

                var temp = await APIHelpers.GetAsync <List <MonthBirthdays> >("api/Dashboard/GetMonthBirthdays");

                DashboardViewModel model = new DashboardViewModel
                {
                    TotalEmployee  = data.TotalEmployee,
                    TotalDeveloper = data.TotalDeveloper,
                    TotalHR        = data.TotalHR,
                    TotalPM        = data.TotalPM,
                    TotalSales     = data.TotalSales,
                    TotalProjects  = data.TotalProjects,
                    MonthBirthdays = temp
                };
                //data.BirthDays = temp.BirthDays;
                return(View(model));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 17
0
        // GET: State
        public async Task <ActionResult> Index()
        {
            ViewBag.Country = await APIHelpers.GetAsync <List <Countries> >("api/Country/GetCountries");

            var data = await APIHelpers.GetAsync <List <States> >("api/State/Getstates");

            return(View(data.ToList()));
        }
        // GET: Opening
        public async Task <ActionResult> Index()
        {
            var data = await APIHelpers.GetAsync <List <OpeningsViewModel> >("api/Openings/GetOpenings");

            if (data == null)
            {
                data = new List <OpeningsViewModel>();
            }
            return(View(data));
        }
        // GET: Interview
        public async Task <ActionResult> Index()
        {
            var data = await APIHelpers.GetAsync <List <DisplayInterviewModel> >("api/Interview/GetInterviewsList");

            if (data == null)
            {
                data = new List <DisplayInterviewModel>();
            }
            return(View(data.ToList()));
        }
        public void GivenILoginAsAAPIUser()
        {
            // auth/login not returning the expected token for [email protected] but instead auth/register is used
            var    path     = "auth/register";
            var    data     = new User();
            string payload  = JsonHelpers.ConvertObjToJson(data);
            var    response = APIHelpers.PostRequest(path, payload);

            token = JsonHelpers.GetJsonKeyValue(response.Content, "access_token");
        }
Ejemplo n.º 21
0
        // GET: TemplateType
        public async Task <ActionResult> Index()
        {
            var data = await APIHelpers.GetAsync <List <TemplatesType> >("api/TemplateType/GetTemplateTypes");

            if (data == null)
            {
                data = new List <TemplatesType>();
            }
            return(View(data.ToList()));
        }
Ejemplo n.º 22
0
        // GET: Candidate/Create
        public async Task <ActionResult> Create()
        {
            ViewBag.Designation = await APIHelpers.GetAsync <List <Designation> >("api/Designation/GetDesignations");

            ViewBag.Skills = await APIHelpers.GetAsync <List <Skills> >("api/Skill/GetSkills");

            ViewBag.Technology = await APIHelpers.GetAsync <List <Technologies> >("api/Technology/GetTechnologies");

            return(View());
        }
Ejemplo n.º 23
0
        // GET: Candidate
        public async Task <ActionResult> Index()
        {
            var data = await APIHelpers.GetAsync <List <DisplayCandidateViewModel> >("api/Candidate/GetCandidateList");

            ViewBag.Technology = await APIHelpers.GetAsync <List <Technologies> >("api/Technology/GetTechnologies");

            ViewBag.Skills = await APIHelpers.GetAsync <List <Skills> >("api/Skill/GetSkills");

            return(View(data));
        }
        public async Task <ActionResult> Profile(EmployeeUserViewModel collection)
        {
            try
            {
                ViewBag.Department = await APIHelpers.GetAsync <List <Departments> >("api/Department/GetDepartments");

                ViewBag.Skills = await APIHelpers.GetAsync <List <Skills> >("api/Skill/GetSkills");

                string skills = string.Join(",", Request["Skill"]);
                collection.Skills = skills;
                await APIHelpers.PutAsync <Employee>("api/Employee/Put", collection);

                TempData["sucess"] = EmployeeResources.update;
                //string dob = Request["BirthDate"];
                //string skills = string.Join(",", Request["Skill"]);

                //ModelState.Remove("BirthDate");
                //ModelState.Remove("LeaveBalance");
                ////var month = (13 - DateTime.Now.Month) * 1.5;
                //if (ModelState.IsValid)
                //{

                //    collection.BirthDate = DateTime.ParseExact(dob, "dd/MMM/yyyy", null);
                //    collection.LeaveBalance = Convert.ToDecimal(15);
                //    collection.Skills = skills;
                //    // TODO: Add insert logic here
                //    if (collection.Id == Guid.Empty)
                //    {
                //        var user = new ApplicationUser { RoleId = collection.RoleId, UserName = collection.Email, IsSuperAdmin = false, ParentUserID = Guid.Parse("06644856-45f6-4c78-9c19-60781abba7e3"), Email = collection.Email, FirstName = "", LastName = "", UserStatus = 0 };
                //        collection.UserId = Guid.Parse(user.Id);
                //        var result = await UserManager.CreateAsync(user, collection.Password);
                //        if (result.Succeeded)
                //        {
                //            await APIHelpers.PostAsync<Employee>("api/Employee/Post", collection);
                //            TempData["sucess"] = EmployeeResources.create;
                //        }
                //    }
                //    else
                //    {
                //        await APIHelpers.PutAsync<Employee>("api/Employee/Put", collection);
                //        TempData["sucess"] = EmployeeResources.update;
                //    }
                return(View("Profile", collection));
                //}
                //else
                //{
                //    return View(collection);
                //}
            }
            catch (Exception ex)
            {
                TempData["error"] = CommonResources.error;
                return(RedirectToAction("AccessDenied", "Error"));
            }
        }
 // GET: Notification/Edit/5
 public async Task <ActionResult> Edit(Guid id)
 {
     try
     {
         return(View("Create", await APIHelpers.GetAsync <Notifications>("api/Notification/Get/" + id)));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("AccessDenied", "Error"));
     }
 }
        public void WhenIUpdateALocationToForId(string location, string Id)
        {
            var path = string.Format("locations/{0}", Id);
            var data = new Location()
            {
                name = location
            };
            string payload = JsonHelpers.ConvertObjToJson(data);

            APIHelpers.PutRequest(path, payload, token);
        }
        public void WhenIAddANewLocation(string location)
        {
            var path = "locations";
            var data = new Location()
            {
                name = location
            };
            string payload = JsonHelpers.ConvertObjToJson(data);

            APIHelpers.PostRequest(path, payload, token);
        }
Ejemplo n.º 28
0
        // GET: Cities
        public async Task <ActionResult> Index()
        {
            //var data2 = await APIHelpers.GetAsync<List<Notifications>>("api/Notification/GetNotifications");
            var data2 = await APIHelpers.GetAsync <List <Notifications> >("api/Notification/GetMessage");

            ViewBag.States = await APIHelpers.GetAsync <List <States> >("api/State/GetStates");

            var data = await APIHelpers.GetAsync <List <City> >("api/City/GetCities");

            return(View(data.ToList()));
        }
        // GET: Interview/Create
        public async Task <ActionResult> Create()
        {
            //var data = await APIHelpers.GetAsync<List<Candidates>>("api/Candidate/GetCandidates");
            //ViewBag.Candidate = new SelectList(data, "Id", "Name", "Email");
            ViewBag.Employee = await APIHelpers.GetAsync <List <Employee> >("api/Employee/GetEmployees");

            ViewBag.emp   = new Employee();
            ViewBag.sdate = DateTime.Now.ToString("MM/dd/yyyy");
            ViewBag.stime = DateTime.Now.ToString("HH:mm");
            return(View());
        }
Ejemplo n.º 30
0
 void Awake()
 {
     APIHelpers.Init();
     Console.WriteLine("Debug Mode Mod Enabled");
     //GameObject a = new GameObject();
     //a.AddComponent<SystemDebug>();
     //GameObject.DontDestroyOnLoad(a);
     //Console.WriteLine(SystemDebug.Enabled);
     IL.SystemDebug.Awake  += SystemDebug_Awake;
     On.SystemLevel.Start  += SystemLevel_Start;
     IL.SystemDebug.Update += SystemDebug_Update;
 }