Solved

C# Error - URGENT!!

Posted on 2009-07-03
4
453 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now