Beispiel #1
0
        private void btnAuthentication_Click(object sender, EventArgs e)
        {
            btnAuthentication.Enabled = false;
            btnAuthentication.Text = "منتطر باشید";

            try
            {
                SmsSender smsSender = new SmsSender();
                smsSender.AuthenticateCompleted += new SmsSender.AuthenticateCompletedEventHandler(smsSender_AuthenticateCompleted);
                smsSender.AuthenticateAsync(txtUserName.Text,txtPassword.Text,0);
            }
            catch (Exception exp)
            {
                Logger.Log(exp, "");
                if (exp.Message == "2")
                    Methods.ShowStandardMsgBox(FormMessageType.Error,"خطا","اتصال اینترنت برقرار نیست.");
            }
        }
Beispiel #2
0
        public SendSmsReminder()
        {
            this.FormClosed += (x, y) =>
            {
                file.WriteLine("5");
                DataLayer.EndTransaction();
                file.Close();
            };
            file.AutoFlush = true;
            file.WriteLine("1");
            DataLayer.BeginTransaction();
            smsSender = new SmsSender();
            smsSender.SendCompleted += new SmsSender.SendCompletedEventHandler(smsSender_SendCompleted);
            file.WriteLine("2");
            try
            {
                //get the reminder enable bool if it is true
                SystemSettings setting = DataLayer.GetSystemSettings();
                if (setting != null && setting.SendReminder)
                {
                    Visit[] visits = DataLayer.GetVisits(true).Where(x => x.ReminderStatus == (int)SmsStatus.WaitingForSent && (x.FromTime - DateTime.Now).TotalDays <= setting.ReminderDay && (x.FromTime - DateTime.Now).TotalHours > 0 && !string.IsNullOrEmpty(x.Patient.CellNumber)).ToArray();
                    foreach (Visit vis in visits)
                    {
                        proccessingVisit = vis;
                        smsSender.Say(string.Format(setting.ReminderText, vis.Patient.ToString(), vis.PersianDate, vis.FromTime.TimeOfDay)).To(vis.Patient.CellNumber).SendAsync(setting.SmsUsername, setting.SmsPassword, 0);
                        while (!afterSend) ;
                        afterSend = !afterSend;
                    }
                    if (visits.Count() != 0)
                    {
                        DataLayer.Save();
                    }
                    Close();
                }
            }
            catch (Exception e)
            {
                file.WriteLine(e.Message);
            }


        }
Beispiel #3
0
        private void initialForm()
        {
            DataLayer.BeginTransaction();
            InitializeComponent();

            Methods.SetWindowsIcon(this);

            SetIcons();
            Patient[] p = DataLayer.GetPatients(true);
            grdList.DataSource = p.Where(x => !string.IsNullOrWhiteSpace(x.CellNumber)).ToArray();

            mode = Lang.farsi;

            SystemSettings s = DataLayer.GetSystemSettings();
            userName = s.SmsUsername;
            password = s.SmsPassword;

            smsSender = new SmsSender();
            smsSender.GetSettingsAsync(s.SmsUsername, s.SmsPassword, 0);
            smsSender.GetSettingsCompleted += new SmsSender.GetSettingsCompletedEventHandler(smsSender_GetSettingsCompleted);
            btnSend.Enabled = false;
        }