Ejemplo n.º 1
0
        protected void TouchpadEnter_Click(object sender, EventArgs e)
        {
            //Checks
            if (tbTramNumber.Text == "Geef een tramnummer in." || tbTramNumber.Text.Length < 1) return;
            int tramnumber = Convert.ToInt32(Regex.Replace(tbTramNumber.Text, @"\s+", ""));
            int tramid = TramLogic.GetIdFromTram(tramnumber);
            if (tramid == 0)
            {
                MessageBox.Show("Tramnummer niet gevonden");
                tbTramNumber.Text = "";
                return;
            }

            bool alreadyExists = TramLogic.CheckIfExists(tramid);
            if (alreadyExists)
            {
                MessageBox.Show("Tram staat al op een sector");
                tbTramNumber.Text = "";
                return;
            }

            string maintenance = "";
            if (CheckDamaged.Checked && CheckDirty.Checked)
            {
                maintenance = "Beide";
            }
            else if (CheckDirty.Checked)
            {
                maintenance = "Schoonmaak";
            }
            else if (CheckDamaged.Checked)
            {
                maintenance = "Techniek";
            }

            int spoor = TramLogic.CheckReserved(tramid);
            int[] position = _tramLogic.FindFreePlace(spoor, maintenance, tramid);
            if (position == null)
            {
                MessageBox.Show("Er is op dit moment geen plek beschikbaar");
                tbTramNumber.Text = "";
                return;
            }
            int railNumber = TramLogic.GetNumberFromRail(position[0]);
            TramLogic.AddTrainToSector(tramid, position[0], position[1]);
            TramLogic.AddTramToMaintenance(tramid, maintenance);
            MessageBox.Show($"Spoor: {railNumber}, Sector: {position[1]}");
            TouchpadClear_Click(null, null);
            if (maintenance != "")
            {
                Mailing mail = new Mailing();
                mail.mail("*****@*****.**","er is een trein die een "+maintenance+" beurt nodig heeft.",maintenance);
            }
        }
Ejemplo n.º 2
0
        //Событие кнопки "ОК"
        private void button_Click_OK(object sender, RoutedEventArgs e)
        {
            Operation    operation        = null;
            Mailing      mailing          = null;
            Subscription subscription     = null;
            string       senderAddress    = null;
            string       recipientAddress = null;
            float        weight;
            DateTime     dateOperation;
            decimal      price;

            using (MailContext context = new MailContext())
            {
                Mail mail = new Mail();

                if (currentMW == ModeWindow.Update)
                {
                    mail = context.Mail.FirstOrDefault(c => c.mail_Id == updateMail.mail_Id);
                }

                if (IOUMainTable_ComboBox_id_Operation.SelectedIndex < 0)
                {
                    MessageBox.Show("Ошибка (Операциция не выбрана)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                int operationId = operationsArr[IOUMainTable_ComboBox_id_Operation.SelectedIndex].operation_Id;
                operation = context.Operations.FirstOrDefault <Operation>(c => c.operation_Id == operationId);
                if (operation == null)
                {
                    MessageBox.Show("Ошибка (Операциция не найдена! Попробуйте выбрать заново)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    SetData();
                    return;
                }

                if (IOUMainTable_ComboBox_id_Mailing.SelectedIndex < 0)
                {
                    MessageBox.Show("Ошибка (Тип не выбран)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                int mailingId = mailingsArr[IOUMainTable_ComboBox_id_Mailing.SelectedIndex].mailing_Id;
                mailing = context.Mailings.FirstOrDefault <Mailing>(c => c.mailing_Id == mailingId);
                if (mailing == null)
                {
                    MessageBox.Show("Ошибка (Тип не найден! Попробуйте выбрать заново)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    SetData();
                    return;
                }

                if (IOUMainTable_ComboBox_id_Subscription.SelectedIndex > 0)
                {
                    int subscriptionId = subscriptionsArr[IOUMainTable_ComboBox_id_Subscription.SelectedIndex - cbId_SubStep].subscription_Id;
                    subscription = context.Subscriptions.FirstOrDefault <Subscription>(c => c.subscription_Id == subscriptionId);
                }
                else if (IOUMainTable_ComboBox_id_Subscription.SelectedIndex == 0)
                {
                    canSubNull = true;
                }
                if (subscription == null && canSubNull == false)
                {
                    MessageBox.Show("Ошибка (Подписка не найдена! Попробуйте выбрать заново)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    SetData();
                    return;
                }

                senderAddress = IOUMainTable_TBox_sender_Address.Text;
                if (isValidAddress(senderAddress) == false)
                {
                    MessageBox.Show("Ошибка! (Адрес отправителя введен неправильно или не введен вовсе)"
                                    + "\n" + "Внимание! Максимальная длинна адреса " + maxLenghtStringAddress + " символов"
                                    + "\n" + "Форма записи(Страна, город, 'район', улица, дом, 'картира'"
                                    + "\n" + "' ' - необязательны для ввода в случае их отсутствия"
                                    , "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    senderAddress = null;
                    return;
                }

                recipientAddress = IOUMainTable_TBox_recipient_Address.Text;
                if (isValidAddress(recipientAddress) == false)
                {
                    MessageBox.Show("Ошибка! (Адрес получателя введен неправильно или не введен вовсе)"
                                    + "\n" + "Внимание! Максимальная длинна адреса " + maxLenghtStringAddress + " символов"
                                    + "\n" + "Форма записи(Страна, город, 'район', улица, дом, 'картира'"
                                    + "\n" + "' ' - необязательны для ввода в случае их отсутствия"
                                    , "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    recipientAddress = null;
                    return;
                }

                string weightStr = IOUMainTable_TBox_weight_Package.Text;
                weightStr.Trim();
                if (weightStr.IndexOf(".") == -1 && weightStr.IndexOf(",") == -1)
                {
                    weightStr += ".0";
                }
                else
                {
                    weightStr = weightStr.Replace(",", ".");
                }
                if (float.TryParse(weightStr, NumberStyles.Float, new CultureInfo("en-US"), out weight))
                {
                    weight = float.Parse(weightStr, NumberStyles.Float, new CultureInfo("en-US"));
                }
                else
                {
                    MessageBox.Show("Ошибка (Вес пакета введен не правильно)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                if (weight <= 0)
                {
                    MessageBox.Show("Ошибка (Вес пакета не может быть меньше нуля или равняться ему)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                string dateStr = IOUMainTable_TBox_date_Operation.Text;
                dateOperation = DateTime.Parse(dateStr);

                string priceStr = IOUMainTable_TBox_price.Text;
                priceStr.Trim();
                if (priceStr.IndexOf(".") == -1 && priceStr.IndexOf(",") == -1)
                {
                    priceStr += ".0";
                }
                else
                {
                    priceStr = priceStr.Replace(",", ".");
                }
                if (decimal.TryParse(priceStr, NumberStyles.Float, new CultureInfo("en-US"), out price))
                {
                    price = decimal.Parse(priceStr, NumberStyles.Float, new CultureInfo("en-US"));
                }
                else
                {
                    MessageBox.Show("Ошибка (Цена введена не правильно)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                if (price <= 0)
                {
                    MessageBox.Show("Ошибка (Вес пакета не может быть меньше нуля или равняться ему)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }


                if (operation != null && mailing != null &&
                    senderAddress != null && recipientAddress != null &&
                    weight != 0 && dateOperation != null &&
                    price != 0)
                {
                    mail.id_Operation      = operation;
                    mail.id_Mailing        = mailing;
                    mail.id_Subscription   = subscription;
                    mail.sender_Address    = senderAddress;
                    mail.recipient_Address = recipientAddress;
                    mail.weight_Package    = weight;
                    mail.date_Operation    = dateOperation;
                    mail.price             = price;

                    if (currentMW == ModeWindow.Insert)
                    {
                        MessageBoxResult result = MessageBox.Show("Вы уверенны что хотите добавить новую запись в главную таблицу?", "Подтверждение", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.None);

                        if (result == MessageBoxResult.No)
                        {
                            return;
                        }
                        context.Mail.Add(mail);
                        context.SaveChanges();
                        MessageBox.Show("Добавление записи в главную таблицу прошло успешно", "Успешно", MessageBoxButton.OK, MessageBoxImage.None);
                    }

                    if (currentMW == ModeWindow.Update)
                    {
                        MessageBoxResult result = MessageBox.Show("Вы уверенны что хотите изменить " + mail.mail_Id + " запись в главной таблице?", "Подтверждение", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.None);

                        if (result == MessageBoxResult.No)
                        {
                            return;
                        }
                        context.SaveChanges();
                        MessageBox.Show("Изменение записи в главной таблице прошло успешно", "Успешно", MessageBoxButton.OK, MessageBoxImage.None);
                    }
                }
                else
                {
                    MessageBox.Show("Невозможно продолжить операцию: (Данные потеряны)", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
            mainWindow.RefreshMainTable();

            this.Close();
        }
Ejemplo n.º 3
0
 public IActionResult Create(Mailing mailing)
 {
     _db.Mailings.Add(mailing);
     _db.SaveChanges();
     return(RedirectToAction("Index", "Posts"));
 }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            accountingMasterPage = (AccountingMasterPage)Page.Master;
            accountingMasterPage.InitializeMasterPageComponents();
            dataAccess = accountingMasterPage.dataAccess;


            // action:
            //    null -  Sem ação, apenas lista os mailings
            //    0    -  Excluir mailing, lista os restantes
            //    1    -  Teste execução do mailing
            int?action    = null;
            int?mailingId = null;

            try
            {
                if (!String.IsNullOrEmpty(Request.QueryString["action"]))
                {
                    action = int.Parse(Request.QueryString["action"]);
                }

                if (!String.IsNullOrEmpty(Request.QueryString["mailingId"]))
                {
                    mailingId = int.Parse(Request.QueryString["mailingId"]);
                }
            }
            catch (System.FormatException)
            {
                // Remove todos os controles da página
                configurationArea.Controls.Clear();
                controlArea.Controls.Clear();

                // Mostra aviso de inconsistência nos parâmetros
                WarningMessage.Show(controlArea, ArgumentBuilder.GetWarning());
                return;
            }

            Tenant tenant = (Tenant)Session["tenant"];

            mailingDAO = new MailingDAO(dataAccess.GetConnection());

            if (mailingId != null)
            {
                switch (action)
                {
                case 0:
                    mailingDAO.RemoveMailing(mailingId.Value);
                    Response.Redirect("ConfigMailing.aspx");     // Limpa a QueryString para evitar erros
                    break;

                case 1:
                    Mailing mailing = mailingDAO.GetMailing(tenant.id, mailingId);
                    TestMailing(mailing);
                    break;

                default:
                    break;
                }
            }

            List <Object> mailingList = mailingDAO.GetAllMailings(tenant.id);

            String[] columnNames = new String[] { "Frequência de envio", "Relatório", "Destinatários" };
            //String testScript = "window.location='ConfigMailing.aspx?action=1&mailingId=' + {0};";
            String alterScript  = "window.open('MailingSettings.aspx?mailingId=' + {0}, 'Settings', 'width=540,height=600');";
            String removeScript = "var confirmed = confirm('Deseja realmente excluir este item?'); if (confirmed) window.location='ConfigMailing.aspx?action=0&mailingId=' + {0};";

            EditableListButton[] buttons = new EditableListButton[]
            {
                // Botões que devem aparecer para os items da lista
                //new EditableListButton("Testar", testScript, ButtonTypeEnum.Execute),
                new EditableListButton("Editar", alterScript, ButtonTypeEnum.Edit),
                new EditableListButton("Excluir", removeScript, ButtonTypeEnum.Remove)
            };
            EditableList editableList = new EditableList(configurationArea, columnNames, buttons);

            foreach (Mailing mailing in mailingList)
            {
                ReportFrequencyEnum frequency  = (ReportFrequencyEnum)mailing.frequency;
                ReportTypeEnum      reportType = (ReportTypeEnum)mailing.reportType;

                String[] mailingProperties = new String[]
                {
                    AssociatedText.GetFieldDescription(typeof(ReportFrequencyEnum), frequency.ToString()),
                    AssociatedText.GetFieldDescription(typeof(ReportTypeEnum), reportType.ToString()),
                    mailing.recipients
                };
                // A lista de mailings não possui item default, isDefaultItem é sempre "false"
                editableList.InsertItem(mailing.id, false, mailingProperties);
            }
            editableList.DrawList();

            // O clique do botão chama o script de alteração passando "id = 0", a tela de alteração
            // interpreta "id = 0" como "criar um novo", o id é então gerado no banco de dados.
            btnNovo.Attributes.Add("onClick", String.Format(alterScript, 0));
        }
Ejemplo n.º 5
0
 private void TestMailing(Mailing mailing)
 {
     // not implemented yet
 }
Ejemplo n.º 6
0
        public override UserDto Save(UserDto userDto)
        {
            var sendMail = false;

            if (userDto.Id == 0)
            {
                if (userDto.Password == null)
                {
                    userDto.Password = this.membershipService.CreateRandomPassword();
                }


                var user = Mapper.Map <UserDto, User>(userDto);

                var passwordSalt = this.encryptionService.CreateSalt();

                user.Salt           = passwordSalt;
                user.HashedPassword = this.encryptionService.EncryptPassword(userDto.Password, passwordSalt);
                user.Status         = 1;
                this.entityRepository.Add(user);

                this.unitOfWork.Commit();

                userDto.Id = user.Id;
                sendMail   = true;
            }
            else
            {
                var user = this.entityRepository.GetSingle(userDto.Id);
                user.FirstName = userDto.FirstName;
                user.LastName  = userDto.LastName;
                user.RoleId    = userDto.Role.Id;
                if (user.Email != userDto.Email)
                {
                    sendMail = true;
                }
                if (!string.IsNullOrEmpty(userDto.Password))
                {
                    var passwordSalt = this.encryptionService.CreateSalt();
                    user.HashedPassword = this.encryptionService.EncryptPassword(userDto.Password, passwordSalt);
                }
                user.Email    = userDto.Email;
                user.Id_Erp   = userDto.Id_Erp;
                user.Username = userDto.Username;
                user.IsLocked = userDto.IsLocked;

                this.entityRepository.Edit(user);
                this.unitOfWork.Commit();
            }

            var userGroupCompanies = this.userCompanyGroupRepository.GetAll().Where(x => x.UserId == userDto.Id).ToList();

            if (userGroupCompanies.Count > 0)
            {
                foreach (var userGroupCompany in userGroupCompanies)
                {
                    var entity = this.userCompanyGroupRepository.GetSingle(userGroupCompany.Id);
                    this.userCompanyGroupRepository.Delete(entity);
                }

                this.unitOfWork.Commit();
            }


            foreach (var userGroupCompanyDto in userDto.UserCompanyGroups)
            {
                userGroupCompanyDto.UserId = userDto.Id;
                var ugcentity = Mapper.Map <UserCompanyGroupDto, UserCompanyGroup>(userGroupCompanyDto);
                this.userCompanyGroupRepository.Add(ugcentity);
            }

            this.unitOfWork.Commit();


            if (sendMail)
            {
                Mailing.SendGenericMail("Solicitud de usuario", userDto.Email, userDto,
                                        "~/views/EmailTemplate/Index.cshtml");
            }
            return(userDto);
        }
Ejemplo n.º 7
0
        async public Task <bool> AddMailing(string AppUserId, MailingViewModel Mailing)
        {
            // check on required fields
            if (AppUserId == null || Mailing.Text == null || Mailing.GroupIds == null || Mailing.Times == null)
            {
                return(false);
            }

            // searchin for reciever groups
            var groups = await(from g in db.Groups
                               where Mailing.GroupIds.Contains(g.Id) && g.UserId == AppUserId
                               select g).ToListAsync();

            if (!groups.Any())
            {
                return(false);
            }

            // creation and population of Times list
            string[] rawTimes = Mailing.Times.Split(',');
            var      times    = (from rt in rawTimes
                                 // for testing purposes
                                 //where Convert.ToDateTime(rt) > DateTime.UtcNow
                                 select Convert.ToDateTime(rt)).Distinct();

            if (!times.Any())
            {
                return(false);
            }

            // creating new mailing
            var newMailing = new Mailing()
            {
                SenderId       = AppUserId,
                Title          = Mailing.Title,
                Text           = Mailing.Text,
                DateOfCreation = DateTime.UtcNow
            };

            // populating group - mailings
            var groupMailings = new List <GroupMailing>();

            foreach (var iter in groups)
            {
                groupMailings.Add(new GroupMailing()
                {
                    Group   = iter,
                    Mailing = newMailing
                });
            }

            // creating sending times
            var sendingTimes = new List <Time>();

            foreach (var time in times)
            {
                sendingTimes.Add(new Time()
                {
                    TimeToSend = time,
                    Mailing    = newMailing,
                    BeenSent   = false,
                });
            }

            await db.Mailings.AddAsync(newMailing);

            await db.Times.AddRangeAsync(sendingTimes);

            await db.GroupMailings.AddRangeAsync(groupMailings);

            await db.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 8
0
        public void POEmail_Rejected(int?phsId, int?submitterId, int?lastModifiedBy)
        {
            try
            {
                ApproverEmailProfile submitterInfo = new ApproverEmailProfile();

                ApproverEmailProfile loginApproverInfo = getUserInfo(lastModifiedBy);

                var poApproversList = (from apr in db.TEPOApprovers
                                       where apr.IsDeleted == false && apr.POStructureId == phsId
                                       select new { apr.ApproverId, apr.ApproverName, apr.Status, apr.SequenceNumber }).OrderBy(a => a.SequenceNumber).ToList();
                var purchaseheaderstructInfo = (from phs in db.TEPOHeaderStructures
                                                join vendor in db.TEPOVendorMasterDetails on phs.VendorID equals vendor.POVendorDetailId into tempvendorDtl
                                                from vndrdtl in tempvendorDtl.DefaultIfEmpty()
                                                join vendorms in db.TEPOVendorMasters on vndrdtl.POVendorMasterId equals vendorms.POVendorMasterId into tempvendorMstr
                                                from vndrmstr in tempvendorMstr.DefaultIfEmpty()
                                                where phs.Uniqueid == phsId && phs.IsDeleted == false
                                                select new
                {
                    phs.Uniqueid,
                    phs.PO_Title,
                    phs.Fugue_Purchasing_Order_Number,
                    phs.Purchasing_Order_Number,
                    phs.Version,
                    Vendor_Code = vndrdtl.VendorCode,
                    Vendor_Owner = vndrmstr.VendorName
                }).FirstOrDefault();
                if (poApproversList.Count > 0)
                {
                    if (submitterId > 0)
                    {
                        submitterInfo = getUserInfo(submitterId);
                    }
                }
                if (submitterInfo != null)
                {
                    string templateContent = string.Empty;
                    string subjectContent  = string.Empty;
                    var    templateinfo    = db.TEEmailTemplates.Where(a => a.ModuleName == "POReject" && a.IsDeleted == false).FirstOrDefault();
                    if (templateinfo != null)
                    {
                        templateContent = templateinfo.EmailTemplate;
                        subjectContent  = templateinfo.Subject;
                    }
                    if (!string.IsNullOrEmpty(templateContent))
                    {
                        templateContent = templateContent.Replace("$Employee", submitterInfo.ApproverName);
                        if (purchaseheaderstructInfo.Purchasing_Order_Number != null)
                        {
                            templateContent = templateContent.Replace("$PONumber", purchaseheaderstructInfo.Purchasing_Order_Number);
                        }
                        else
                        {
                            templateContent = templateContent.Replace("$PONumber", purchaseheaderstructInfo.Uniqueid.ToString());
                        }
                        templateContent = templateContent.Replace("$VendorName", purchaseheaderstructInfo.Vendor_Code + '-' + purchaseheaderstructInfo.Vendor_Owner);
                        templateContent = templateContent.Replace("$ApproverName", loginApproverInfo.ApproverName);
                    }
                    if (!string.IsNullOrEmpty(subjectContent))
                    {
                        subjectContent = subjectContent.Replace("$ApproverName", loginApproverInfo.ApproverName);
                        if (purchaseheaderstructInfo.Purchasing_Order_Number != null)
                        {
                            subjectContent = subjectContent.Replace("$PO", purchaseheaderstructInfo.Purchasing_Order_Number);
                        }
                        else
                        {
                            subjectContent = subjectContent.Replace("$PO", purchaseheaderstructInfo.Uniqueid.ToString());
                        }
                    }
                    string   TO          = submitterInfo.EmailId;
                    string   CC          = "";
                    string   BCC         = "";
                    string   body        = templateContent;
                    string   subject     = subjectContent;
                    string[] attachments = new string[0];
                    var      mail        = new Mailing();
                    var      sendingmail = mail.SendEMail(TO, CC, BCC, body, subject, attachments, null);
                }
            }
            catch (Exception ex)
            {
                exceptionObj.RecordUnHandledException(ex);
            }
        }
Ejemplo n.º 9
0
        private CreateFileResult CreateFileAndSendMail(string data_path, string docnum, string customer_email)
        {
            try
            {
                DbfDataSet dbf   = new DbfDataSet(data_path);
                var        artrn = dbf.Artrn.Where(a => a.docnum == docnum).FirstOrDefault();

                if (artrn == null)
                {
                    throw new Exception("Error : Document number " + docnum + " not found in data path " + data_path);
                }

                string subject = string.Empty;
                subject += artrn.docdat.Value.ToString("[ddMMyyyy]", CultureInfo.GetCultureInfo("th-TH"));
                subject += "[" + artrn.GetSubjectDocType(dbf) + "]";
                subject += "[" + artrn.docnum + "]";

                //Console.WriteLine(" ==> Start at " + DateTime.Now.ToString());
                var json_result = this.CreateJson(data_path, docnum, data_path + @"\eTaxInvoice\json\" + docnum + ".json");
                if (json_result.Success)
                {
                    var xml_result = this.CreateXml(data_path + @"\eTaxInvoice\json\" + docnum + ".json", data_path + @"\eTaxInvoice\xml\" + docnum + ".xml");
                    if (xml_result.Success)
                    {
                        File.Delete(data_path + @"\eTaxInvoice\json\" + docnum + ".json");

                        var pdfa3_result = this.CreatePdfA3(data_path + @"\eTaxInvoice\pdf\" + docnum + ".pdf", data_path + @"\eTaxInvoice\xml\" + docnum + ".xml", data_path + @"\eTaxInvoice\pdfa3\" + docnum + ".pdf", artrn.GetDocType(dbf));
                        if (pdfa3_result.Success)
                        {
                            File.Delete(data_path + @"\eTaxInvoice\xml\" + docnum + ".xml");

                            Mailing m           = new Mailing(customer_email, subject, "", new string[] { data_path + @"\eTaxInvoice\pdfa3\" + docnum + ".pdf" });
                            var     mail_result = m.Send();
                            if (mail_result.Success)
                            {
                                //Console.WriteLine(" ==> Send mail success");
                                //Console.WriteLine(" ==> Completed at " + DateTime.Now.ToString());
                                m = null;
                                return(new CreateFileResult {
                                    Success = true, Message = mail_result.Message
                                });
                            }
                            else
                            {
                                //Console.WriteLine(" ==> Send mail failed");
                                //Console.WriteLine(" ==> Corupted at " + DateTime.Now.ToString());
                                return(new CreateFileResult {
                                    Success = false, Message = mail_result.Message
                                });
                            }
                        }
                        else
                        {
                            return(pdfa3_result);
                        }
                    }
                    else
                    {
                        return(xml_result);
                    }
                }
                else
                {
                    return(json_result);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 10
0
 public void Execute()
 {
     Mailing.sendMail();
 }
Ejemplo n.º 11
0
        private void btAccepter_Click(object sender, EventArgs e)
        {
            try
            {
                ActiviteDA    aDA   = new ActiviteDA();
                AdherentDA    aDDA  = new AdherentDA();
                ParticipantDA pDA   = new ParticipantDA();
                int           reste = aDA.restePlace(int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()));
                if (reste <= 0)
                {
                    MessageBox.Show("Le nombre de place est peline", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    int i   = 0;
                    int nbr = 0;
                    foreach (Participation l in listAdherent)
                    {
                        nbr++;
                    }
                    if (nbr <= reste)
                    {
                        reste = nbr;
                    }
                    else
                    {
                    }
                    Mailing m;
                    foreach (Participation l in listAdherent)
                    {
                        if ((aDDA.getNombrePoint(l.participant.matricule) <= 0))
                        {
                            pc.refuser(l.id);
                            MessageBox.Show("Demande réfusé", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            continue;
                        }
                        else
                        {
                            foreach (String a in a.listAdresse(l.participant.matricule))
                            {
                                m = new Mailing(a, "Notification", "Vous etes le bienvenue , nous avons accepte votre demande");
                                m.sendMail();
                            }
                            pc.AccepterAdherent(l.participant.matricule, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()), 0, int.Parse(dataActiviteActuel.CurrentRow.Cells[4].Value.ToString()));

                            if (i == reste)
                            {
                                MessageBox.Show("Erreur");
                                break;
                            }
                            i++;
                        }
                    }
                    foreach (Participation l in listConjoint)
                    {
                        pc.AccepterConjoint(l.participant.matricule, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()), 0, 0);
                    }
                    foreach (Participation l in listEnfant)
                    {
                        pc.AccepterEnfant(l.participant.matricule, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()), 0, 0);
                    }
                    a            = new AdherentDA();
                    listAdherent = pc.DemandeListAdherent(int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()));
                    pc.AfficheDemandeParActivite(dataDemande, int.Parse(dataActiviteActuel.CurrentRow.Cells[0].Value.ToString()));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }