Solved

C# Error - URGENT!!

Posted on 2009-07-03
4
454 Views
Last Modified: 2013-12-17
Hi,

We modified some code inside a .cs file, I then put the code back and re-saved the file, but we are now getting this error:

Compiler Error Message: CS1518: Expected class, delegate, enum, interface, or struct

Source Error:

 

Line 99:     [WebMethod(EnableSession = true)]
Line 100:    [ScriptMethod()]
Line 101:    public string ResizeDirectoryImages(int directoryItemID, int position)
Line 102:    {
Line 103:        ePath.Tools.ImageTools.ResizeImage(
 
Can anyone help please??
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Web.Script.Services;
using ePath.ObjectToSQLServer;
using System.Linq;
 
/// <summary>
/// Summary description for DD
/// </summary>
[WebService(Namespace = "http://tempuri.org/")][ScriptService()][GenerateScriptType(typeof(AssociateResource))]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class DD : System.Web.Services.WebService
{
 
    public DD()
    {
 
        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
 
    [WebMethod( EnableSession=true)][ScriptMethod()]
    public string SavePersonalDevelopmentItem( string itemDate, string activity, string outcomes, string notes, int personalDevelopmentItemID )
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        PersonalDevelopmentItem pdi = new PersonalDevelopmentItem(personalDevelopmentItemID);
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration || lu.User.UserID == pdi.DesignAssociateID )
        {
            DateTime dtItemDate = new DateTime();
            if (!DateTime.TryParse(itemDate, out dtItemDate))
                return "InvalidDate";
            pdi.ItemDate = dtItemDate;
            pdi.Activity = activity;
            pdi.Outcomes = outcomes;
            pdi.Notes = notes;
            pdi.Save();
            return "OK";
        }
        else
        {
            return "Access Denide";
        }
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public string DeletePersonalDevelopmentItem(int personalDevelopmentItemID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            PersonalDevelopmentItem pdi = new PersonalDevelopmentItem(personalDevelopmentItemID);
            pdi.Delete();
            return "OK";
        }
        else
        {
            return "Access Denide";
        }
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public string DeletePersonalDevelopmentFile(int personalDevelopmentFileID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            PersonalDevelopmentFile pdf = new PersonalDevelopmentFile(personalDevelopmentFileID);
 
            string path = Server.MapPath("~/Resources/pdFiles/" + pdf.PersonalDevelopmentFileID.ToString() + "/");
            try
            {
                System.IO.File.Delete(path + pdf.FileName);
 
                pdf.Delete();
            }
            catch
            {
            }
 
            PersonalDevelopmentItem pdi = new PersonalDevelopmentItem(pdf.PersonalDevelopmentItemID);
            return pdi.FilesJson;
        }
        else
        (
            return "Access Denide";
            
        }
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public string ResizeDirectoryImages(int directoryItemID, int position)
    {
        ePath.Tools.ImageTools.ResizeImage(
            Server.MapPath("~/Resources/DirectoryImages/" + directoryItemID.ToString() + "_" + position.ToString() + ".jpg"),
            Server.MapPath("~/Resources/DirectoryImages/" + directoryItemID.ToString() + "_" + position.ToString() + "_thumb.jpg"), 60, 60, 75, ePath.Tools.ImageTools.eResizeMethod.Crop, System.Drawing.Color.White);
        return "Done";
    }
    
 
    #region Resources
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public List<AssociateResource> AssociateResourceSelect()
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            return AssociateResource.GetList();
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public AssociateResource AssociateResourceSave(string name, int resourceID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        AssociateResource ar = new AssociateResource(resourceID);
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration || ar.AssociateResourceID ==0 || ar.DesignAssociateID == lu.User.DesignAssociateID)
        {
            
            ar.Name = name;
            ar.Save();
 
            return ar;
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public void AssociateResourceDelete(int resourceID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        AssociateResource ar = new AssociateResource(resourceID);
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration || ar.AssociateResourceID ==0 || ar.DesignAssociateID == lu.User.DesignAssociateID)
        {
            ar.Delete();
            try
            {
                System.IO.Directory.Delete(Server.MapPath("~/Resources/AssociateResources/" + ar.AssociateResourceID + "/"), true);
            }
            catch { }
        }
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public void ResourceDownloaded(int resourceID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            ResourceDownload rd = new ResourceDownload();
            rd.DateDownloaded = DateTime.Now;
            rd.HandbookItemID = resourceID;
            rd.UserID = lu.User.UserID;
            rd.DesignAssociateID = lu.User.DesignAssociateID;
            rd.Save();
        }
    }
 
    #endregion
 
    #region Handbook
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public List<HandbookItem> HandbookItemSelect(  )
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            return HandbookItem.GetList();
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public HandbookItem HandbookItemSave(string name, string groupName, int resourceID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        HandbookItem ar = new HandbookItem(resourceID);
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            ar.GroupName = groupName;
            ar.Name = name;
            ar.Save();
 
            return ar;
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public void HandbookItemDelete(int resourceID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        HandbookItem ar = new HandbookItem(resourceID);
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration )
        {
            ar.Delete();
            try
            {
                System.IO.Directory.Delete(Server.MapPath("~/Resources/HandbookItems/" + ar.HandbookItemID + "/"), true);
            }
            catch { }
        }
    }
 
    #endregion
 
    #region Coaching
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public HandbookItem CoachingItemSave(string name, string groupName, int resourceID, int designAssociateID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        HandbookItem ar = new HandbookItem(resourceID);
        if (lu.IsLoggedIn)
        {
            ar.DesignAssociateID = designAssociateID;
            ar.GroupName = groupName;
            ar.Name = name;
            ar.Save();
 
            return ar;
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public List<HandbookItem> CoachingItemsSelect(int designAssociateID)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            return HandbookItem.GetList().Where( item => item.DesignAssociateID == designAssociateID).ToList();
        }
        return null;
    }
 
    #endregion
 
    #region Software
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public List<SofwareDownload> SoftwareDownloadsSelect()
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            return SofwareDownload.GetList();
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public SofwareDownload SoftwareDownloadSave(SofwareDownload sdi)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            if (sdi.IdentityValue == 0)
                sdi.DesignAssociateID = lu.User.DesignAssociateID;
 
            sdi.Save();
            return sdi;
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public void SoftwareDownloadDelete(SofwareDownload sdi)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
 
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            sdi.Delete();
        }
    }
 
    #endregion
 
    #region FAQs
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public List<FAQ> FAQsSelect()
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            return FAQ.GetList();
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public FAQ FAQSave(FAQ sdi)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
 
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            if (sdi.IdentityValue == 0)
                sdi.DesignAssociateID = lu.User.DesignAssociateID;
 
            sdi.Save();
            return sdi;
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public void FAQDelete(FAQ sdi)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
 
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            sdi.Delete();
        }
    }
 
    #endregion
 
    #region Case Studies
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public List<CaseStudy> CaseStudiesSelect()
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        if (lu.IsLoggedIn)
        {
            return CaseStudy.GetList();
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public CaseStudy CaseStudySave(CaseStudy sdi)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
 
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            if (sdi.IdentityValue == 0)
                sdi.DesignAssociateID = lu.User.DesignAssociateID;
 
            sdi.Save();
            return sdi;
        }
        return null;
    }
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public void CaseStudyDelete(CaseStudy sdi)
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
 
        if (lu.User.UserRights == eUserRights.AAA || lu.User.UserRights == eUserRights.Administration)
        {
            sdi.Delete();
        }
    }
 
    #endregion
 
    [WebMethod(EnableSession = true)]
    [ScriptMethod()]
    public DDUser LoggedInUser()
    {
        LoggedInUser<DDUser> lu = new LoggedInUser<DDUser>();
        
        return lu.User;
    }
}

Open in new window

0
Comment
Question by:nickrawlins
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24771448
On line 93 you have an opening parenthesis. Change that into an opening accolade. In other words, change:

else(    return "Access Denide";}
into:

else{    return "Access Denide";  }

These kind of errors are best solved by Ctrl-Z'ing until the error goes away. However, I'm surprised that the offending line was not marked, because when I copied your code, it was.

-- Abel --


0
 
LVL 9

Expert Comment

by:Rahul Goel ITIL
ID: 24771471
replace line 93 ( with {

0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 24772254
Just a side comment
Denide should be Denied.
0
 
LVL 39

Expert Comment

by:abel
ID: 24772294
;-)

indeed it should
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question