Beispiel #1
0
 public static void InsertLogInfo(Log log)
 {
     try
     {
         ManageQueue.SendMessage("log", log, string.Format("{0}-{1}", log.Source, log.Name));
     }
     catch { }
 }
Beispiel #2
0
        public static string InsertLog(int type, string source, string name, string text, string ip, string browser, Guid referenceGuid, Guid userGuid)
        {
            try
            {
                Log log = new Log();

                log.Type          = type;
                log.Source        = source;
                log.Name          = name;
                log.Text          = text;
                log.IPAddress     = ip;
                log.Browser       = browser;
                log.ReferenceGuid = referenceGuid;
                log.UserGuid      = userGuid;
                log.CreateDate    = DateTime.Now;

                return(ManageQueue.SendMessage("log", log, string.Format("{0}-{1}", source, name)));
            }
            catch (Exception ex)
            {
                return(string.Format("Message:{0},StackTrace:{1}", ex.Message, ex.StackTrace));
            }
        }
Beispiel #3
0
        public static string SendSms(string queue, int isRemoteQueue, string remoteQueueIP, int smsSendType,
                                     int pageNo, string sender, Guid privateNumberGuid, int totalCount, string receivers,
                                     string serviceID, string message, int smsLen, int tryCount,
                                     long smsIdentifier, int smsPartIndex, int isFlash,
                                     int isUnicode, string id, string guid, string username,
                                     string password, string domain, string sendLink, string receiveLink,
                                     string deliveryLink, int agentReference)
        {
            try
            {
                string        messageId = Guid.Empty.ToString();
                InProgressSms inProgressSms;

                BatchMessage batch = new BatchMessage();
                batch.CheckId           = random.Next().ToString();
                batch.QueueName         = queue;
                batch.SmsSendType       = smsSendType;
                batch.SenderNumber      = sender;
                batch.PrivateNumberGuid = privateNumberGuid;
                batch.ServiceId         = serviceID;
                batch.SmsText           = message;
                batch.SmsLen            = smsLen;
                batch.MaximumTryCount   = tryCount;
                batch.SmsIdentifier     = smsIdentifier;
                batch.SmsPartIndex      = smsPartIndex;
                batch.IsFlash           = isFlash == 1 ? true : false;
                batch.IsUnicode         = isUnicode == 1 ? true : false;
                batch.Id                      = long.Parse(id);
                batch.Guid                    = Guid.Parse(guid);
                batch.Username                = username;
                batch.Password                = password;
                batch.Domain                  = domain;
                batch.SendLink                = sendLink;
                batch.ReceiveLink             = receiveLink;
                batch.DeliveryLink            = deliveryLink;
                batch.SmsSenderAgentReference = agentReference;
                batch.PageNo                  = pageNo;
                batch.TotalCount              = totalCount;

                DataSet dtsReceivers = new DataSet();
                dtsReceivers.ReadXml(new StringReader(receivers));

                List <InProgressSms> lstInProgressSms = new List <InProgressSms>();
                foreach (DataRow row in dtsReceivers.Tables[0].Rows)
                {
                    inProgressSms = new InProgressSms();

                    inProgressSms.SendTryCount    = 0;
                    inProgressSms.RecipientNumber = row["Mobile"].ToString();
                    inProgressSms.OperatorType    = int.Parse(row["Operator"].ToString());
                    inProgressSms.IsBlackList     = int.Parse(row["IsBlackList"].ToString());
                    inProgressSms.SendStatus      = 2;               //WatingForSend
                    inProgressSms.DeliveryStatus  = 12;              //IsSending
                    inProgressSms.ReturnID        = string.Empty;
                    inProgressSms.CheckID         = random.Next().ToString();
                    inProgressSms.SaveToDatabase  = false;

                    lstInProgressSms.Add(inProgressSms);
                }

                batch.Receivers = lstInProgressSms.ToList();

                if (isRemoteQueue == 0)
                {
                    messageId = ManageQueue.SendMessage(queue, batch, string.Format("{0}-{1}", id, pageNo));
                }
                else if (isRemoteQueue == 1)
                {
                    messageId = ManageQueue.SendMessage(queue, remoteQueueIP, batch, string.Format("{0}-{1}", id, pageNo));
                }

                return(messageId.Split('\\')[1]);
            }
            catch (Exception ex)
            {
                return(string.Format("Message:{0},StackTrace:{1}", ex.Message, ex.StackTrace));
            }
        }