예제 #1
0
    private void InitButtonListeners()
    {
        startGameBtn.onClick.AddListener(() =>
        {
#if UNITY_STANDALONE_WIN
            if (TrinaxManager.trinaxAsyncServerManager.loadingCircle.activeSelf)
            {
                return;
            }
            APICalls.RunStartInteraction().WrapErrors();
#endif
            ToInstructions();
        });

        declineTermsBtn.onClick.AddListener(() => { ToScreensaver(); });
        acceptTermsBtn.onClick.AddListener(() => { ToInstructions(); });
        nextResultsBtn.onClick.AddListener(() => {
            if (AppManager.gameManager.IsTop10)
            {
                ToEnterDetails();
            }
            else
            {
                ToScreensaver();
            }
        });
    }
예제 #2
0
    async Task GetResultScenario()
    {
#if UNITY_EDITOR
        AppManager.Instance.scoreManager.Score = 1006;
#endif
        if (!AppManager.Instance.uiManager.useLocalLeaderboard)
        {
            Debug.Log("using database result");
            string r = await APICalls.RunGetResult(AppManager.Instance.scoreManager.Score);

            result = (RESULT_SCENARIO)System.Enum.Parse(typeof(RESULT_SCENARIO), r);
        }
        else
        {
            Debug.Log("Using local result");
            if (AppManager.Instance.scoreManager.Score >= MINIMUM_SCORE)
            {
                if (AppManager.Instance.scoreManager.Score > AppManager.Instance.localLeaderboard.GetLastEntryScore())
                {
                    result = RESULT_SCENARIO.ENTER_LEADERBOARD;
                }
                else
                {
                    result = RESULT_SCENARIO.MET_MINIMUM_SCORE;
                }
            }
            else
            {
                result = RESULT_SCENARIO.NONE;
            }
        }
        Debug.Log(result);
        AppManager.Instance.uiManager.ToResults(result);
    }
예제 #3
0
        protected override ConnectedDeviceDefinition GetDeviceDefinition(string deviceId)
        {
            try
            {
                const uint desiredAccess       = APICalls.GenericRead | APICalls.GenericWrite;
                const uint shareMode           = APICalls.FileShareRead | APICalls.FileShareWrite;
                const uint creationDisposition = APICalls.OpenExisting;

                //Don't request any access here...
                //TODO: Put a nicer number than 0 here
                using (var safeFileHandle = APICalls.CreateFile(deviceId, 0, shareMode, IntPtr.Zero, creationDisposition, 0, IntPtr.Zero))
                {
                    if (safeFileHandle.IsInvalid)
                    {
                        throw new DeviceException($"CreateFile call with Id of {deviceId} failed. Desired Access: {desiredAccess} (GenericRead / GenericWrite). Share mode: {shareMode} (FileShareRead / FileShareWrite). Creation Disposition: {creationDisposition} (OpenExisting)");
                    }

                    Logger?.Log($"Found device {deviceId}", nameof(WindowsHidDeviceFactory), null, LogLevel.Information);

                    return(GetDeviceDefinition(deviceId, safeFileHandle));
                }
            }
            catch (Exception ex)
            {
                Logger?.Log($"{nameof(GetDeviceDefinition)} error. Device Id: {deviceId}", nameof(WindowsHidDeviceFactory), ex, LogLevel.Error);
                return(null);
            }
        }
        public ActionResult Edit(CreateProjectModel objcreateproject)
        {
            CreateProjectDTO objcreate         = new CreateProjectDTO();
            List <string>    Developesassigned = new List <string>();

            if (objcreateproject.UserIds.Trim().Length > 1)
            {
                Developesassigned = objcreateproject.UserIds.Split('#').ToList();
            }
            string     updatedby = User.Identity.GetUserId();
            ProjectDTO obj       = new ProjectDTO {
                ID = objcreateproject.ID, UpdatedBy = updatedby, Name = objcreateproject.Name, Description = objcreateproject.Description, Duration = objcreateproject.Duration, ClientID = objcreateproject.ClientID, PManagerID = objcreateproject.PManagerID, ProposedEndDate = objcreateproject.ProposedEndDate, ShortName = objcreateproject.ShortName, SignUpDate = objcreateproject.SignUpDate, StartDate = objcreateproject.StartDate
            };

            obj.CreatedBy        = User.Identity.GetUserId();
            objcreate.objProject = obj;
            objcreate.Users      = Developesassigned.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
            CustomResponse res = APICalls.Put("projectsapi/Put", objcreate);

            if (res.Status == CustomResponseStatus.Successful)
            {
                return(RedirectToRoute("ProjectHomeRoute"));
            }
            else
            {
                TempData["Message"] = "Failed to Update Project.";
                return(RedirectToAction("Create"));
            }
        }
예제 #5
0
        private void StartSpecificGame(User targetPlayer, string requestingPlayerId, string requestingPlayerName, string channel)
        {
            Channel       ChannelInfo    = APICalls.GetChannelInfo(channel);
            List <string> UsersInChannel = ChannelInfo.members.ToList();

            if (UsersInChannel.Contains(targetPlayer.id))
            {
                GameRound newRound = new GameRound {
                    PlayerOne      = requestingPlayerId,
                    PlayerTwo      = targetPlayer.id,
                    Channel        = channel,
                    PlayerSpecific = true
                };
                Sender.SendMessage(new RTMMessageOut {
                    channel = channel,
                    text    = $"{requestingPlayerName} wants to fist bump {targetPlayer.name}"
                });
                ConsoleMessenger.PrintSuccess($"New game started by {requestingPlayerId}");
                CurrentGames.Add(newRound);
            }
            else
            {
                Sender.SendMessage(new RTMMessageOut {
                    channel = channel,
                    text    = $"{targetPlayer.name} is not this channel"
                });
            }
        }
        public static string ChangeReservations(int idReservation, string startDate, string endDate)
        {
            APICalls api         = new APICalls();
            int      sessionUser = Convert.ToInt32(HttpContext.Current.Session["idUser"]);

            return(api.ChangeReservation(sessionUser, idReservation, startDate, endDate).Result);
        }
        public static string GetUserReservations()
        {
            APICalls api         = new APICalls();
            int      sessionUser = Convert.ToInt32(HttpContext.Current.Session["idUser"]);

            return(api.GetUserReservations(sessionUser).Result);
        }
예제 #8
0
 protected override ConnectedDeviceDefinition GetDeviceDefinition(string deviceId)
 {
     using (var safeFileHandle = APICalls.CreateFile(deviceId, APICalls.GenericRead | APICalls.GenericWrite, APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, 0, IntPtr.Zero))
     {
         return(GetDeviceDefinition(deviceId, safeFileHandle));
     }
 }
        public static string CancelReservation(int idReservation)
        {
            APICalls api         = new APICalls();
            int      sessionUser = Convert.ToInt32(HttpContext.Current.Session["idUser"]);

            return(api.CancelReservation(sessionUser, idReservation).Result);
        }
 public ActionResult Create(UserDTO objuser)
 {
     if (ModelState.IsValid)
     {
         if (UserRepository.UpdateStatus(objuser.Email, "0") == 0)
         {
             objuser.CreatedBy = User.Identity.GetUserId();
             CustomResponse objres = APICalls.Post("AuthenticationAPI/Post?Type=3", objuser);
             if (objres.Status == CustomResponseStatus.Successful)
             {
                 return(RedirectToRoute("UsersHomeRoute", new { Role = "" }));
             }
             else
             {
                 ViewBag.Message = "Error While Creating User";
             }
         }
         else
         {
             UserRepository.ChangeStatus(objuser.Email);
             return(RedirectToRoute("UsersHomeRoute", new { Role = "" }));
         }
     }
     return(View());
 }
예제 #11
0
        //Checkout Button (only visible if gridview has data)
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            shoppingCart = (ArrayList)Session["ShoppingCart"];
            JavaScriptSerializer js  = new JavaScriptSerializer();
            APICalls             api = new APICalls();
            SPCaller             spc = new SPCaller();

            Customer c = new Customer();

            c.Email      = Session["Username"].ToString();
            c.CustomerID = spc.GetCustomerIDByEmail(c.Email);

            //Adding each product into the database
            foreach (Product p in shoppingCart)
            {
                //String jsonCheckout = js.Serialize(p);
                try
                {
                    bool data = api.RecordPurchase(url, p.ID.ToString(), p.Quantity, "1", "0", DateTime.Now.ToString(), DateTime.Now.TimeOfDay.ToString(), c);
                    if (data == true)
                    {
                        Response.Redirect("Confirmation.aspx", false);
                    }
                    else
                    {
                        lblMessage.Text = "A problem occurred while checking out.";
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = "Error: " + ex.Message;
                }
            }
        }
예제 #12
0
        public JsonResult GetUser(string AccessToken, string TokenType, string ExpiresIn, string State)
        {
            SpotifyUser user = APICalls.GetCurrentSpotifyUser(AccessToken);

            return(Json(new { Username = user.display_name, Id = user.id, Email = user.email, Images = user.images, Url = user.external_urls.spotify,
                              Birthday = user.birthdate, Country = user.country, Followers = user.followers }));
        }
        public ActionResult Create(CreateProjectModel objcreateproject)
        {
            //if (ModelState.IsValid)
            //{
            CreateProjectDTO objcreate         = new CreateProjectDTO();
            List <string>    Developesassigned = new List <string>();

            if (objcreateproject.UserIds.Trim().Length > 1)
            {
                Developesassigned = objcreateproject.UserIds.Split('#').ToList();
            }
            ProjectDTO obj = new ProjectDTO {
                Name = objcreateproject.Name, Description = objcreateproject.Description, Duration = objcreateproject.Duration, ClientID = objcreateproject.ClientID, PManagerID = objcreateproject.PManagerID, ProposedEndDate = objcreateproject.ProposedEndDate, ShortName = objcreateproject.ShortName, SignUpDate = objcreateproject.SignUpDate, StartDate = objcreateproject.StartDate
            };

            obj.CreatedBy        = User.Identity.GetUserId();
            objcreate.objProject = obj;
            objcreate.Users      = Developesassigned;
            CustomResponse res = APICalls.Post("projectsapi/post", objcreate);

            if (res.Response != null)
            {
                return(RedirectToRoute("ProjectHomeRoute"));
            }
            else
            {
                TempData["Message"] = "Failed to Add Project.";
                return(RedirectToAction("Create"));
            }
            //}
            //else
            //{
            //    return View(FillCreateProjectModel());
            //}
        }
예제 #14
0
        private bool Initialize()
        {
            Dispose();

            if (string.IsNullOrEmpty(DeviceId))
            {
                throw new WindowsHidException($"{nameof(DeviceId)} must be specified before {nameof(Initialize)} can be called.");
            }

            _ReadSafeFileHandle  = APICalls.CreateFile(DeviceId, APICalls.GenericRead | APICalls.GenericWrite, APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, 0, IntPtr.Zero);
            _WriteSafeFileHandle = APICalls.CreateFile(DeviceId, APICalls.GenericRead | APICalls.GenericWrite, APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, 0, IntPtr.Zero);

            if (_ReadSafeFileHandle.IsInvalid)
            {
                throw new Exception("Could not open connection for reading");
            }

            if (_WriteSafeFileHandle.IsInvalid)
            {
                throw new Exception("Could not open connection for writing");
            }

            ConnectedDeviceDefinition = WindowsHidDeviceFactory.GetDeviceDefinition(DeviceId, _ReadSafeFileHandle);

            _ReadFileStream  = new FileStream(_ReadSafeFileHandle, FileAccess.ReadWrite, ReadBufferSize, false);
            _WriteFileStream = new FileStream(_WriteSafeFileHandle, FileAccess.ReadWrite, WriteBufferSize, false);

            return(true);
        }
        public ActionResult Login(Login model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                MyIdentityUser user = new MyIdentityUser();

                try
                {
                    CustomResponse res = APICalls.Get("AuthenticationAPI/Get?username="******"&password="******"&type=1");
                    if (res.Status == CustomResponseStatus.Successful && res.Response != null)
                    {
                        JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                        serializer1.MaxJsonLength = 1000000000;
                        var uinfo = res.Response.ToString();
                        user = serializer1.Deserialize <MyIdentityUser>(uinfo);
                    }
                }
                catch (System.FormatException ex)
                {
                    return(View());
                }
                if (user.Email != null)
                {
                    IAuthenticationManager authenticationManager = HttpContext.GetOwinContext().Authentication;
                    authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
                    ClaimsIdentity           identity = userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
                    AuthenticationProperties props    = new AuthenticationProperties();
                    props.IsPersistent = model.RememberMe;
                    authenticationManager.SignIn(props, identity);
                    if (Url.IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        List <string> roless = userManager.GetRoles(user.Id).ToList();

                        if (roless[0] == "Administrator")
                        {
                            return(RedirectToRoute("DashboardRoute"));
                        }
                        else if (roless[0] == "Client")
                        {
                            return(RedirectToRoute("ClientDashboardRoute"));
                        }
                        else
                        {
                            return(RedirectToRoute("UserDashboardRoute"));
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username or password.");
                    return(View());
                }
            }
            return(View(model));
        }
예제 #16
0
        // GET: Summoner
        public ActionResult Index(string name)
        {
            Dictionary <string, SummonerDTO> p = APICalls.CallApi <Dictionary <string, SummonerDTO> >("https://na.api.pvp.net", "/api/lol/na/v1.4/summoner/by-name/" + name + "?api_key=");
            SummonerDTO play  = p.First().Value;
            var         model = APICalls.CallApi <RankedStatsDTO>("https://na.api.pvp.net", "/api/lol/na/v1.3/stats/by-summoner/" + play.id.ToString() + "/ranked?season=SEASON2016&api_key=");

            return(View(model));
        }
예제 #17
0
        private void Initialize()
        {
            Dispose();

            int errorCode;

            if (string.IsNullOrEmpty(DeviceId))
            {
                throw new WindowsException($"{nameof(DeviceDefinitionBase)} must be specified before {nameof(InitializeAsync)} can be called.");
            }

            _DeviceHandle = APICalls.CreateFile(DeviceId, (APICalls.GenericWrite | APICalls.GenericRead), APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, APICalls.FileAttributeNormal | APICalls.FileFlagOverlapped, IntPtr.Zero);


            if (_DeviceHandle.IsInvalid)
            {
                //TODO: is error code useful here?
                errorCode = Marshal.GetLastWin32Error();
                if (errorCode > 0)
                {
                    throw new Exception($"Device handle no good. Error code: {errorCode}");
                }
            }

            var isSuccess = WinUsbApiCalls.WinUsb_Initialize(_DeviceHandle, out var defaultInterfaceHandle);

            HandleError(isSuccess, "Couldn't initialize device");

            ConnectedDeviceDefinition = GetDeviceDefinition(defaultInterfaceHandle, DeviceId);

            byte i = 0;

            //Get the first (default) interface
            var defaultInterface = GetInterface(defaultInterfaceHandle);

            _UsbInterfaces.Add(defaultInterface);

            while (true)
            {
                isSuccess = WinUsbApiCalls.WinUsb_GetAssociatedInterface(defaultInterfaceHandle, i, out var interfacePointer);
                if (!isSuccess)
                {
                    errorCode = Marshal.GetLastWin32Error();
                    if (errorCode == APICalls.ERROR_NO_MORE_ITEMS)
                    {
                        break;
                    }

                    throw new Exception($"Could not enumerate interfaces for device {DeviceId}. Error code: { errorCode}");
                }

                var associatedInterface = GetInterface(interfacePointer);

                _UsbInterfaces.Add(associatedInterface);

                i++;
            }
        }
예제 #18
0
    void ToTermsConditions()
    {
        backgroundCanvas.Activate(0);

        TrinaxGlobal.Instance.state = STATE.TERMS_CONDITIONS;
        canvasController.TransitToCanvas((int)TrinaxGlobal.Instance.state, durationToTransit);

        APICalls.RunStartInteraction().WrapErrors();
    }
        /// <summary>
        ///  initilize objects & start program
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            var validation = new ValidationHelper();
            var apiCalls   = new APICalls("http://api.worldbank.org/v2/country");


            var consoleOutput = new ConsoleActions(validation, apiCalls);

            consoleOutput.RequestISOValue();
        }
        public JsonResult ChangePassword(string oldpassword, string newpassword)
        {
            MyIdentityUser    user = userManager.FindByName(HttpContext.User.Identity.Name);
            ChangePasswordDTO objchangepassword = new ChangePasswordDTO {
                userid = user.Id, oldpassword = oldpassword, newpassword = newpassword, ChageType = 2
            };
            CustomResponse restype1 = APICalls.Put("AuthenticationAPI/Put", objchangepassword);

            return(Json(restype1, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GenerateReportEmail(string userID, string TaskStatus, string TaskType, string FromDate, string ToDate)
        {
            ReportsModel objreportdata = BindReportData();
            ReportDTO    objreportdto  = new ReportDTO {
                UserID = userID, TaskStatusID = Convert.ToInt32(TaskStatus), TaskTypeID = Convert.ToInt32(TaskType), FromDate = Convert.ToDateTime(FromDate), ToDate = Convert.ToDateTime(ToDate)
            };
            CustomResponse response = APICalls.Put("userreportapi/Put", objreportdto);

            return(Json(new { response.Message }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UpdateTaskStatus(int taskid, int status)
        {
            CustomResponse res = APICalls.Put("TaskTrasactionsAPI/Put?ticketid=" + taskid + "&status=" + status + "&updatedby=" + User.Identity.GetUserId(), null);

            if (res.Status == CustomResponseStatus.Successful)
            {
                return(RedirectToRoute("EditTicketRoute", new { ticketid = taskid }));
            }
            ViewBag.Message = "Failed to Create Task";
            return(RedirectToRoute("EditTicketRoute", new { ticketid = taskid }));
        }
예제 #23
0
    async void ToThankyou(float duration)
    {
        thankyouPageScoreText.text = AppManager.Instance.scoreManager.Score.ToString();

        TrinaxGlobal.Instance.state = STATE.THANKYOU;
        canvasController.TransitToCanvas((int)TrinaxGlobal.Instance.state, durationToTransit);

        await new WaitForSeconds(duration);

        backgroundCanvas.Activate(0, true);
        APICalls.RunEndInteraction().WrapErrors();
        ToScreensaver(SCREENSAVER_STATE.LEADERBOARD);
    }
예제 #24
0
        // GET: Dashboard
        public ActionResult Dashboard()
        {
            string               Role = RoleHelper.GetUserRole();
            DashboardModel       objdashboardModel = new DashboardModel();
            JavaScriptSerializer serializer1       = new JavaScriptSerializer();

            CustomResponse ObjActivityData = APICalls.Get("DashboardAPI/Get?Type=3&pageno=0");

            if (ObjActivityData.Status == CustomResponseStatus.Successful && ObjActivityData.Response != null)
            {
                var jsondata = ObjActivityData.Response.ToString();
                objdashboardModel.ActivityDTO = serializer1.Deserialize <List <Trans_TicketDTO> >(jsondata);
            }

            CustomResponse response = APICalls.Get("DashboardAPI/Get?Type=1&pageno=0");

            if (response.Status == CustomResponseStatus.Successful)
            {
                serializer1.MaxJsonLength = 1000000000;
                var projects = response.Response.ToString();
                List <DashBoardStatisticsDTO> dbinfo = serializer1.Deserialize <List <DashBoardStatisticsDTO> >(projects);
                foreach (DashBoardStatisticsDTO ds in dbinfo)
                {
                    if (ds.Type == "1")
                    {
                        objdashboardModel.ProjectsCount = ds.Count;
                    }
                    else if (ds.Type == "2")
                    {
                        objdashboardModel.ClientsCount = ds.Count;
                    }
                    else if (ds.Type == "3")
                    {
                        objdashboardModel.AdminsCount = ds.Count;
                    }
                    else if (ds.Type == "4")
                    {
                        objdashboardModel.UsersCount = ds.Count;
                    }
                }
                CustomResponse objtabledata = APICalls.Get("DashboardAPI/Get?Type=2&pageno=0");
                if (objtabledata.Status == CustomResponseStatus.Successful)
                {
                    var tabledata = objtabledata.Response.ToString();
                    objdashboardModel.TableData = serializer1.Deserialize <List <ProjectTicketUsersDTO> >(tabledata);
                }
                return(View(objdashboardModel));
            }
            return(View());
        }
예제 #25
0
        private bool Initialize()
        {
            try
            {
                Close();

                if (string.IsNullOrEmpty(DeviceId))
                {
                    throw new WindowsHidException($"{nameof(DeviceId)} must be specified before {nameof(Initialize)} can be called.");
                }

                _ReadSafeFileHandle  = APICalls.CreateFile(DeviceId, APICalls.GenericRead | APICalls.GenericWrite, APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, 0, IntPtr.Zero);
                _WriteSafeFileHandle = APICalls.CreateFile(DeviceId, APICalls.GenericRead | APICalls.GenericWrite, APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, 0, IntPtr.Zero);

                if (_ReadSafeFileHandle.IsInvalid)
                {
                    throw new Exception("Could not open connection for reading");
                }

                if (_WriteSafeFileHandle.IsInvalid)
                {
                    throw new Exception("Could not open connection for writing");
                }

                ConnectedDeviceDefinition = WindowsHidDeviceFactory.GetDeviceDefinition(DeviceId, _ReadSafeFileHandle);

                var readBufferSize  = ReadBufferSize;
                var writeBufferSize = WriteBufferSize;

                if (readBufferSize == 0)
                {
                    throw new WindowsHidException($"{nameof(ReadBufferSize)} must be specified. HidD_GetAttributes may have failed or returned an InputReportByteLength of 0. Please specify this argument in the constructor");
                }

                if (writeBufferSize == 0)
                {
                    throw new WindowsHidException($"{nameof(WriteBufferSize)} must be specified. HidD_GetAttributes may have failed or returned an OutputReportByteLength of 0. Please specify this argument in the constructor. Note: Hid devices are always opened in write mode. If you need to open in read mode, please log an issue here: https://github.com/MelbourneDeveloper/Device.Net/issues");
                }

                _ReadFileStream  = new FileStream(_ReadSafeFileHandle, FileAccess.ReadWrite, readBufferSize, false);
                _WriteFileStream = new FileStream(_WriteSafeFileHandle, FileAccess.ReadWrite, writeBufferSize, false);
            }
            catch (Exception ex)
            {
                Logger?.Log($"{nameof(Initialize)} error.", nameof(WindowsHidDevice), ex, LogLevel.Error);
                throw;
            }

            return(true);
        }
예제 #26
0
        private void SaveSearchParamsToLocalDB(Dictionary <string, string> param, string url)
        {
            string url2 = url.Substring(0, 50);

            APICalls call = new APICalls();

            call.FoodType      = param["FoodType"];
            call.Cuisine       = param["Cuisine"];
            call.SearchedCity  = param["SearchedCity"];
            call.SearchedState = param["SearchedState"];
            call.Url           = url2;
            _context.RegisteredApiCalls.Add(call);
            _context.SaveChanges();
        }
        // GET: Projects
        public ActionResult ListAll()
        {
            CustomResponse res = APICalls.Get("projectsapi/Get?projectid=0&userid=" + User.Identity.GetUserId());

            if (res.Response != null)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var uinfo = res.Response.ToString();
                List <ProjectDTO> userinfo = serializer1.Deserialize <List <ProjectDTO> >(uinfo);
                return(View(userinfo));
            }
            return(View());
        }
예제 #28
0
        // GET: Dashboard
        public ActionResult Dashboard()
        {
            DashboardModel objdashboardModel = new DashboardModel();
            CustomResponse response          = APICalls.Get("UserDashboardAPI/Get?userid=" + User.Identity.GetUserId() + "&pageno=0");

            if (response.Status == CustomResponseStatus.Successful)
            {
                JavaScriptSerializer serializer1 = new JavaScriptSerializer();
                serializer1.MaxJsonLength = 1000000000;
                var projects            = response.Response.ToString();
                UserDashboardDTO dbinfo = serializer1.Deserialize <UserDashboardDTO>(projects);
                return(View(dbinfo));
            }
            return(View());
        }
예제 #29
0
 protected override ConnectedDeviceDefinition GetDeviceDefinition(string deviceId)
 {
     try
     {
         using (var safeFileHandle = APICalls.CreateFile(deviceId, APICalls.GenericRead | APICalls.GenericWrite, APICalls.FileShareRead | APICalls.FileShareWrite, IntPtr.Zero, APICalls.OpenExisting, 0, IntPtr.Zero))
         {
             return(GetDeviceDefinition(deviceId, safeFileHandle));
         }
     }
     catch (Exception ex)
     {
         Logger?.Log($"{nameof(GetDeviceDefinition)} error. Device Id: {deviceId}", nameof(WindowsHidDeviceFactory), ex, LogLevel.Error);
         return(null);
     }
 }
        public ActionResult Delete(string id)
        {
            CustomResponse res = APICalls.Delete("AuthenticationAPI/Delete?userid=" + id);

            if (res.Status == CustomResponseStatus.Successful)
            {
                TempData["Message"] = res.Message;
                return(RedirectToRoute("UsersHomeRoute", new { Role = "" }));
            }
            else
            {
                ViewBag.Message = "Failed to Delete User";
                return(View());
            }
        }