Try to call Clients.Caller but it's not working - c#

Hello I am trying to catch messages from database and transfer to caller but when I used Clients.Caller method then it pass me error like
Using a Hub instance not created by the HubPipeline is unsupported
If I am using
var context = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
context.Clients.All.receiver(respose);
then it replying nothing. So please help me to solve out this question.
and I am using below code:
public async Task GetAllMessages(int roomid, int fromuserId, int touserId, int index, int pageSize, int broadcastid = 0)
{
ResponseModel respose = new ResponseModel();
try
{
var model = new MessageDetailModel
{
Index = index,
PageSize = pageSize,
FromUserId = fromuserId,
ToUserId = touserId,
ChatRoomId = roomid,
BroadCastId = broadcastid
};
MesaageModel totalmessages = new MesaageModel();
List<RecentMessage> messages = new List<RecentMessage>();
var usermessages = await _userService.GetAllMessages(model);
messages.AddRange(usermessages);
foreach (var message in messages)
{
model.BroadCastMessageId = model.BroadCastId == 0 ? 0 : message.BroadCastMessageId;
model.ChatRoomMessageId = model.BroadCastId == 0 ? message.ChatRoomMessageId : 0;
List<UserDetail> userofseenby = new List<UserDetail>();
var users = await _userService.GetMessageSeenBy(model);
userofseenby.AddRange(users);
message.SeenBy = userofseenby;
}
//totalmessages.Messages.AddRange(messages);
totalmessages.Messages = messages;
totalmessages.UnseenMessageCount = await _userService.GetUnSeenCount(messages.FirstOrDefault().ChatRoomId, fromuserId);
if (messages.FirstOrDefault().IsBroadCast == true)
totalmessages.Users = (List<UserDetail>)await _userService.GetUsersByBroadCastId(messages.FirstOrDefault().BroadCastId);
else if (messages.FirstOrDefault().IsGroup == true)
totalmessages.Users = (List<UserDetail>)await _userService.GetUsersByChatRoomId((int)messages.FirstOrDefault().ChatRoomId);
respose = ResponseHelper.SuccessResponse("onAllMessagesReceived", totalmessages);
Clients.Caller.receiver(respose); // Error catch here
}
catch (Exception ex)
{
respose.ActionCommand = "onAllMessagesReceived";
respose = ResponseHelper.ErrorResponse(respose.ActionCommand, ex.ToString());
Clients.Caller.receiver(respose);
}
}
And Constructors of class is below :
public ChatHub()
{
_userService = new UserBusinessLogic();
_chatterService = new ChatterBusinessLogic();
}
public ChatHub(IChatterBusinessLogic chatterService, IUserBusinessLogic userService)
{
_chatterService = chatterService;
_userService = userService;
}
And Controller constructor are like this :
public ChatterController()
{
_userService = new UserBusinessLogic();
_chatterService = new ChatterBusinessLogic();
}
public ChatterController(IChatterBusinessLogic chatterService, IUserBusinessLogic userService)
{
_chatterService = chatterService;
_userService = userService;
}

Related

Else is not working in my payment check program C#

There are only 3 situations for result.
1- Paid
2- waiting for payment
3- blocked
(Think like this is a bank program)
So when I run the code, always says true. Never false. I want it work normally. Need help.
[HttpPut(Name = "OdemeYapildiSosyalOdeme")]
public ActionResult<bool> Put(string tckn, int odemeNo)
{
try
{
DbOperations dbOperations = new DbOperations();
var parameters = new List<SqlParameter>();
var param1 = new SqlParameter("TCKN", tckn);
parameters.Add(param1);
var param2 = new SqlParameter("ODEMENO", odemeNo);
parameters.Add(param2);
if (odemeKd == 0)
{
dbOperations.ExecuteNonQuery("ODEME_YAP", parameters);
return Ok(true);
}
else return Ok(false);
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SosyalYardimApi.Operations;
using System.Data.SqlClient;
using System.Data;
namespace SosyalYardimApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SosyalOdemeController : ControllerBase
{
private int odemeKd;
private object sosyalOdemeleri;
public bool Boolean { get; private set; }
[HttpGet(Name = "SorgulaSosyalOdeme ")]
public ActionResult<List<SosyalOdeme>> Get(string tckn)
{
try
{
//Yapılacak: Tckn 11 karakterli mi kontrolü yapılacak değilse dönüş olacak,
//return Ok("TCKN Hatalı");
if (tckn.Length == 11)
{
List<SosyalOdeme> sosyalOdemeleri = new List<SosyalOdeme>();
DbOperations dbOperations = new DbOperations();
var parameters = new List<SqlParameter>();
var param = new SqlParameter("TCKN", tckn);
parameters.Add(param);
DataTable dtSonuc = dbOperations.GetData("MUSTERI_SELECT", parameters);
for (int i = 0; i < dtSonuc.Rows.Count; i++)
{
SosyalOdeme sosyalOdeme = new SosyalOdeme();
sosyalOdeme.OdemeNo = Convert.ToInt32(dtSonuc.Rows[i]["ODEMENO"]);
sosyalOdeme.Tckn = Convert.ToString(dtSonuc.Rows[i]["TCKIMLIKNO"]);
sosyalOdeme.Adi = dtSonuc.Rows[i]["MUSTERIAD"].ToString();
sosyalOdeme.SoyAdi = dtSonuc.Rows[i]["MUSTERISOYAD"].ToString();
sosyalOdeme.OdemeKd = Convert.ToInt32(dtSonuc.Rows[i]["ODEME_KD"]);
sosyalOdeme.OdenecekTtr = Convert.ToDecimal(dtSonuc.Rows[i]["ODENECEK_TTR"]);
if (dtSonuc.Rows[i]["ODEME_TR"] != DBNull.Value)
sosyalOdeme.OdenecekDt = Convert.ToDateTime(dtSonuc.Rows[i]["ODEME_TR"]);
sosyalOdemeleri.Add(sosyalOdeme);
}
return Ok(sosyalOdemeleri);
}
else return Ok("hatalı tckn girdiniz");
}
catch (Exception)
{
throw;
}
}
[HttpPut(Name = "OdemeYapildiSosyalOdeme")]
public ActionResult<bool> Put(string tckn, int odemeNo)
{
try
{
//Yapılacak: Odeme no ve tckn e ait ödemeyi bul
//Ödemenin durum kontrolü yap =0 ise
//eğer kontrolden başarılı geçmez ise false dön işlemi kes
DbOperations dbOperations = new DbOperations();
var parameters = new List<SqlParameter>();
var param1 = new SqlParameter("TCKN", tckn);
parameters.Add(param1);
var param2 = new SqlParameter("ODEMENO", odemeNo);
parameters.Add(param2);
if (odemeKd == 0)
{
dbOperations.ExecuteNonQuery("ODEME_YAP", parameters);
return Ok(true);
}
else return Ok(false);
}
catch (Exception)
{
throw;
}
}
}
}
So that's the whole code for odemeKd.
We have one more big code but there is no definition in the other one.
So i hope you can find the answer of this code.
Thank you so much.

Producer terminating with 1 message (39bytes) still in queue or transit. Kafka

How do I solve this terminating with kafka? I have the following error: https://i.stack.imgur.com/bY2j3.png
Code:
public class KafkaHelper
{
public static async Task<bool> SendMessage(KafkaSettings settings, string topic, string key, string val)
{
var succeed = false;
var config = new ProducerConfig
{
BootstrapServers = settings.Server,
ClientId = Dns.GetHostName(),
};
using (var adminClient = new AdminClientBuilder(config).Build())
{
try
{
await adminClient.CreateTopicsAsync(new List<TopicSpecification> {
new TopicSpecification {
Name = topic,
NumPartitions = settings.NumPartitions,
ReplicationFactor = settings.ReplicationFactor } });
}
catch (CreateTopicsException e)
{
if (e.Results[0].Error.Code != ErrorCode.TopicAlreadyExists)
{
Console.WriteLine($"An error occured creating topic {topic}: {e.Results[0].Error.Reason}");
}
else
{
Console.WriteLine("Topic already exists");
}
}
}
using (var producer = new ProducerBuilder<string, string>(config).Build())
{
producer.Produce(topic, new Message<string, string>
{
Key = key,
Value = val
}, (deliveryReport) =>
{
if (deliveryReport.Error.Code != ErrorCode.NoError)
{
Console.WriteLine($"Failed to deliver message: {deliveryReport.Error.Reason}");
}
else
{
Console.WriteLine($"Produced message to: {deliveryReport.TopicPartitionOffset}");
succeed = true;
}
});
producer.Flush(TimeSpan.FromSeconds(10));
}
return await Task.FromResult(succeed);
}
}

Converting Query Expression into Linq C#

I'm having trouble converting a Query Expression found here: http://www.oak3.org/crm/workflow-activity-checking-duplicate-instances/
into a linq query. To put it simply, the goal is if two workflows get triggered at the same time, only let one go through sorted by most recent. Currently my linq version will sometimes cancel a workflow even if it is the only one running. I know I need to utilize the input parameter somehow (to tell it what workflow to compare to), and I'm sure there could be more issues. Any help is greatly appreciated.
[Input("Current workflow")]
[ReferenceTarget("workflow")]
public InArgument<EntityReference> workflowReferenceInput { get; set; }
[Output("Is first workflow")]
public OutArgument<Boolean> isFirstWorkflow { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
ITracingService tracer = executionContext.GetExtension<ITracingService>();
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
try
{
Entity entity = (Entity)context.InputParameters["Target"];
isFirstWorkflow.Set(executionContext, false);
var wfReference = workflowReferenceInput.Get(executionContext);
var wfEntity = service.Retrieve("workflow", wfReference.Id, new ColumnSet ( "name" ));
ConditionExpression ce1 = new ConditionExpression();
ce1.AttributeName = "statuscode";
ce1.Operator = ConditionOperator.In;
ce1.Values.Add(0);
ce1.Values.Add(10);
ce1.Values.Add(20);
ce1.Values.Add(21);
ce1.Values.Add(22);
FilterExpression fe1 = new FilterExpression();
fe1.Conditions.Add(ce1);
QueryExpression qe = new QueryExpression();
qe.EntityName = AsyncOperation.EntityLogicalName;
qe.ColumnSet = new ColumnSet();
qe.Criteria = new FilterExpression();
qe.Criteria.AddFilter(fe1);
var childFilter = qe.Criteria.AddFilter(LogicalOperator.And);
childFilter.AddCondition("operationtype", ConditionOperator.Equal, 10);
childFilter.AddCondition("name", ConditionOperator.Equal, wfEntity["name"]);
LinkEntity link = new LinkEntity
{
LinkFromEntityName = AsyncOperation.EntityLogicalName,
LinkToEntityName = Quote.EntityLogicalName,
LinkFromAttributeName = "regardingobjectid",
LinkToAttributeName = "quoteid"
};
link.LinkCriteria.AddCondition("quoteid", ConditionOperator.Equal, context.PrimaryEntityId.ToString());
DataCollection<Entity> result = service.RetrieveMultiple(qe).Entities;
var list = result.ToList().OrderBy(c => c.Id);
for (var i = 0; i < list.Count(); i++)
{
var item = list.ElementAt(i);
if(item.Id == context.OperationId && i == 0)
{
isFirstWorkflow.Set(executionContext, true);
}
}
}
catch (Exception e)
{
throw new InvalidPluginExecutionException(e.Message);
}
}
into this:
public class WorkflowChecker: CodeActivity
{
[Input("Current workflow")]
[ReferenceTarget("workflow")]
public InArgument<EntityReference> workflowReferenceInput { get; set; }
[Output("Is first workflow")] public OutArgument<Boolean> isFirstWorkflow { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
try
{
var ok = WorkflowChecker(context.PrimaryEntityId, context.OperationId);
isFirstWorkflow.Set(executionContext, ok);
}
catch (Exception e)
{
throw new InvalidPluginExecutionException(e.Message);
}
}
}
which calls:
public static bool WorkflowChecker(Guid workflowContextId,
Guid asyncOperationId)
{
var someReturnValue = false;
var listOfWorkflowIds = new List<Guid>();
try
{
var query = from async in AsyncOperationSet
join b in BSet on async.RegardingObjectId.Id equals b.Id
where b.Id.Equals(workflowContextId)
&& (async.StateCode.Equals(0)
|| async.StateCode.Equals(1)
|| async.StateCode.Equals(2))
select new {async.AsyncOperationId};
foreach (var x in query)
{
if (x.AsyncOperationId != Guid.Empty)
{
listOfWorkflowIds.Add(x.AsyncOperationId.Value);
}
}
listOfWorkflowIds.Sort();
if (listOfWorkflowIds.First() == asyncOperationId)
{
someReturnValue = true;
}
}
catch (Exception e)
{
Console.WriteLine("Error in Workflow Checker: " + e);
}
return someReturnValue;
}
I've added the following lines to the workflow library then passed the parameter into the call to compare by name and so far it appears to be working successfully:
var wfReference = workflowReferenceInput.Get(executionContext);
var wfEntity = service.Retrieve("workflow", wfReference.Id, new ColumnSet("name"));
var test = wfEntity["name"];

How to make a request asynchronously in c# (xamarin)?

I used to work with browser-based applications. for example Angular simple repository.
function getSomeData(params) {
...
return $http({
url: conf.urlDev + 'some/rest-url',
method: "GET",
params: params,
cache: true
}).then(getDataComplete);
function getDataComplete(response) {
return response.data;
}
}
How it will look the same in c# (XAMARIN for example)?
i try :
public class BaseClient
{
protected Http _client = null;
protected string _urlObj;
protected string _basePath;
public BaseClient ()
{
_client = new Http(new HttpClientHandler());
}
public string Path
{
set
{
_urlObj = value;
}
}
public async Task<Result<IList<T>>>getList<T>(Dictionary<string,object> parametrs = null)
{
if (parametrs != null)
{
foreach(KeyValuePair<string, object> keyValue in parametrs)
{
_urlObj = _urlObj.SetQueryParam(keyValue.Key, keyValue.Value);
}
}
var response = await _client.GetAsync(_urlObj.ToString());
if (response.IsSuccessStatusCode)
{
return new Result<IList<T>>()
{
Success = true,
Value = JsonConvert.DeserializeObject<IList<T>>(await response.Content.ReadAsStringAsync())
};
}
else
{
var error = new Result<IList<T>>()
{
Error = response.StatusCode.ToString(),
Message = response.ReasonPhrase,
Success = false
};
return error;
}
}
in my service:
public async Task<IList<News>> GetAllNewsByParams(DateTime from,
string orderBy = "-published",
DateTime to = new DateTime(),
int page = 1, int category = 0)
{
_client.Path = _config.NewsPath;
var dict = new Dictionary<string, object> {
{"from", from.ToString("s")},
{"order_by", orderBy.ToString()},
{"to", to.ToString("s")},
{"page", page.ToString()}
};
if (category != 0)
{
dict.Add("category", category.ToString());
}
var res = await _client.getList<News>(dict);
return res.Value;
}
and im ny viewmodel
foreach (var item in await _newsService.GetAllNewsByParams(
_To,
_OrderBy,
_From, _Page,
selectedTag == null ? _SeletedNewsTagId : selectedTag.Id))
{
NewsList.Add(item);
}
Is his query executed synchronously ?
How do I make it an asynchronous?
First of all I would really encourage you to use RestSharp, it really simplifies making HTTP requests and deserialise them. Add a RestSharp nuget package to your project. Here is how your code will look like using RestSharp.
public class BaseClient
{
protected IRestClient _client = null;
protected string _urlObj;
protected string _basePath;
public BaseClient()
{
_client = new RestClient();
}
public async Task<Result<IList<T>>> GetList<T>(string path, Dictionary<string, object> parametrs = null)
{
var request = new RestRequest(path, Method.GET);
if (parametrs != null)
{
foreach (var keyValue in parametrs)
{
request.AddQueryParameter(keyValue.Key, keyValue.Value);
}
}
var response = await _client.Execute<List<T>>(request);
if (response.IsSuccess)
{
return new Result<IList<T>>()
{
Success = true,
Value = response.Data
};
}
else
{
var error = new Result<IList<T>>()
{
Error = response.StatusCode.ToString(),
Message = response.StatusDescription,
Success = false
};
return error;
}
}
}
In your service
public async Task<IList<News>> GetAllNewsByParams(DateTime from,
string orderBy = "-published",
DateTime to = new DateTime(),
int page = 1, int category = 0)
{
var dict = new Dictionary<string, object> {
{"from", from.ToString("s")},
{"order_by", orderBy.ToString()},
{"to", to.ToString("s")},
{"page", page.ToString()}
};
if (category != 0)
{
dict.Add("category", category.ToString());
}
var res = await _client.GetList<News>(_config.NewsPath, dict);
return res.Value;
}
And in your viewmodel
var news = await _newsService.GetAllNewsByParams(
_To,
_OrderBy,
_From, _Page,
selectedTag == null ? _SeletedNewsTagId : selectedTag.Id);
foreach (var item in news)
{
NewsList.Add(item);
}
This will be 100% asynchronous.

Send sms using Mbn Api C#

I'm looking for a way to send Sms throught MbnApi using :
http://msdn.microsoft.com/en-us/library/windows/desktop/dd323167(v=vs.85).aspx
IMbnSms interface. But it's not working at all.
I could not have a sample project to see how to do it. I'm coding on C# .Net
Thx
public class NaErrorHandling
{
public Dictionary<UInt32, string> Hresults { get;private set; }
public NaErrorHandling()
{
Hresults = new Dictionary<UInt32, string>();
Init();
}
private void Init()
{
Hresults.Add(0, "S_OK");
Hresults.Add(0x8054820a, "E_MBN_SIM_NOT_INSERTED");
Hresults.Add(0x80070057, "E_INVALIDARG");
Hresults.Add(0x80548202, "E_MBN_BAD_SIM");
Hresults.Add(0x80548210, "E_MBN_PIN_REQUIRED");
Hresults.Add(0x80548224, "E_MBN_SMS_MEMORY_FAILURE");
Hresults.Add(0x80548226, "E_MBN_SMS_UNKNOWN_SMSC_ADDRESS");
Hresults.Add(0x80548209, "E_MBN_SERVICE_NOT_ACTIVATED");
Hresults.Add(0x80548225, "E_MBN_SMS_NETWORK_TIMEOUT");
Hresults.Add(0x8054820d, "E_MBN_NOT_REGISTERED");
Hresults.Add(0x80548223, "E_MBN_SMS_LANG_NOT_SUPPORTED");
Hresults.Add(0x80548220, "E_MBN_SMS_ENCODING_NOT_SUPPORTED");
Hresults.Add(0x80548228, "E_MBN_SMS_OPERATION_NOT_ALLOWED");
Hresults.Add(0x80548229, "E_MBN_SMS_MEMORY_FULL");
Hresults.Add(0X80070015, "ERROR_NOT_READY");
Hresults.Add(1062, "ERROR_SERVICE_NOT_ACTIVE");
}
public string GetError(int error)
{
UInt32 uerror = (UInt32)error;
if (Hresults.ContainsKey(uerror))
return Hresults[uerror];
return "Error Not Know";
}
}
public class SmsResult : MbnApi.IMbnSmsEvents
{
public void OnSetSmsConfigurationComplete(MbnApi.IMbnSms sms, uint requestID, int status)
{
}
public void OnSmsConfigurationChange(MbnApi.IMbnSms sms)
{
}
public void OnSmsDeleteComplete(MbnApi.IMbnSms sms, uint requestID, int status)
{
}
public void OnSmsNewClass0Message(MbnApi.IMbnSms sms, MbnApi.MBN_SMS_FORMAT SmsFormat, object[] readMsgs)
{
}
public void OnSmsReadComplete(MbnApi.IMbnSms sms, MbnApi.MBN_SMS_FORMAT SmsFormat, object[] readMsgs, bool moreMsgs, uint requestID, int status)
{
string messageShow = String.Empty;
SMSPDULib.SMS rms= new SMSPDULib.SMS();
foreach (var msgReceived in readMsgs)
{
var msg = msgReceived as IMbnSmsReadMsgPdu;
messageShow += GetSms(msg.PduData) + "\n";
}
System.Windows.MessageBox.Show( messageShow);
}
private string GetSms(string pduSource)
{
SMSType smsType = SMSBase.GetSMSType(pduSource);
string message = string.Empty;
switch (smsType)
{
case SMSType.SMS:
SMS sms = new SMS();
SMS.Fetch(sms, ref pduSource);
message = sms.Message;
//Use instance of SMS class here
break;
case SMSType.StatusReport:
SMSStatusReport statusReport = new SMSStatusReport();
SMSStatusReport.Fetch(statusReport, ref pduSource);
//Use instance of SMSStatusReport class here
break;
}
return message;
}
public void OnSmsSendComplete(MbnApi.IMbnSms sms, uint requestID, int status)
{
NaErrorHandling handling = new NaErrorHandling();
var res = handling.GetError(status);
UInt32 uStatus = (UInt32)status;
}
public void OnSmsStatusChange(MbnApi.IMbnSms sms)
{
throw new NotImplementedException();
}
}
public void SendSms()
{
MbnConnectionManager mbnConnectionMgr = new MbnConnectionManager();
IMbnConnectionManager connMgr = (IMbnConnectionManager)mbnConnectionMgr;
try
{
IMbnConnection[] arrConn = connMgr.GetConnections();
if (arrConn != null)
{
String res = String.Empty;
foreach (var connection in arrConn)
{
res += String.Format("Connection ID : {0} | Interface Id : {1}\n", connection.ConnectionID, connection.InterfaceID);
}
//MessageBox.Show(res);
var conn = arrConn[0];
uint prId = 0;
//conn.Connect(MBN_CONNECTION_MODE.MBN_CONNECTION_MODE_PROFILE, "Bouygues Telecom", out prId);
MbnInterfaceManager mbnInterfaceMgr = new MbnInterfaceManager();
var mbnInterface = mbnInterfaceMgr as IMbnInterfaceManager;
var selectInterface = mbnInterface.GetInterface(conn.InterfaceID);
MBN_INTERFACE_CAPS caps = selectInterface.GetInterfaceCapability();
var theCap =caps.smsCaps;// (uint)MBN_SMS_CAPS.MBN_SMS_CAPS_PDU_SEND;
IConnectionPointContainer icpc;
icpc = (IConnectionPointContainer)mbnInterfaceMgr;
Guid IID_IMbnConnectionEvents = typeof(IMbnSmsEvents).GUID;
IConnectionPoint icp;
icpc.FindConnectionPoint(ref IID_IMbnConnectionEvents, out icp);
SmsResult connEvtsSink = new SmsResult();
uint cookie;
icp.Advise(connEvtsSink, out cookie);
var sms = selectInterface as IMbnSms;
string phoneDest = "";
string pdu = String.Empty;
byte[] size = new byte[5];
uint requestId = 456;
MBN_SMS_STATUS_INFO smsStatusInfo = new MBN_SMS_STATUS_INFO();
smsStatusInfo.flag = 10;
try
{
IMbnSmsConfiguration smsConfig = sms.GetSmsConfiguration();
sms.GetSmsStatus(out smsStatusInfo);
var wtf = smsStatusInfo;
string serviceDatacenter = smsConfig.ServiceCenterAddress;
CreatePduSms(null, phoneDest, "Hello", out pdu, out size);
//var res1 = SMSPDULib.SMS.GetBytes(pdu, 16);
var total = SMSPDULib.SMS.GetBytes(pdu);
byte wantedSize =(byte) total.Length;
CreatePduSms(serviceDatacenter, phoneDest, "Hello", out pdu, out size);
//var byteArray = StringToByteArray(pdu);
//var str = System.Text.Encoding.UTF7.GetString(byteArray);
sms.SmsSendPdu(pdu, wantedSize, out requestId);
//sms.SmsSendCdma(phoneDest, MBN_SMS_CDMA_ENCODING.MBN_SMS_CDMA_ENCODING_7BIT_ASCII, MBN_SMS_CDMA_LANG.MBN_SMS_CDMA_LANG_FRENCH, 2, GetBytes("Hi"), out requestId);
}
catch (Exception exp)
{
//MessageBox.Show("Cannot send Message : " + exp.Message);
}
}
}
catch (Exception e)
{
//MessageBox.Show(e.Message + e.StackTrace);
}
}
private void CreatePduSms(string servAddress, string phoneDest, string msg, out string pdu, out byte[] size)
{
SMSPDULib.SMS sms = new SMSPDULib.SMS();
sms.Direction = SMSPDULib.SMSDirection.Submited;
sms.PhoneNumber = "";
if (servAddress != null)
sms.ServiceCenterNumber = servAddress;
sms.ValidityPeriod = new TimeSpan(4, 0, 0, 0);
sms.Message = msg + DateTime.Now.ToString();
pdu = sms.Compose(SMSPDULib.SMS.SMSEncoding._7bit);
size = 0;
}

Categories

Resources