Solved

C# Error - URGENT!!

Posted on 2009-07-03
4
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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