C# Error - URGENT!!

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

LVL 1
nickrawlinsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

abelCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rahul Goel ITILSenior Consultant - DeloitteCommented:
replace line 93 ( with {

0
Jaime OlivaresSoftware ArchitectCommented:
Just a side comment
Denide should be Denied.
0
abelCommented:
;-)

indeed it should
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.