Exemplo n.º 1
0
        protected void fixSource()
        {
            // var fi = Controller.GetOwnedFileInfosByEmail(Controller._sessionUser.Email);
            ServiceReference1.Package         p      = Controller.GetPackageById(int.Parse("" + DropDownList1.SelectedValue));
            List <ServiceReference1.FileInfo> myList = new List <ServiceReference1.FileInfo>();

            foreach (int s in p.FileIds)
            {
                myList.Add(Controller.GetFileInfoById(s));
            }



            //ServiceReference1.FileInfo f = new ServiceReference1.FileInfo();
            //f.Description = "test fileinfo";
            //f.Name = "Name of f";
            //f.Id = 666;
            //f.OwnerEmail = "*****@*****.**";
            //f.Type = ServiceReference1.FileType.text;
            //f.Date = DateTime.Now;
            //myList.Add(f);

            //ServiceReference1.FileInfo f1 = new ServiceReference1.FileInfo();
            //f1.Description = "test fileinfo222";
            //f1.Name = "Name of f222";
            //f1.Id = 667;
            //f1.OwnerEmail = "[email protected]";
            //f1.Type = ServiceReference1.FileType.text;
            //f1.Date = DateTime.Now;
            //myList.Add(f1);


            //ServiceReference1.FileInfo f2 = new ServiceReference1.FileInfo();
            //f2.Description = "Text about tequila";
            //f2.Name = "TEQUILA";
            //f2.Id = 668;
            //f2.OwnerEmail = "*****@*****.**";
            //f2.Type = ServiceReference1.FileType.text;
            //f2.Date = DateTime.Now;
            //myList.Add(f2);

            DataList1.DataSource = myList;
            DataList1.DataBind();
        }
Exemplo n.º 2
0
        protected void CreatePackageButton_Click(object sender, EventArgs e)
        {
            ServiceReference1.Package package = new ServiceReference1.Package();
            package.Name        = null;               // Set name of new package
            package.FileIds     = new int[] { 0, 0 }; // Which files are to be put in new package? These files have to be present on the server, og man skal kun kunne vælge dem man har edit rights til, vel? #Crelde
            package.Description = null;               // Set description of package.

            try { Controller.CreatePackage(package); } // This function also returns the ID of the new package created, do u need that info? #Crelde #Kewin
            catch (NotLoggedInException)
            {
                // Shouldn't ever happen, but if it does, do a popup and send back to login screen. #Crelde
            }
            catch (InadequateObjectException)
            {
                /* The package does not meet at least one of the following criteria:
                 * The name is not set
                 * The name is not at least 3 characters
                 * The FileIds array is empty
                 * One of the specified FileIds doesnt exist on the server.
                 */
                // Communicate to the user what is required, and lead him back to the "create package screen" #Crelde
            }
        }