Ejemplo n.º 1
0
        private bool SendServiceStetusSms(string msg)
        {
            if (this.AttendanceConfig.is_enable_sms_service)
            {
                BasecampSMSSender smssender = new BasecampSMSSender("*****@*****.**", "abc987");

                string res = smssender.SendSms(AdminPhoneNo, msg);
                logger.Info($"SMS Notification {Environment.NewLine} {msg} {Environment.NewLine}Status: {res} {Environment.NewLine}");

                return(res.Contains("200"));
            }

            return(false);
        }
Ejemplo n.º 2
0
        private bool SendSms(SmsType smsType, Student student, DateTime dateTimeRecord)
        {
            if (this.AttendanceConfig.is_enable_sms_service)
            {
                string            smsContent = this.PrepareSmsContent(smsType, student, dateTimeRecord);
                BasecampSMSSender smssender  = new BasecampSMSSender("*****@*****.**", "abc987");

                string res = smssender.SendSms(student.guardian_phone, smsContent);
                logger.Info($"SMS - {student.guardian_name} {student.guardian_phone} {Environment.NewLine}{smsContent} {Environment.NewLine}Status: {res}{Environment.NewLine}");

                return(res.Contains("200"));
            }

            return(false);
        }
Ejemplo n.º 3
0
        private void SendDailyServiceCheckSMS()
        {
            try
            {
                if (DateTime.Now.Hour == 7 && DailyServiceCheckSMSDate < DateTime.Now)
                {
                    this.IsBusy = true;

                    if (this.AttendanceConfig.is_enable_sms_service)
                    {
                        string smsContent = "Attendance service running...";

                        using (ZkTecoClient bioMatrixClient = new ZkTecoClient("basecampzkteco.ddns.net"))
                        {
                            try
                            {
                                bool isConnected = bioMatrixClient.ConnectToZKTeco();
                                if (!isConnected)
                                {
                                    smsContent = "Failed to connect to the biometric device";
                                }
                            }
                            catch (Exception ex)
                            {
                                smsContent = "Failed to connect to the biometric device";
                                logger.Error(ex.Message, ex);
                            }
                        }

                        BasecampSMSSender smssender = new BasecampSMSSender("*****@*****.**", "abc987");

                        string res = smssender.SendSms("8801714042726", smsContent);
                        logger.Info($"SMS- {smsContent} {Environment.NewLine}Status: {res}");

                        DailyServiceCheckSMSDate = DateTime.Now;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message, ex);
            }
            finally
            {
                this.IsBusy = false;
            }
        }