示例#1
0
        /// <summary>
        /// تایید یا عدم تایید درخواستها را ارسال میکند
        /// </summary>
        public void SendRequestSmss(IList <InfoServiceProxy> readyForSendSms)
        {
            try
            {
                IRegisteredRequests bus     = new BKartabl();
                List <decimal>      itemIds = new List <decimal>();
                foreach (InfoServiceProxy proxy in readyForSendSms)
                {
                    try
                    {
                        IList <ContractKartablProxy> confirrmedList    = bus.GetAllUserRequests(RequestState.Confirmed, DateTime.Now, DateTime.Now, proxy.PersonId);
                        IList <ContractKartablProxy> notConfirrmedList = bus.GetAllUserRequests(RequestState.Unconfirmed, DateTime.Now, DateTime.Now, proxy.PersonId);
                        IList <decimal> confirmedids    = new List <decimal>();
                        IList <decimal> notConfirmedids = new List <decimal>();

                        if (confirrmedList.Count > 0)
                        {
                            var list = from o in confirrmedList
                                       select o.ID;
                            confirmedids = list.ToList <decimal>();
                            confirmedids = this.GetNewNotifications(NotificationsServices.SmsRequestStatus, confirmedids);
                            if (confirmedids.Count > 0)
                            {
                                string message = this.BuildConfirmedRequestSmsString(confirmedids, proxy);
                                string subject = String.Format("گزارش وضعیت درخواستها در ساعت {0}:{1} - مخصوص کاربران", DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes);
                                SmsUtility.SendSMS(proxy.SmsNumber, message);
                                itemIds.AddRange(confirmedids);
                                logger.Info(String.Format("SMS webservice : person {0} had Sent confirmed request sms {1} - {2}", proxy.PersonName, Utility.ToPersianDate(DateTime.Now), DateTime.Now.TimeOfDay));
                            }
                        }
                        if (notConfirrmedList.Count > 0)
                        {
                            var list = from o in notConfirrmedList
                                       select o.ID;
                            notConfirmedids = list.ToList <decimal>();
                            notConfirmedids = this.GetNewNotifications(NotificationsServices.SmsRequestStatus, confirmedids);
                            if (notConfirmedids.Count > 0)
                            {
                                string message = this.BuildUnConfirmedRequestSmsString(notConfirmedids, proxy);
                                string subject = String.Format("گزارش وضعیت درخواستها در ساعت {0}:{1} - مخصوص کاربران", DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes);
                                SmsUtility.SendSMS(proxy.SmsNumber, message);
                                itemIds.AddRange(notConfirmedids);
                                logger.Info(String.Format("SMS webservice : person {0} had Sent not confirmed request sms {1} - {2}", proxy.PersonName, Utility.ToPersianDate(DateTime.Now), DateTime.Now.TimeOfDay));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(proxy.PersonCode, " SmsWebService :SendRequestSmss ->" + ex.Message, ex);
                        logger.Flush();
                    }
                }
                historyRep.InsertHistory(NotificationsServices.SmsRequestStatus, DateTime.Now.Date, itemIds);
            }
            catch (Exception ex)
            {
                logger.Error("", " SmsWebService : SendRequestSmss ->" + ex.Message, ex);
                logger.Flush();
            }
        }
示例#2
0
        protected void Button31_Click(object sender, EventArgs e)
        {
            IRegisteredRequests bus = new BKartabl();

            bus.GetAllByPage(0, 10, 1391, 10, "");
            IList <ContractKartablProxy> confirrmedList    = bus.GetAllUserRequests(RequestState.Confirmed, DateTime.Now, DateTime.Now, 32682);
            IList <ContractKartablProxy> notConfirrmedList = bus.GetAllUserRequests(RequestState.Unconfirmed, DateTime.Now, DateTime.Now, 32682);
        }
示例#3
0
        /// <summary>
        /// درخواستها را برمیگرداند
        /// </summary>
        /// <param name="clientUsername"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        public IList <ContractKartablProxy> GetClientRequests(string clientUsername, DateTime fromDate, DateTime toDate)
        {
            BUser   busUser = new BUser();
            decimal prsId   = busUser.GetPersonIdByUsername(clientUsername);

            IRegisteredRequests          kartabl = new BKartabl();
            IList <ContractKartablProxy> list    = new List <ContractKartablProxy>();

            if (prsId > 0 && fromDate > Utility.GTSMinStandardDateTime && toDate > Utility.GTSMinStandardDateTime)
            {
                list = kartabl.GetAllUserRequests(RequestState.UnKnown, fromDate, toDate, prsId);
            }
            else if (prsId <= 0)
            {
                throw new Exception("نام کاربری یافت نشد");
            }
            else
            {
                throw new Exception("فرمت تاریخ نادرست است");
            }
            return(list);
        }