This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How can i call void,string function in server side

gkhn.topcu - Wednesday, December 21, 2011 10:03 AM:

Hi,

i can't call void or string function in c# Method .Can i miss something?Here is my code look like;

//---------------------------

string ToIdentityName = "User";

string Subject = "Subject";

string Body =getUser();

string htmlBody = "";

string fromUserName = "Admin";

CCO.Email.SendEmailToIdentityEx(ref ToIdentityName, ref Subject, ref Body, ref htmlBody, ref fromUserName);

return.this;

public string getUser()

{

return "foo";

}

//-------------------------------

---And Exception:---

Details in 7 temporary files C:Program Files (x86)ArasInnovatorInnovatorServerdll6wnwry0u Line number -26, Error Number: CS1513, } expected Line number -26, Error Number: CS1022, Type or namespace definition, or end-of-file expected Details in 7 temporary files C:Program Files (x86)ArasInnovatorInnovatorServerdll6wnwry0u Line number -26, Error Number: CS1513, } expected Line number -26, Error Number: CS1022, Type or namespace definition, or end-of-file expected System.ApplicationException exception during initialization ApplyItem in IOM



gkhn.topcu - Thursday, December 22, 2011 4:39 AM:

i found solutions:)

  myCCO = CCO;

return main();

}

 

private Aras.Server.Core.CallContext myCCO;

 

private string getUser()

{

  string res = "YEAP";

 

 

  return res;

}

private Item main()

{

 

    string ToIdentityName = "Mark Nerbangt";

string Subject = "Subject";

string Body =getUser();

string htmlBody = "<i>Csharp e-posta denemesi metni</i>";

string fromUserName = "daf";

myCCO.Email.SendEmailToIdentityEx(ref ToIdentityName, ref Subject, ref Body, ref htmlBody, ref fromUserName);

  return this;



graybeardtx - Friday, December 23, 2011 11:16 AM:

I'm getting a similar message - not sure I understand your solution. Maybe you can identify ny problem?

I'm trying to create a method in C# that will execute an external program. I have used a simple program shown below: It works from inside of  VS but I get the following error when I do a syntax check:

ERROR: D231C351DE324C52BFF680E3E78A9375. Line number -39, Error Number: CS1513,
 } expected Line number -39, Error Number: CS1022, Type or namespace definition, or end-of-file expected 

Program:

using System;

using System.Diagnostics;

using System.ComponentModel;

     class HelloWorld

    {

        static void Main()

        {

            Process.Start("C:\temp\ArasSample.exe");

        }

    }



gkhn.topcu - Monday, December 26, 2011 10:21 AM:

 

i didn't try with  adding library (using System.xx.) .I'm not sure but i think server methods are parts of solution.So You must close your tag at first and return main

 

return main();

}

 

private Item main()

{

 

//your code

}

This solved my problem, I hope this will help u.

 



justinlee - Monday, December 26, 2011 10:58 PM:

Hi John and gkhn,

I think your Main function doesn't  use close tag "}" .

cmdMain();

return (e.i);

}

Innovator Inno;

private void cmdMain()

{

Inno = this.Innovator

// Some code

This is architect a C# menthod i use.

 

P/s:Sorry my English

Lee