How to pass string value from Public Class to public partial class in C#

Last Reply on Aug 02, 2012 05:13 AM By Mudassar

Posted on Aug 02, 2012 03:44 AM
Hi,
I am having one Method like below in public class,I just need to retrieve one string value(res[0])in another public partial class(page class).
Any help could be greatly Thankful.

public SMSResultStatusEnum SendSMS(StringBuilder mobilenumber, string message, string Language) { string Unicode; string SMSUsername = AppSettingsManager.Instance.SMSUsername; string SMSPassword = AppSettingsManager.Instance.SMSPassword; string SMSSenderID = AppSettingsManager.Instance.SMSSenderID; string correctedmobilenumber = CorrectMobileNumber(mobilenumber); ///@todo: REMOVE THIS IN PRODUCTION! //return // SMSResultStatus.SUCCESSFUL; if (Language.ToLower() == "english") { Unicode = "E"; } else { Unicode = "U"; message = ToHexString(message); } //Uri uri = new Uri("http://59.162.167.52/api/MessageCompose?admin=imran@instareach.com&user=" + SMSUsername + ":" + SMSPassword + "&senderID=" + SMSSenderID + "&receipientno=" + correctedmobilenumber + "&msgtxt=" + message + "&state=4"); Uri uri = new Uri("http://183.81.161.84:13016/cgi-bin/sendsms?username=" + SMSUsername + "&password=" + SMSPassword + "&to=" + correctedmobilenumber + "&from=" + SMSSenderID + "&text=" + message); try { HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(uri); HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse()); StreamReader reader = new StreamReader(httpResponse.GetResponseStream()); string tmp = reader.ReadToEnd(); string[] res = tmp.Split('&'); //string Result = tmp.Substring(0, 8) + "".ToString(); httpResponse.Close(); //SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.Successfull; if (res[0] == "status=0") { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.Successfull; return statusCode; } else if (res[0] == "status=1") { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.AuthorisationFailed; return statusCode; } else if (res[0] == "status=28") { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.InvalidDestinationNumber; return statusCode; } else { SMSResultStatusEnum statusCode = (SMSResultStatusEnum)SMSResultStatusEnum.OtherProblems; return statusCode; } //return statusCode; } catch { return SMSResultStatusEnum.OtherProblems; } }

 

Posted on Aug 02, 2012 03:44 AM

In your class create a Public method and then call it in your Partial class

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html