Ejemplo n.º 1
0
        void RequestToDB_NeedAddPattern()
        {
            if (!setting.HT_ThongTinBN)
            {
                return;
            }

            try
            {
                List <HT_ThongTinNguoiHienTinh> ttnhts = bnhtDB.GetAllNguoiHienTinh();
                foreach (var ttnh in ttnhts)
                {
                    bool allowAddPattern = bnhtDB.AllowAddPattern(ttnh.MaBN);

                    if (oldValue != allowAddPattern)
                    {
                        if (allowAddPattern)
                        {
                            ttnh.FlagAllowAddPattern = true;
                            oldValue = true;
                        }
                        else
                        {
                            ttnh.FlagAllowAddPattern = false;
                            oldValue = false;
                        }
                        var message = new MailMessage(smtpSetting.MailAddressSend, smtpSetting.MailAddressReceive, Utilities.Header_HT_ThongTinNguoiHien, ttnh.CreateFileDataXML().ToString());
                        mailClient.Send(message);
                        bnhtDB.ResetInforSync_ThongTinBN(ttnh.MaBN);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }