Esempio n. 1
0
        //public ResultLogs ModelResultLogs;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                    {
                        //显示初始化三个ref的值
                        //double ymax = 0;
                        //double xmax = 0;
                        //StringBuilder sb = new StringBuilder();
                        //ReadFileForChart("C:\\out\\initialization.dat", 3, 1, 3, ref ymax, ref xmax, ref sb);
                        //litForScript.Value = sb.ToString();

                        //显示初始化三个ref的值
                        double ymax = 0;
                        double xmax = 0;
                        StringBuilder sb = new StringBuilder();
                        string TaskID = Request["TaskID"];
                        //ModelYunBLL.ResultLogs BLLResultLogs = new ModelYunBLL.ResultLogs();
                        ResultLogsServiceClient rs = new ResultLogsServiceClient();
                        //ModelResultLogs = new ResultLogs();
                        //ModelResultLogs = rs.GetModelOne(TaskID);
                        TaskProcessedDataServiceClient taskProcessedDataService=new TaskProcessedDataServiceClient();
                        List<TaskProcessedDataSet> taskProcessedDataSetList=new List<TaskProcessedDataSet>();
                        taskProcessedDataSetList.AddRange(taskProcessedDataService.GetDataSetByTaskGuid(TaskID));
                        foreach(TaskProcessedDataSet oneDataSet in taskProcessedDataSetList){
                            List<TaskProcessedDataRecord> dataSetRecords=new List<TaskProcessedDataRecord>();
                            dataSetRecords.AddRange(taskProcessedDataService.QueryDataSet(oneDataSet.guid,1,0));
                            foreach(TaskProcessedDataRecord one in dataSetRecords){
                                string temp = "sin.push([" + SerializationUtil.ToArray(one.record)[0] + "," + one.seq + "]);";
                                sb.Append(temp);
                            }
                        }
                        //   StringBuilder strForScript
                        //   string temp = "sin.push([" + ss[Col1year] + "," + ss[Col2SEQ] + "]);";
                        //   strForScript.Append(temp);
                        //
                        litForScript.Value = sb.ToString();
                    }
        }
Esempio n. 2
0
        public static Package[] CollectPackages()
        {
            List<int> viewIds = new List<int>(), editIds = new List<int>(), ownIds = new List<int>();

            // [Hack]: Empty string returns all files.
            foreach (var info in SearchFileInfos(""))
            {
                var id = info.Id;

                if (IsOwnerOf(id))
                {
                    ownIds.Add(id);
                }
                else if (HasEditRights(id))
                {
                    editIds.Add(id);
                }
                else if (HasViewRights(id))
                {
                    viewIds.Add(id);
                }
                else
                {
                    throw new Exception("Leak in SearchPackages. A FileInfo to which the current user has no rights, has been retrieved.");
                }
            }

            var viewable = new Package() { Description = "Contains all viewable files.", Id = -1, Name = "Viewable Files", OwnerEmail = _sessionUser.Email, FileIds = viewIds.ToArray<int>() };
            var editable = new Package() { Description = "Contains all editable files.", Id = -2, Name = "Editable Files", OwnerEmail = _sessionUser.Email, FileIds = editIds.ToArray<int>() };
            var owned    = new Package() { Description = "Contains all owned files.",    Id = -3, Name = "Owned Files",    OwnerEmail = _sessionUser.Email, FileIds = ownIds.ToArray<int>()  };

            // [Hack]: Empty string returns all packages.
            var packs = new List<Package>(SearchPackages(""));

            packs.AddRange(new Package[] {viewable,editable,owned});

            return packs.ToArray<Package>();
        }
Esempio n. 3
0
 /// <summary>Checks whether the current user is the owner of the item with the specified Id.</summary>
 /// <param name="itemId">The Id of the item in question.</param>
 /// <returns>True if the user owns the item, false if not.</returns>
 public static bool IsOwnerOf(int itemId)
 {
     List<Item> items = new List<Item>(GetOwnedFileInfosByEmail(_sessionUser.Email));
     items.AddRange(GetOwnedPackagesByEmail(_sessionUser.Email));
     return items.Any<Item>(item => item.Id == itemId);
 }