コード例 #1
0
        public ActionResult ChangePassword([Bind] Usuario usuario, bool isCurrentUser)
        {
            if (!usuario.NewPassword.Equals(usuario.NewPasswordRepeat))
            {
                ModelState.AddModelError("NewPassword", "Las contraseñas deben coincidir");
                ViewBag.isCurrentUser = isCurrentUser;
                return(View(usuario));
            }
            if (logic.ChangePassword(usuario.EntityID, usuario.NewPassword, usuario.Password))
            {
                MailLogic mlog = new MailLogic();
                mlog.EnviarEmail(usuario.EntityID, usuario.NewPassword, Global.MailsTypes.CAMBIO_CONTRASEÑA);
                TempData["SaveSuccess"] = "Se cambió la contraseña correctamente";
                if (isCurrentUser)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            ViewBag.isCurrentUser = isCurrentUser;
            ModelState.AddModelError("Password", "La contraseña actual ingresada no es correcta");

            return(View(usuario));
        }
コード例 #2
0
        ClosingType ClosingStatus = ClosingType.DoNothing; //FormClosingイベントが発生した際の挙動の種類


        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="userInfo">ログインユーザーのユーザー情報</param>
        /// <param name="callerLocation">呼び出し元の座標</param>
        public MailDestinationForm(UserInfo userInfo, Point callerLocation)
        {
            InitializeComponent();

            var addresInfoList = new List <MailInfo>(); //アドレス情報

            this.MailInfoList = new List <MailInfo>();

            this.UserInfo = userInfo;

            this.Location = callerLocation;

            //アドレス情報取得
            try
            {
                addresInfoList = new MailLogic().GetAddresInfo(this.UserInfo.UserID);
            }
            catch (NpgsqlException)
            {
                MessageBox.Show("アドレス情報の取得に失敗しました。", "お知らせ");
                return;
            }

            var mailLogic = new MailLogic();

            //画面に宛先一覧を表示し、各行にその宛先のアドレス情報を設定
            for (int i = 0; i < addresInfoList.Count; i++)
            {
                dataGridView1.Rows.Add(mailLogic.GenerateAddressName(addresInfoList[i]));
                dataGridView1.Rows[i].Cells[1].Value = false; //チェックボックスの初期値をfalseに設定
                dataGridView1.Rows[i].Cells[0].Tag   = addresInfoList[i];
            }
        }
コード例 #3
0
 private void buttonToPdf_Click(object sender, RoutedEventArgs e)
 {
     if (datePickerFrom.SelectedDate >= datePickerTo.SelectedDate)
     {
         MessageBox.Show("Неверное выставление даты начала", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     try
     {
         logic.SaveDiseasesToPdfFile(new ReportBindingModel
         {
             FileName = "D:\\Otchet.pdf",
             DateFrom = datePickerFrom.SelectedDate,
             DateTo   = datePickerTo.SelectedDate,
             DoctorId = id
         });
         MailLogic.MailSendAsync(new MailSendInfo
         {
             MailAddress = _doctorStorage.GetElement(new DoctorBindingModel {
                 Id = id
             })?.EMail,
             Subject = $"Отчет",
             Text    = "Отчет по заболеваниям за период c " + datePickerFrom.SelectedDate.Value.ToShortDateString() +
                       " по " + datePickerTo.SelectedDate.Value.ToShortDateString(),
             File = "D:\\Otchet.pdf"
         });
         MessageBox.Show("Сообщение отправлено", "Успех", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #4
0
 public void SetCharacterData(AuthorizedCharacterData data)
 {
     Assets               = new AssetsLogic(client, config, data);
     Bookmarks            = new BookmarksLogic(client, config, data);
     Calendar             = new CalendarLogic(client, config, data);
     Character            = new CharacterLogic(client, config, data);
     Clones               = new ClonesLogic(client, config, data);
     Contacts             = new ContactsLogic(client, config, data);
     Contracts            = new ContractsLogic(client, config, data);
     Corporation          = new CorporationLogic(client, config, data);
     FactionWarfare       = new FactionWarfareLogic(client, config, data);
     Fittings             = new FittingsLogic(client, config, data);
     Fleets               = new FleetsLogic(client, config, data);
     Industry             = new IndustryLogic(client, config, data);
     Killmails            = new KillmailsLogic(client, config, data);
     Location             = new LocationLogic(client, config, data);
     Loyalty              = new LoyaltyLogic(client, config, data);
     Mail                 = new MailLogic(client, config, data);
     Market               = new MarketLogic(client, config, data);
     Opportunities        = new OpportunitiesLogic(client, config, data);
     PlanetaryInteraction = new PlanetaryInteractionLogic(client, config, data);
     Search               = new SearchLogic(client, config, data);
     Skills               = new SkillsLogic(client, config, data);
     UserInterface        = new UserInterfaceLogic(client, config, data);
     Wallet               = new WalletLogic(client, config, data);
     Universe             = new UniverseLogic(client, config, data);
 }
コード例 #5
0
 private void buttonToPdf_Click(object sender, RoutedEventArgs e)
 {
     if (datePickerFrom.SelectedDate >= datePickerTo.SelectedDate)
     {
         MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     try
     {
         logic.SaveCosmeticsToPdfFile(new ReportBindingModelEmployee
         {
             FileName   = "D:\\Otchet.pdf",
             DateFrom   = datePickerFrom.SelectedDate,
             DateTo     = datePickerTo.SelectedDate,
             EmployeeId = id
         });
         MailLogic.MailSendAsync(new MailSendInfo
         {
             MailAddress = _employeeStorage.GetElement(new EmployeeBindingModel {
                 Id = id
             })?.EMail,
             Subject = $"Отчет",
             Text    = "Отчет по косметике за период c " + datePickerFrom.SelectedDate.Value.ToShortDateString() +
                       " по " + datePickerTo.SelectedDate.Value.ToShortDateString(),
             File = "D:\\Otchet.pdf"
         });
         MessageBox.Show("Сообщение отправлено", "Успех", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #6
0
        static void Main()
        {
            var container = BuildUnityContainer();

            MailLogic.MailConfig(new MailConfig
            {
                SmtpClientHost = ConfigurationManager.AppSettings["SmtpClientHost"],
                SmtpClientPort = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpClientPort"]),
                MailLogin      = ConfigurationManager.AppSettings["MailLogin"],
                MailPassword   = ConfigurationManager.AppSettings["MailPassword"],
            });

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var form = new FormAuthorization();

            form.ShowDialog();

            if (Email == "123" && Password == "123")
            {
                Application.Run(container.Resolve <FormAdmin>());
            }
            else
            {
                MessageBox.Show("Неверный логин или пароль", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        private void buttonSendReportWord_Click(object sender, EventArgs e)
        {
            try
            {
                exceptionHandling.СheckingInput(textBoxEmail.Text, "Почта");

                using (var dialog = new SaveFileDialog {
                    Filter = "docx|*.docx"
                })
                {
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        reportLogic.SaveRequestToWordFile(new ReportBindingModel
                        {
                            FileName = dialog.FileName
                        });
                        MailLogic.MailSend(new MailSendInfo
                        {
                            MailAddress = textBoxEmail.Text,
                            Subject     = $"Оповещение по заявке",
                            Text        = $"Поступила заявка на места",
                            FileName    = dialog.FileName
                        });
                        MessageBox.Show("Отчет отправлен!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
 public UtilisateurController()
 {
     userLogic    = new UtilisateurLogic();
     companyLogic = new CompanyLogic();
     roleLogic    = new RoleLogic();
     notifLogic   = new NotificationLogic();
     mailLogic    = new MailLogic();
 }
コード例 #9
0
 public AccountController()
 {
     utilisateurLogic        = new UtilisateurLogic();
     passwordResetTokenLogic = new PasswordResetTokenLogic();
     roleLogic  = new RoleLogic();
     notifLogic = new NotificationLogic();
     mailLogic  = new MailLogic();
 }
コード例 #10
0
ファイル: EsiClient.cs プロジェクト: Slazanger/SMT
        /// <summary>
        ///
        /// </summary>
        /// <param name="config"></param>
        public EsiClient(IOptions <EsiConfig> _config)
        {
            config = _config.Value;
            client = new HttpClient(new HttpClientHandler
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            });

            // Enforce user agent value
            if (string.IsNullOrEmpty(config.UserAgent))
            {
                throw new ArgumentException("For your protection, please provide an X-User-Agent value. This can be your character name and/or project name. CCP will be more likely to contact you rather than just cut off access to ESI if you provide something that can identify you within the New Eden galaxy.");
            }
            else
            {
                client.DefaultRequestHeaders.Add("X-User-Agent", config.UserAgent);
            }

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
            client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));

            SSO                  = new SsoLogic(client, config);
            Alliance             = new AllianceLogic(client, config);
            Assets               = new AssetsLogic(client, config);
            Bookmarks            = new BookmarksLogic(client, config);
            Calendar             = new CalendarLogic(client, config);
            Character            = new CharacterLogic(client, config);
            Clones               = new ClonesLogic(client, config);
            Contacts             = new ContactsLogic(client, config);
            Contracts            = new ContractsLogic(client, config);
            Corporation          = new CorporationLogic(client, config);
            Dogma                = new DogmaLogic(client, config);
            FactionWarfare       = new FactionWarfareLogic(client, config);
            Fittings             = new FittingsLogic(client, config);
            Fleets               = new FleetsLogic(client, config);
            Incursions           = new IncursionsLogic(client, config);
            Industry             = new IndustryLogic(client, config);
            Insurance            = new InsuranceLogic(client, config);
            Killmails            = new KillmailsLogic(client, config);
            Location             = new LocationLogic(client, config);
            Loyalty              = new LoyaltyLogic(client, config);
            Mail                 = new MailLogic(client, config);
            Market               = new MarketLogic(client, config);
            Opportunities        = new OpportunitiesLogic(client, config);
            PlanetaryInteraction = new PlanetaryInteractionLogic(client, config);
            Routes               = new RoutesLogic(client, config);
            Search               = new SearchLogic(client, config);
            Skills               = new SkillsLogic(client, config);
            Sovereignty          = new SovereigntyLogic(client, config);
            Status               = new StatusLogic(client, config);
            Universe             = new UniverseLogic(client, config);
            UserInterface        = new UserInterfaceLogic(client, config);
            Wallet               = new WalletLogic(client, config);
            Wars                 = new WarsLogic(client, config);
        }
コード例 #11
0
 public void SendMail(ReportBindingModel model)
 {
     _report.SaveRoutesToPdfFile(model);
     MailLogic.MailSendAsync(new MailSendInfo
     {
         MailAddress = model.UserEmail,
         Subject     = "Отчет",
         Text        = "Отчет по маршрутам",
         ReportFile  = model.FileName
     });
 }
コード例 #12
0
 public static void Main(string[] args)
 {
     MailLogic.MailConfig(new MailConfig
     {
         SmtpClientHost = ConfigurationManager.AppSettings["SmtpClientHost"],
         SmtpClientPort = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpClientPort"]),
         MailLogin      = ConfigurationManager.AppSettings["MailLogin"],
         MailPassword   = ConfigurationManager.AppSettings["MailPassword"],
     });
     CreateHostBuilder(args).Build().Run();
 }
コード例 #13
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     MailLogic.MailConfig(new MailConfig
     {
         SmtpClientHost = configuration["SmtpClientHost"],
         SmtpClientPort = Convert.ToInt32(configuration["SmtpClientPort"]),
         MailLogin      = configuration["MailLogin"],
         MailPassword   = configuration["MailPassword"],
     });
 }
コード例 #14
0
 public IActionResult SendMail([Bind("DateTo,DateFrom")] ReportBindingModel model)
 {
     model.FileName = @".\wwwroot\list\SocietiesList.pdf";
     model.ClientId = Program.Client.Id;
     _reportLogic.SaveSocietiesToPdfFile(model);
     MailLogic.MailSendAsync(new MailSendInfo
     {
         MailAddress = Program.Client.Login,
         Subject     = "Отчет",
         Text        = "Отчет по кружкам",
         ReportFile  = model.FileName
     });
     return(RedirectToAction("Index"));
 }
コード例 #15
0
        static void Main()
        {
            var container = BuildUnityContainer();

            MailLogic.MailConfig(new MailConfig
            {
                SmtpClientHost = ConfigurationManager.AppSettings["SmtpClientHost"],
                SmtpClientPort = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpClientPort"]),
                MailLogin      = ConfigurationManager.AppSettings["MailLogin"],
                MailPassword   = ConfigurationManager.AppSettings["MailPassword"],
            });
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(container.Resolve <FormEnter>());
        }
コード例 #16
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            var container = BuildUnityContainer();

            MailLogic.MailConfig(new MailConfig
            {
                SmtpClientHost = ConfigurationManager.AppSettings["SmtpClientHost"],
                SmtpClientPort = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpClientPort"]),
                MailLogin      = ConfigurationManager.AppSettings["MailLogin"],
                MailPassword   = ConfigurationManager.AppSettings["MailPassword"]
            });
            var loginWindow = container.Resolve <LoginWindow>();

            loginWindow.ShowDialog();
        }
コード例 #17
0
        public ActionResult HacerExamen(List <Pregunta> preguntas, long cursoID)
        {
            var resultado = CursoUsuarioLogic.GuardarExamenRealizado(preguntas, cursoID);

            PreguntaLogic preguntaLogic  = new PreguntaLogic();
            var           listaPreguntas = preguntaLogic.GetPreguntasByCurso(cursoID);

            foreach (Pregunta pregunta in listaPreguntas)
            {
                pregunta.Curso = new Curso();
                foreach (Opcion opcion in pregunta.Opciones)
                {
                    opcion.Pregunta = new Pregunta();
                }
            }

            string mensaje;

            if (resultado >= 60)
            {
                mensaje = "Felecitaciones, aprobaste, tu nota es: " + resultado;

                // -- Obtengo usuario logueado
                var usuarioLogueado = SessionManager.Get <Usuario>(Global.SessionsKeys.USER_SESSION);

                MailLogic mailLogic = new MailLogic();

                mailLogic.EnviarEmail(usuarioLogueado.EntityID, usuarioLogueado.Password, Global.MailsTypes.CURSO_FINALIZADO);

                List <Usuario> usuariosEmpresaMails = new UsuarioLogic().GetUsuarioEmpresaParaMail(usuarioLogueado.Empresa.EntityID);

                foreach (Usuario usu in usuariosEmpresaMails)
                {
                    mailLogic.EnviarEmail(usu.EntityID, usu.Password, Global.MailsTypes.CURSO_FINALIZADO);
                }
            }
            else
            {
                mensaje = "No aprobaste, tu nota es: " + resultado;
            }
            ExamenJSON examen = new ExamenJSON {
                Preguntas = listaPreguntas, Mensaje = mensaje
            };

            return(Json(examen, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
ファイル: MailCreateForm.cs プロジェクト: Ytaro273/Portal
        /// <summary>
        /// 宛先ボタンクリックイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string addresName = null; //画面に表示する宛先
            var    mailLogic  = new MailLogic();

            this.Hide();

            //宛先フォームに遷移し、宛先を選択
            var mailDestinationForm = new MailDestinationForm(this.UserInfo, this.Location);

            mailDestinationForm.ShowDialog();

            this.Show();

            if (mailDestinationForm.MailInfoList.Count > 0)
            {
                //宛先フォームで選択した宛先を、メール作成フォームのフィールドに設定
                this.MailInfoList = mailDestinationForm.MailInfoList;

                //送信先のアドレスすべてを連結して一つにする
                for (int i = 0; i < mailDestinationForm.MailInfoList.Count; i++)
                {
                    addresName += mailLogic.GenerateAddressName(mailDestinationForm.MailInfoList[i]);

                    //繰り返し処理の最後の周以外は、文字列にカンマを付け加える
                    if (i < mailDestinationForm.MailInfoList.Count - 1)
                    {
                        addresName += ",";
                    }
                }

                label1.Text = addresName; //送信先のアドレスを表示

                button2.Enabled = true;   //送信ボタンを活性に
            }
            else
            {
                button2.Enabled = false;   //送信ボタンを非活性に
            }
            mailDestinationForm.Dispose(); //宛先フォームのリソースを解放
        }
コード例 #19
0
ファイル: MailCreateForm.cs プロジェクト: Ytaro273/Portal
        /// <summary>
        /// 送信ボタンクリックイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            //件名かメッセージ内容が空白なら、入力を要求
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("件名とメッセージを入力してください。", "お知らせ");
                return;
            }

            var result = MessageBox.Show("メールを送信します。よろしいですか?", "お知らせ", MessageBoxButtons.OKCancel);

            if (result == DialogResult.OK)
            {
                var mailLogic = new MailLogic();

                //件名とメッセージ内容を設定
                foreach (var mailInfo in this.MailInfoList)
                {
                    mailInfo.Subject = textBox1.Text;
                    mailInfo.Message = textBox2.Text;
                }

                //メールを送信
                try
                {
                    mailLogic.SendMail(UserInfo.UserID, this.MailInfoList);
                }
                catch (NpgsqlException)
                {
                    MessageBox.Show("メールの送信に失敗しました。", "お知らせ");
                    return;
                }

                MessageBox.Show("送信が完了しました。", "お知らせ");

                this.Hide();
                new MailForm(this.UserInfo, this.Location).Show();
                this.Close();
            }
        }
コード例 #20
0
 private void ButtonMail_Click(object sender, RoutedEventArgs e)
 {
     if (DatePikerTo.SelectedDate == null || DatePikerFrom.SelectedDate == null)
     {
         MessageBox.Show("Выберите даты", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     if (DatePikerFrom.SelectedDate >= DatePikerTo.SelectedDate)
     {
         MessageBox.Show("Дата указана неверно", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     try
     {
         var fileName = "Report.pdf";
         logic.SaveToPdfFile(new ReportBindingModel
         {
             FileName = fileName,
             DateFrom = DatePikerFrom.SelectedDate,
             DateTo   = DatePikerTo.SelectedDate
         });
         Console.WriteLine(App.SelectProvider.Mail);
         MailLogic.MailSend(new MailSendInfo
         {
             MailAddress = App.SelectProvider.Mail,
             Subject     = "Отчет по статусам",
             Text        = "Отчет по статусам от " + DatePikerFrom.SelectedDate.Value.ToShortDateString() + " по " + DatePikerTo.SelectedDate.Value.ToShortDateString(),
             FileName    = fileName
         });
         MessageBox.Show("Выполнено", "Успех", MessageBoxButton.OK,
                         MessageBoxImage.Information);
     }
     catch (Exception ex)
     {
         logger.Error("Ошибка создания .pdf : " + ex.Message);
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK,
                         MessageBoxImage.Error);
     }
 }
コード例 #21
0
        public static void Main()
        {
            var container = BuildUnityContainer();

            MailLogic.MailConfig(new MailConfig
            {
                SmtpClientHost = ConfigurationManager.AppSettings["SmtpClientHost"],
                SmtpClientPort = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpClientPort"]),
                MailLogin      = ConfigurationManager.AppSettings["MailLogin"],
                MailPassword   = ConfigurationManager.AppSettings["MailPassword"],
            });
            // создаем таймер
            var timer = new System.Threading.Timer(new TimerCallback(MailCheck), new MailCheckInfo
            {
                PopHost = ConfigurationManager.AppSettings["PopHost"],
                PopPort = Convert.ToInt32(ConfigurationManager.AppSettings["PopPort"]),
                Logic   = container.Resolve <IMessageInfoLogic>()
            }, 0, 10000);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(container.Resolve <FormMain>());
        }
コード例 #22
0
        private void ButtonSendToMail_Click(object sender, RoutedEventArgs e)
        {
            if (DatePickerFrom.SelectedDate >= DatePickerTo.SelectedDate)
            {
                MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            try
            {
                var fileName = "Отчет.pdf";

                logic.SaveTravelsExcursionsGuidesToPdf(new ReportTravelBindingModel
                {
                    FileName  = fileName,
                    DateFrom  = DatePickerFrom.SelectedDate,
                    DateTo    = DatePickerTo.SelectedDate,
                    TouristID = App.Tourist.ID
                }, App.Tourist.ID);

                MailLogic.MailSend(new MailSendInfo
                {
                    MailAddress = App.Tourist.Mail,
                    Subject     = "Отчет по путешествиям",
                    Text        = "Отчет по путешествиям от " + DatePickerFrom.SelectedDate.Value.ToShortDateString() + " по " + DatePickerTo.SelectedDate.Value.ToShortDateString(),
                    FileName    = fileName
                });
                MessageBox.Show("Выполнено", "Успех", MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                logger.Error("Ошибка отправки отчета: " + ex.Message);
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
コード例 #23
0
 public MailController(SurveyContext context)
 {
     _context = context;
     _logic   = new MailLogic(_context, () => this.Request);
 }
コード例 #24
0
        public string PayDeal()
        {
            string ret = "", ret1 = "", ret2 = "", ret3 = "", ret4 = "", ret5 = "", ret6 = "";

            string siteurl = SiteLogic.Config()["siteurl"];
            string retMsg = "";

            string authNUm = Order.CardAuthNum;
            string cardNumber = Order.CardToken, expMonth = "";
            int ReferenceNumber = 0, Validation_Result_Code = 0;
            clsZCreditWSSoapClient sc = new clsZCreditWSSoapClient();
            sc.CommitSimpleTransaction("2648414013", //TerminalNumber,  0963222014
                 "7351585986",    //Password, 0963222014
                 "",      //Track2,,
                 ref cardNumber,      //CardNumber,,
                 ref expMonth,    //ExpDate_MMYY,
                 (float)Order.GetGrandTotal(),     //TransactionSum,,
                 Order.CardHolderId,   //HolderID,,
                 "",     //CVV,,
                 false,    //IsCustomerPresent,,
                 ref authNUm,    //AuthNum,,
                 out Validation_Result_Code,    //Validation_Result_Code,
                 out ret,    //Validation_Result_Message,
                 out ret1,    //CardName,,
                 out ret2,    //CardIssuerCode,,
                 out ret3,    //CardFinancerCode,,
                 out ret4,    //CardBrandCode,,
                 out ReferenceNumber,    //ReferenceNumber,,
                 out ret5,    //VoucherNumber,,
                 out ret6);    //ApprovalType,

            if (Validation_Result_Code == 0)
            {
                Order.AdminComments = "AuthNum: " + authNUm + ", Validation_Result_Code: " + Validation_Result_Code + ", ReferenceNumber: " + ReferenceNumber;
                Order.StatusId = 6;
                MailLogic ml = new MailLogic();
                UsersLogic UsersLogic = new UsersLogic();
                User user = UsersLogic.FindByUserId(Order.UserId);
                Dictionary<string, string> Placeholders = new Dictionary<string, string>
                {
                    { "firstname", user.FirstName },
                    { "orderid", Order.OrdersId.ToString() }
                };
                ml.sendMailTemplate("SiteNotification", user.Email, Placeholders);
            }
            else
            {
                Order.AdminComments += " Validation_Result_Message: " + ret + ", AuthNum: " + ", Validation_Result_Code: " + Validation_Result_Code + ", ReferenceNumber: " + ReferenceNumber;
            }

            return ret;
        }
コード例 #25
0
        public ActionResult Save([Bind] Usuario usuario, long ddlRol, long?ddlEmpresa, bool?isMailCursoTerminado)
        {
            //Agrego el rol
            usuario.Rol = new Rol {
                EntityID = ddlRol
            };
            // -- Agrego Empresa
            usuario.Empresa = new Empresa {
                EntityID = ddlEmpresa.HasValue ? ddlEmpresa.Value : SessionManager.Get <Usuario>(Global.SessionsKeys.USER_SESSION).Empresa.EntityID
            };
            //indica si se le va a mandar un mail al usuario cada vez que un usuario de esa empresa finalice un curso
            usuario.IsMailCursoTerminado = isMailCursoTerminado.HasValue ? isMailCursoTerminado.Value : false;
            if (ModelState.IsValid)
            {
                // -- Encripto contrasena
                usuario.Password = Cryptography.Encrypt(usuario.Password);
                // Seteo activo
                usuario.Activo = true;
                //Si es un nuevo usuario
                if (usuario.EntityID == 0)
                {
                    //Seteo el nombre de uusario en minusculas
                    usuario.NombreUsuario = usuario.NombreUsuario.ToLower();
                    //Seteo si esta editando
                    ViewBag.isEditando = false;
                    //Seteo titulo
                    ViewBag.Title = "Crear Usuario";

                    if (usuario.NombreUsuario.Contains(" "))
                    {
                        //Seteo error
                        ModelState.AddModelError("NombreUsuario", "El nombre de usuario no puede contener espacios en blanco");
                    }
                    else if (logic.Add(usuario) == -99)//Si hay error al agregar
                    {
                        //Seteo selected rol
                        ViewBag.selectedddlRol = ddlRol;
                        //Seteo selected empresa
                        ViewBag.selectedddlEmpresa = ddlEmpresa;
                        //Seteo error
                        ModelState.AddModelError("NombreUsuario", "El nombre de usuario ya se encuentra en uso");
                    }
                    else
                    {
                        MailLogic mlog = new MailLogic();
                        mlog.EnviarEmail(usuario.EntityID, string.Empty, Global.MailsTypes.REGISTRO);
                        //Redirecciono al index si no hubo error
                        TempData["SaveSuccess"] = "Se guardó usuario correctamente";
                        return(RedirectToAction("Index"));
                    }
                }
                else
                {
                    //Actualizo usuario
                    logic.Update(usuario);
                    //Redirecciono al index si no hubo error
                    TempData["SaveSuccess"] = "Se guardó usuario correctamente";
                    return(RedirectToAction("Index"));
                }
            }
            if (usuario.EntityID == 0)
            {
                ViewBag.isEditando = false;
            }
            else
            {
                ViewBag.isEditando = true;
            }
            return(View(usuario));
        }
コード例 #26
0
ファイル: OrdersLogic.cs プロジェクト: johncoffee/eventblock
 public void SendOrderMail(Orders Order)
 {
     MailLogic MailLogic = new MailLogic();
     Dictionary<string, string> Placeholders = new Dictionary<string, string>
     {
         { "firstname", Order.FirstName },
         { "orderid", Order.OrdersId.ToString() },
         { "summary", LoadOrderSummary() }
     };
     MailLogic.sendMailTemplate("OrderComplete", Order.Email, Placeholders);
 }
コード例 #27
0
 private static void MailCheck(object obj)
 {
     MailLogic.MailCheck((MailCheckInfo)obj);
 }
コード例 #28
0
ファイル: UsersLogic.cs プロジェクト: johncoffee/eventblock
 public async Task<bool> SendResetPasswordMail(string Email)
 {
     if (string.IsNullOrEmpty(Email))
     {
         SiteLogic.AddError("Please enter email");
         return false;
     }
     User User = userManager.FindByEmail(Email);
     if (User != null)
     {
         var code = await userManager.GeneratePasswordResetTokenAsync(User.Id);
         Page page = HttpContext.Current.Handler as Page;
         var callbackUrl = HttpContext.Current.Request.GetFullVirtualPath("~/account/resetpassword", "id=" + HttpContext.Current.Server.UrlEncode(User.Id) + "&code=" + HttpContext.Current.Server.UrlEncode(code));
         MailLogic MailLogic = new MailLogic();
         Dictionary<string, string> Placeholders = new Dictionary<string, string>
         {
             { "firstname", User.FirstName },
             { "callbackurl", "<a href=\""+callbackUrl+"\">Reset link</a>" }
         };
         MailLogic.sendMailTemplate("ResetPassword", User.Email, Placeholders);
         //await userManager.SendEmailAsync(User.Id, "Reset Password",
         //"Please reset your password by clicking here: <a href=\"" + callbackUrl + "\">link</a>");
         return true;
     }
     return false;
 }