public ActionResult AddActivity(string Phone, int ID) { _companyApi = new CompanyApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1"); _activityApi = new ActivityApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1"); string conditions = "ID=" + ID; List <CompanyFindResult> list2 = _companyApi.FindCompanies(conditions, "CompanyName asc", new int?(100000), new int?(0), new List <string> { "Id", "CompanyName", "CompanyIdentifier" }); _memberApi = new MemberApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1"); List <MemberFindResult> MembersList = _memberApi.FindMembers("", "FirstName asc", new int?(1000), new int?(0), new List <string> { "Id", "MemberIdentifier", "FirstName", "LastName" }); var membersQuery = MembersList.Select(a => new { MemberIdentifier = a.MemberIdentifier, Name = a.FirstName + " " + a.LastName }).ToList(); ViewBag.MembersList = new SelectList(membersQuery.AsEnumerable(), "MemberIdentifier", "Name"); List <ActivityFindResult> ActivityTypeList = _activityApi.FindActivities("", "Id asc", new int?(1000), new int?(0), new List <string> { "ActivityTypeDescription" }); var query = ActivityTypeList.Where(a => a.ActivityTypeDescription != null).Select(a => new { a.ActivityTypeDescription }).Distinct().ToList(); ViewBag.ActivityList = new SelectList(query.AsEnumerable(), "ActivityTypeDescription", "ActivityTypeDescription"); ActivityModel model = new ActivityModel(); model.Phone = Phone; model.ContactId = GetContactsId(Phone); model.CompanyIdentifier = list2.FirstOrDefault().CompanyIdentifier; model.CompanyName = list2.FirstOrDefault().CompanyName; return(View("AddActivity", model)); }
static void DoTeamOnly(string clientId, string password, string subUnitId) { // Activities var eValueActivities = new ActivityApi(clientId, password, subUnitId, "https://api.e-value.net/Activity_1_0b.cfc"); var activityMonkey = eValueActivities.GetAllActivities(); // Teams - are a child of an activity - must be part of an activity var eValueTeams = new TeamApi(clientId, password, subUnitId, "https://api.e-value.net/Team_1_0.cfc"); foreach (var activity in activityMonkey.Activities) { Console.WriteLine($"~~~~ Activities: {activity.ActivityId} {activity.Abbreviation} {activity.Name} {activity.SiteId} "); var teamForActivity = eValueTeams.GetAllTeams(activity.ActivityId.ToString()); foreach (var team in teamForActivity.Teams) { Console.WriteLine($"~~~~ ~~~~ Team : {team.TeamId} {team.Name} ActivityId: {team.ActivityId} "); } } }
public ActionResult SaveActivity(ActivityModel model) { ContactInformation contactModel = new ContactInformation(); contactModel.ContactId = model.ContactId; _activityApi = new ActivityApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1"); Activity activityModel = new Activity(); activityModel.CompanyIdentifier = model.CompanyIdentifier; activityModel.Contact = contactModel; activityModel.Type = model.ActivityType; activityModel.Subject = model.Subject; activityModel.AssignTo = model.AssignTo; activityModel.Notes = model.Notes; activityModel.Id = 0; var result = _activityApi.AddOrUpdateActivity(activityModel); return(RedirectToAction("Index", new { callerID = model.Phone })); }
static void Main(string[] args) { string clientId = ConfigurationManager.AppSettings["ClientId"]; string password = ConfigurationManager.AppSettings["ClientPassword"]; string subUnitId = ConfigurationManager.AppSettings["SubUnitId"]; if (args != null && args.Length > 0) { switch (args[0]) { case "personal-records": new PersonalRecordsTest(clientId, password, subUnitId); break; default: break; } } else { //DoAllSchedules DoAllSchedules(clientId, password, subUnitId); // Use this to only test a single evaluation - uncomment for fixing this. DoSingleEvaluationOnly(clientId, password, subUnitId); // Use this to only test evaluations - uncomment for fixing this. //DoAllEvaluations(clientId, password, subUnitId); // Use this to only test teams DoTeamOnly(clientId, password, subUnitId); // EvaluationActions var eValueEvaluationActions = new ScheduleApi(clientId, password, subUnitId, "https://test-api.e-value.net/Schedule_1_0b.cfc"); foreach (var options in eValueEvaluationActions.GetEvaluationActions().EvaluationActions) { Console.WriteLine($"(^&)(^&) Evaluation Actions: {options.EvaluationActionId} {options.Description} "); } // Personal Records Options var eValuePersonalRecordOptions = new PersonalRecordOptionApi(clientId, password, subUnitId, "https://test-api.e-value.net/IandCOptions_1_0.cfc"); foreach (var options in eValuePersonalRecordOptions.GetAllRequirementOptions().RequirementOptions) { Console.WriteLine($"~!~!~! Personal Records Option: {options.RequirementId} {options.RequirementLabel} "); } foreach (var options in eValuePersonalRecordOptions.GetAllRequirementStatusOptions().RequirementStatusOptions) { Console.WriteLine($"~!~!~!~!~! Personal Records Status Option: {options.StatusId} {options.StatusLabel} "); } foreach (var options in eValuePersonalRecordOptions.GetAllRequirementTypeOptions().RequirementTypeOptions) { Console.WriteLine($"~!~!~!~!~!~!~! Personal Records Type Option: {options.TypeId} {options.TypeLabel} "); } // Statuses var eValuePeopleGroup = new PeopleGroupApi(clientId, password, subUnitId, "https://test-api.e-value.net/PeopleGroup_1_0.cfc"); foreach (var groups in eValuePeopleGroup.GetAll().PeopleGroups) { Console.WriteLine($"%%%% People Groups: {groups.GroupId} {groups.Name} "); var peopleInGroup = eValuePeopleGroup.GetUsers(groups.GroupId.ToString()); foreach (var institutionUser in peopleInGroup.IntitutionUsers ?? Enumerable.Empty <InstitutionUser>()) { Console.WriteLine($"%%%% %%%% People In the Group: {institutionUser.UserId} {institutionUser.FirstName} {institutionUser.LastName} "); } } // Statuses var eValueStatus = new StatusApi(clientId, password, subUnitId, "https://test-api.e-value.net/Status_1_0.cfc"); foreach (var status in eValueStatus.GetAll().Statuses) { Console.WriteLine($"@@@@ Statuses: {status.StatusId} {status.Label} "); } // Ranks var eValueRanks = new RankApi(clientId, password, subUnitId, "https://api.e-value.net/Rank_1_0.cfc"); foreach (var rank in eValueRanks.GetAll().Ranks) { Console.WriteLine($"==== Ranks: {rank.RankId} {rank.Label} "); } // Roles var eValueRoles = new RoleApi(clientId, password, subUnitId, "https://api.e-value.net/Role_1_0.cfc"); foreach (var role in eValueRoles.GetAll().Roles) { Console.WriteLine($"++++ Roles: {role.RoleId} {role.Label} "); } // Schedules - used later in User info var eValueShedules = new ScheduleApi(clientId, password, subUnitId, "https://test-api.e-value.net/Schedule_1_0b.cfc"); // Evaluations - used later in User info var eValueEval = new EvaluationApi(clientId, password, subUnitId, "https://test-api.e-value.net/Evaluation_1_0b.cfc"); // Activities var eValueActivities = new ActivityApi(clientId, password, subUnitId, "https://test-api.e-value.net/Activity_1_0b.cfc"); var activityMonkey = eValueActivities.GetAllActivities(); // Teams - are a child of an activity - must be part of an activity var eValueTeams = new TeamApi(clientId, password, subUnitId, "https://test-api.e-value.net/Team_1_0.cfc"); foreach (var activity in activityMonkey.Activities) { Console.WriteLine($"~~~~ Activities: {activity.ActivityId} {activity.Abbreviation} {activity.Name} {activity.SiteId} "); var teamForActivity = eValueTeams.GetAllTeams(activity.ActivityId.ToString()); } // Time Frames var eValueTimeFrame = new TimeFrameApi(clientId, password, subUnitId, "https://test-api.e-value.net/TimeFrame_1_0.cfc"); var timeFrameInfo = eValueTimeFrame.GetAllTimeFrames(DateTime.MinValue, DateTime.MaxValue); foreach (var timeFrame in timeFrameInfo.TimeFrames) { var frame = eValueTimeFrame.Get(timeFrame.TimeFrameId); Console.WriteLine($">>>> Time Frames: {frame.TimeFrame.TimeFrameId} {frame.TimeFrame.TimeFrameLabel} {frame.TimeFrame.TimeFrameBegin} {frame.TimeFrame.TimeFrameEnd} "); } // User - individual var eValueUser = new UserApi(clientId, password, subUnitId, "https://test-api.e-value.net/User_1_0b.cfc"); var user = eValueUser.Get("79491668"); // Sites - all var eValueSiteApi = new SiteApi(clientId, password, subUnitId, "https://test-api.e-value.net/Site_1_0.cfc"); var sites = eValueSiteApi.GetAllSites(); foreach (var site in sites.Sites) { Console.WriteLine($"^^^^^ sites: {site.SiteId} {site.SiteName} "); } // User - all var institution = new InstitutionApi(clientId, password, subUnitId, "https://test-api.e-value.net/Institution_1_0.cfc"); var userList = institution.GetSubUnitUsers(1); // ************************************* // User and Personal Records // ************************************* var eValuePersonalRecords = new PersonalRecordApi(clientId, password, subUnitId, "https://test-api.e-value.net/IandC_1_0.cfc"); var record = eValuePersonalRecords.GetUserPersonalRecords("1193570"); // Haley Artz - should have a lot of them - test this in production or on Tuesday after transfer has occurred. foreach (var monkeyUser in userList.IntitutionUsers) { Console.WriteLine($"***************************"); Console.WriteLine($"User List Item: {monkeyUser.UserId}-{monkeyUser.FirstName} {monkeyUser.LastName} : {monkeyUser.RankLabel}"); Console.WriteLine($"***************************"); Console.WriteLine(String.Empty); // ************************************* // Get the personal records for the given user // ************************************* var records = eValuePersonalRecords.GetUserPersonalRecords(monkeyUser.UserId.ToString()); foreach (var personalRecord in records.PeronalRecords) { Console.WriteLine($"##### ##### Personal Records: {personalRecord.RequirementId} {personalRecord.EventDate} {personalRecord.StatusId} "); } // ************************************* // Get the schedules for the given user // ************************************* var schedule = eValueShedules.GetAll(monkeyUser.UserId.ToString()); foreach (var scheduleItem in schedule.Schedules) { Console.WriteLine($"----- Schedule Item: {scheduleItem.ActivityId}-{scheduleItem.BeginDate} {scheduleItem.EndDate} {scheduleItem}"); } // ************************************* // Get the schedules for the given user in the year 2017 - this time to get the evaluations. // ************************************* var scheduleByDate = eValueShedules.GetAll(new DateTime(2017, 1, 1), new DateTime(2017, 12, 31), monkeyUser.UserId.ToString()); int[] evalStatusList = { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8 }; foreach (var scheduleItem in scheduleByDate.Schedules) { foreach (int statusValue in evalStatusList) { // Updated in the last 30 days var evaluationItems = eValueEval.GetResponses(scheduleItem.ActivityId.ToString(), (DateTime)scheduleItem.BeginDate, (DateTime)scheduleItem.EndDate, statusValue, DateTime.Now.AddDays(-30)); foreach (var evaluationItem in evaluationItems.EvaluationItems) { Console.WriteLine($"----- ---- Evaluation Item: {evaluationItem.SiteName} {evaluationItem.Name} {evaluationItem.ActivityId}"); } } } } } }
public void Init() { instance = new ActivityApi(); }
// public ActionResult EndCall(string PhoneNo, string Ext) // { // if (Session["Call"] != null) // { // if (Session["Call"].ToString() == PhoneNo) // { // string Name = ""; // string conditions = "Phone = '" + PhoneNo + "'"; // List<ContactFindResult> list3 = _contactApi.FindContacts(conditions, "", new int?(1000), new int?(0), "", new List<string> //{ // "Id", // "FirstName", // "LastName", // "Type", // "CompanyId", // "CompanyName" //}); // if (list3.Count > 0) // { // Name = list3[0].FirstName + " " + list3[0].LastName; // } // TimeSpan duration = DateTime.Now - DateTime.Parse(Session["CallTime"].ToString()); // CallHistory tableobj = new Models.CallHistory(); // tableobj.CallDate = DateTime.Now; // tableobj.ContactNo = PhoneNo; // tableobj.Name = Name; // tableobj.UserExtension = Ext; // tableobj.CallTime = duration.Hours.ToString() + ":" + duration.Minutes.ToString() + ":" + duration.Seconds.ToString(); // db.CallHistories.Add(tableobj); // db.SaveChanges(); // Session["Call"] = null; // } // } // string text3 = "<?xml version='1.0' encoding='UTF-8' ?><response><result><call_url/></result></response>"; // return base.Content(text3, "text/xml"); // //return View(); // } public ActionResult Index(string callerID = "2242307730") { if (callerID.StartsWith(" 1")) { callerID = callerID.Remove(0, 2); } else if (callerID.StartsWith("1")) { callerID = callerID.Remove(0, 1); } else if (callerID.StartsWith("%2B1")) { callerID = callerID.Remove(0, 3); } else if (callerID.StartsWith("+1")) { callerID = callerID.Remove(0, 2); } else if (callerID.StartsWith(" ")) { callerID = callerID.Remove(0, 0); } string arg_80_0 = string.Empty; string str = string.Empty; _contactApi = new ContactApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1"); new List <ContactModel>(); ContactModel obj = new ContactModel(); obj.Phone = callerID; string conditions = "Phone = '" + callerID + "'"; List <ContactFindResult> list3 = _contactApi.FindContacts(conditions, "", new int?(1000), new int?(0), "", new List <string> { "Id", "FirstName", "LastName", "Type", "CompanyId", "CompanyName" }); if (list3.Count > 0) { ViewBag.Contact = 1; foreach (ContactFindResult current2 in list3) { obj.CompanyID = current2.CompanyId; obj.FirstName = current2.FirstName; obj.LastName = current2.LastName; obj.Type = current2.Type; obj.CompanyName = current2.CompanyName; obj.ContactId = current2.Id; } } // var phoneno = "2242307730"; conditions = "PhoneNumber= '" + callerID + "'"; _activityApi = new ActivityApi("https://control.mysupport247.net", "Mysupport247", "SwitchvoxAPI", "mH5219b2vri0KUa", "NovaramCred1"); List <ActivityFindResult> activitylist = _activityApi.FindActivities(conditions, "", new int?(100000), new int?(0), new List <string> { "Id", "Subject", "Notes", "AssignToResource", "DueDate", "ActivityTypeDescription", "StartTime" }); foreach (ActivityFindResult currentactivity in activitylist) { obj.ActivityList.Add(new ActivityModel { ActivityTypeDescription = currentactivity.ActivityTypeDescription, AssignTo = currentactivity.AssignToResource, Notes = currentactivity.Notes, DueDate = currentactivity.StartTime, Subject = currentactivity.Subject }); } // ViewBag.CallHistory = db.CallHistories.Where(x => x.UserExtension == ExtNo).OrderBy(x => x.ID).Take(10).ToList(); return(View(obj)); }