Exemple #1
0
 internal SMSLogsBLL MapSMSLog(SMSLogs SMSLog)
 {
     try
     {
         SMSLogsBLL SMSLogBLL = null;
         if (SMSLog != null)
         {
             SMSLogBLL = new SMSLogsBLL()
             {
                 SMSLogID           = SMSLog.SMSLogID,
                 BusinssSubCategory = (BusinessSubCategoriesEnum)SMSLog.BusinssSubCategoryID,
                 DetailID           = DetailID,
                 Message            = Message,
                 MobileNo           = MobileNo,
                 CreatedDate        = CreatedDate,
                 CreatedBy          = CreatedBy
             };
         }
         return(SMSLogBLL);
     }
     catch
     {
         throw;
     }
 }
Exemple #2
0
        public bool SendSMS(string[] CellNumbers, string Message)
        {
            SMSLogs objSMSLog      = new SMSLogs(CookiesWrapper.thisConnectionName, CookiesWrapper.thisUserID);
            string  request_result = SendSMS(CellNumbers, Message, Properties.Settings.Default.SMS_Sender);
            long    count          = 0;

            foreach (string cell in CellNumbers)
            {
                objSMSLog.SMSLogID        = 0;
                objSMSLog.SenderID        = CookiesWrapper.thisUserID;
                objSMSLog.ReceiverAddress = cell;
                objSMSLog.SMSMessage      = Message;
                objSMSLog.SMSRequestID    = request_result;
                objSMSLog.Status          = request_result != "" ? "Sent" : "Pending";
                objSMSLog.DeliveryStatus  = "Pending";
                objSMSLog.TimeSent        = DateTime.Now.ToString();

                if (objSMSLog.Save())
                {
                    count++;
                }
            }

            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public JsonResult Get(int pageIndex, int pageSize, string pageOrder, string to)
        {
            if (pageOrder.Trim() == "ID")
            {
                pageOrder = "LastUpdate desc";
            }

            var list = SMSLogs.Get(pageIndex,
                                   pageSize,
                                   pageOrder,
                                   to);

            int total     = SMSLogs.Count(to);
            int totalPage = (int)Math.Ceiling((decimal)total / pageSize);

            if (pageSize > total)
            {
                pageSize = total;
            }

            if (list.Count < pageSize)
            {
                pageSize = list.Count;
            }

            JsonResult result = new JsonResult()
            {
                Data = new
                {
                    TotalPages = totalPage,
                    PageIndex  = pageIndex,
                    PageSize   = pageSize,
                    Rows       = list
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };

            return(result);
        }
Exemple #4
0
        public virtual int Add()
        {
            try
            {
                SMSLogsDAL SMSLogDal = new SMSLogsDAL();
                SMSLogs    SMSLog    = new SMSLogs()
                {
                    Message              = this.Message,
                    MobileNo             = this.MobileNo,
                    BusinssSubCategoryID = (int)this.BusinssSubCategory,
                    DetailID             = this.DetailID,
                    CreatedBy            = this.CreatedBy.EmployeeCodeID,
                    CreatedDate          = DateTime.Now
                };
                SMSLogDal.Insert(SMSLog);

                return(this.SMSLogID);
            }
            catch
            {
                throw;
            }
        }