Пример #1
0
        protected static void SendSms()
        {
            SmsBrandnameSoapClient smsClient = new SmsBrandnameSoapClient();

            foreach (var agency in DepartmentServices.GetList().Where(ag => !string.IsNullOrEmpty(ag.PhoneNumber?.Trim())))
            {
                var    soLieu     = RequestServices.LaySoLieuThongKe(MaDonVi: agency.DepartmentID);
                string smsContent = $"[YKCD] {agency.DepartmentName.ToUnsign()} co : {soLieu.NotPerform} ykcd chua thuc hien ({soLieu.NotPerformOutTerm} qua han); {soLieu.Performing} ykcd dang thuc hien ({soLieu.PerformingOutTerm} qua han).";

                foreach (var phoneNumber in agency.PhoneNumber.Split(';'))
                {
                    if (!string.IsNullOrEmpty(phoneNumber))
                    {
                        smsClient.GuiMotNoiDungNhieuSo(string.Empty, phoneNumber, smsContent, "ubnd_pdien", "Pd@3552374", 43);

                        SmsServices.Create(new Sms
                        {
                            ReceiverNumber = phoneNumber,
                            SmsContent     = smsContent,
                            SendTime       = DateTime.Now
                        });
                    }
                }
            }
        }
Пример #2
0
        protected static void SendSms()
        {
            SmsBrandnameSoapClient smsClient = new SmsBrandnameSoapClient();

            foreach (var agency in DepartmentServices.GetList().Where(ag => !string.IsNullOrEmpty(ag.PhoneNumber?.Trim())))
            {
                var dsYkcd = RequestServices.GetList(MaDonViThucHien: agency.DepartmentID, TrangThai: TrangThai.ChuaThucHien).Where(item => item.RequiredDate.AddDays(-2) >= DateTime.Now.Date);

                foreach (var ykcd in dsYkcd)
                {
                    string smsContent = $"[YKCD] {agency.DepartmentName.ToUnsign()} co van ban so {ykcd.DocumentCode} chua bao cao. Thoi han: {ykcd.RequiredDate.ToDateString()}.";

                    foreach (var phoneNumber in agency.PhoneNumber.Split(';'))
                    {
                        if (!string.IsNullOrEmpty(phoneNumber))
                        {
                            smsClient.GuiMotNoiDungNhieuSo(string.Empty, phoneNumber, smsContent, "syt_tthue", "u2AuWJ7ZNNTR8ge2v7b4CQ", 18);

                            SmsServices.Create(new Sms
                            {
                                ReceiverNumber = phoneNumber,
                                SmsContent     = smsContent,
                                SendTime       = DateTime.Now
                            });
                        }
                    }
                }

                dsYkcd = RequestServices.GetList(MaDonViThucHien: agency.DepartmentID, TrangThai: TrangThai.DangThucHien).Where(item => item.RequiredDate.AddDays(-2) >= DateTime.Now.Date);

                foreach (var ykcd in dsYkcd)
                {
                    string smsContent = $"[YKCD] {agency.DepartmentName.ToUnsign()} co van ban so {ykcd.DocumentCode} chua bao cao. Thoi han: {ykcd.RequiredDate.ToDateString()}.";

                    foreach (var phoneNumber in agency.PhoneNumber.Split(';'))
                    {
                        if (!string.IsNullOrEmpty(phoneNumber))
                        {
                            smsClient.GuiMotNoiDungNhieuSo(string.Empty, phoneNumber, smsContent, "syt_tthue", "u2AuWJ7ZNNTR8ge2v7b4CQ", 18);

                            SmsServices.Create(new Sms
                            {
                                ReceiverNumber = phoneNumber,
                                SmsContent     = smsContent,
                                SendTime       = DateTime.Now
                            });
                        }
                    }
                }
            }
        }