Esempio n. 1
0
        public static void Run()
        {
            // ExStart:1
            CellsApi   cellsApi   = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName  = "Sample_Test_Book.xls";
            String sheetName = "Sheet2";
            String cellName  = "a1";
            String value     = "99";
            String type      = "int";
            String formula   = "";
            String storage   = "";
            String folder    = "";

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));

                // Invoke Aspose.Cells Cloud SDK API to set cell value of worksheet
                CellResponse apiResponse = cellsApi.PostWorksheetCellSetValue(fileName, sheetName, cellName, value, type, formula, storage, folder);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Console.WriteLine("Set Value of a Cell in a Worksheet, Done!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
Esempio n. 2
0
        public void InsertCell(Cell cell)
        {
            CellResponse mr = null;

            try
            {
                var result = sudokuService.SetNumberInCell(cell, Context.ConnectionId);

                if (result.IsWin)
                {
                    mr = new CellResponse(MoveStatuses.Won, cell, result.WinUser);
                    sudokuService.Reset();
                }
                else
                {
                    mr = new CellResponse(cell);
                }
            }
            catch (AlreadyExistException ex)
            {
                mr = new CellResponse(ex);
            }
            catch (NoSolutionException ex)
            {
                mr = new CellResponse(ex);
            }

            if (mr.status == MoveStatuses.Error)
            {
                Clients.Client(Context.ConnectionId).InsertNumber(mr);
            }
            else if (mr.status == MoveStatuses.Won)
            {
                Clients.Client(Context.ConnectionId).InsertNumber(mr);
                Clients.AllExcept(Context.ConnectionId).InsertNumber(new CellResponse(MoveStatuses.Lost, cell));
            }
            else
            {
                Clients.All.InsertNumber(mr);
            }
        }