Exemple #1
0
 public void TestMembershipEmail()
 {
     payment   = PaymentFactory.GetPayment(PaymentTypeEnum.Membership);
     email     = payment as IEmail;
     returnMsg = email.SendMail();
     Assert.AreEqual(returnMsg, "Membership Email");
 }
Exemple #2
0
 public void TestUpgradeEmail()
 {
     payment   = PaymentFactory.GetPayment(PaymentTypeEnum.Upgrade);
     email     = payment as IEmail;
     returnMsg = email.SendMail();
     Assert.AreEqual(returnMsg, "Upgrade Email");
 }
Exemple #3
0
        static void Main(string[] args)
        {
            CellPhone cp = new CellPhone("*****@*****.**", "090-1234-5678");

            cp.Call("011-123-4567");
            cp.SendMail("*****@*****.**");
            IPhone Phone = (IPhone)cp;

            Phone.Call("011-987-6543");
            IEmail mail = (IEmail)cp;

            mail.SendMail("*****@*****.**");
        }
Exemple #4
0
        public static void SendMail(object sender, ApproveEventArgs args)
        {
            IEmail email = ctx["Email"] as IEmail;
            IFlow  flow  = ctx["Flow"] as IFlow;

            string        title;
            StringBuilder content = new StringBuilder();
            string        link    = string.Format(@"<a href='#' style='cursor:hand' onclick=Open('/WorkFlow/TraceView/?flowNo={0}&flowId={1}&flowInstId={2}&url={3}&isInner={4}')><u>表单号:{5}</u></a>", args.FlowNo,
                                                  args.FlowId,
                                                  args.FlowInstId,
                                                  args.Url,
                                                  args.IsInner,
                                                  args.FlowNo);


            if (args.AppValue == "Y")
            {
                title = string.Format("{0}(表单号:{1})已经审核通过", args.FlowName,
                                      args.FlowNo);


                content.Append("<html><meta http-equiv='content-type' content='text/html; charset=gb2312' /><body>");
                content.AppendFormat("您于{0}申请的{1}({2})已经审核通过。",
                                     args.BeginDate.ToString("yyyy/MM/dd HH:mm"),
                                     args.FlowName,
                                     link);
            }
            else
            {
                title = string.Format("{0}(表单号:{1})被否决", args.FlowName, args.FlowNo);

                content.AppendFormat("您于{0}申请的{1}({2})已经被否决。",
                                     args.BeginDate.ToString("yyyy/MM/dd HH:mm"),
                                     args.FlowName,
                                     link);
            }

            //content.Append("<BR><table cellspace='1' style='width:350px;' id='tablehelp'>");
            //content.Append("<tr><td><b>签核记录:</b></td><td>");
            content.AppendLine("<br>");
            content.AppendLine(flow.TaskListScript(args.FlowInstId));
            //content.Append("</td></tr></table></body><html>");

            email.SendMail(title, content.ToString(), args.ApplyerId.ToString(), false);

            //if (!email.SendMail(title, content.ToString(), args.ApplyerId.ToString(), false))
            //{
            //    throw new Exception(string.Format("邮件发送失败:flowId{0},flowNo{1},AppValue{2}", args.FlowId, args.FlowNo, args.AppValue));
            //}
        }
Exemple #5
0
        static void Main(string[] args)
        {
            CellPhone cp = new CellPhone("*****@*****.**", "000-000-1234");

            // 携帯電話クラスで、電話とメールを実行
            cp.Call("001-001-1234");
            cp.SendMail("*****@*****.**");
            // 電話インターフェ-スでインスタンスにアクセス
            // あるクラス(CellPoneクラス)を、ベースクラスやインターフェース(IPhone)の型に代入するときはキャストを利用
            // キャスト(IPhone)をつけて代入することで、CellPhoneクラスを架空のIPhoneクラスとして振舞うことができる
            IPhone phone = (IPhone)cp;

            phone.Call("002-002-1234");
            // メールインターフェースでインスタンスにアクセス
            IEmail mail = (IEmail)cp;

            mail.SendMail("*****@*****.**");
        }
Exemple #6
0
        /// <summary>
        /// Get a Course Subscription in Async Queue With Azure Service Bus
        /// </summary>
        /// <returns>Task</returns>
        public Course ProcessCourseSubscribeTask()
        {
            try
            {
                CourseBUS courseServiceBus = new CourseBUS();
                var       message          = courseServiceBus.ProcessCourseSubscriptionQueue();
                var       course           = JsonConvert.DeserializeObject <Course>(Encoding.UTF8.GetString(message.Result.Body));
                _courseEmail = new SMTPProvider();
                _courseEmail.SendMail(new Email.Email());
                return(CourseSubscription(course));
            }
            catch (Exception e)
            {
                //TODO: IMPLEMENT ERROR ANT TREAMENT
                Console.WriteLine(e);
                throw;
            }

            //return CourseSubscription(course);
        }
Exemple #7
0
        static void Main(string[] args)
        {
            CellPhone cp = new CellPhone("*****@*****.**", "090-1234-5678");

            //携帯電話クラスで電話とメールを送る
            cp.Call("011-123-4567");
            cp.SendMail("*****@*****.**");
            //電話インターフェースでインスタンスにアクセス
            IPhone phone = (IPhone)cp;

            phone.Call("011-987-6543"); //電話をかける
            //メールの送信メソッドは利用できない
            //phone.SendMail("*****@*****.**");
            //メールインターフェースでインスタンスにアクセス
            IEmail mail = (IEmail)cp;

            mail.SendMail("*****@*****.**");     //メールを出す
            //mailインターフェースでは電話の機能を利用できない
            //mail.Call("011-222-3333");
        }
Exemple #8
0
        public void SendEmail1()
        {
            var builder = new ConfigurationBuilder()
                          .AddConfigurationFile("Email.json", optional: true, reloadOnChange: true);

            builder.Build();
            var cb = new ContainerBuilder();

            cb.AddEmail();
            IEmail mail = cb.Build().Resolve <IEmail>();

            Assert.IsNotNull(mail);
            mail.SendMail("*****@*****.**", "单TO无CC", "测试邮件");
            mail.SendMail("*****@*****.**", "*****@*****.**", "单TO单CC", "测试邮件");
            mail.SendMail("*****@*****.**", "[email protected];[email protected]", "单TO多CC", "测试邮件");
            mail.SendMail("[email protected];[email protected]", "多TO无CC", "测试邮件");
            mail.SendMail("[email protected];[email protected]", "*****@*****.**", "多TO单CC", "测试邮件");
            mail.SendMail("[email protected];[email protected]", "[email protected];[email protected]", "多TO多CC", "测试邮件");
        }
Exemple #9
0
        public void main()
        {
            Console.Write("OverLoad?:");
            bool OL = bool.Parse(Console.ReadLine());

            if (!OL)
            {
                Console.WriteLine("Normal:1\nPrivate:2\nNoField:3\nConstruct:4\nDestruct:5\nStatic:6\nInheritance:7\nAbstruct:8\nInterface:9");
                int sw = int.Parse(Console.ReadLine());
                switch (sw)
                {
                case 1:
                    Person p1, p2, p3;
                    p1 = new Person();
                    p2 = new Person();
                    p3 = new Person();

                    p1.name = "モリモリ武蔵";
                    p1.age  = 353;

                    p2.SetInformation("コリコリ羽子田", 13);

                    p3.SetInformation2();

                    p1.ShowInformation();
                    p2.ShowInformation();
                    p3.ShowInformation();
                    break;

                case 2:
                    PersonPrivate pp1, pp2;
                    pp1 = new PersonPrivate();
                    pp2 = new PersonPrivate();

                    pp1.SetInformation("室町幕府", 1699);

                    Console.WriteLine("Please Input 2 times that{Name → Age}");
                    pp2.Name = Console.ReadLine();
                    pp2.Age  = int.Parse(Console.ReadLine());

                    pp1.ShowInformation();
                    Console.WriteLine($"名前:{pp2.Name} 年齢:{pp2.Age}");
                    break;

                case 3:
                    PersonNoFields pn;
                    pn = new PersonNoFields();

                    pn.SetInformation("轟京子", 15);
                    pn.ShowInformation();

                    Console.Write($"Please True Age:");
                    pn.Age = int.Parse(Console.ReadLine());
                    //Nameへの代入はできない

                    pn.ShowInformation();

                    break;

                case 4:
                    PersonConstruct pc1, pc2;
                    pc1 = new PersonConstruct();
                    pc2 = new PersonConstruct("よろしくお願いしまスエゾー", 21);

                    Console.Write("名前:");
                    pc1.Name = Console.ReadLine();
                    Console.Write("年齢:");
                    pc1.Age = int.Parse(Console.ReadLine());

                    Console.WriteLine($"名前:{pc1.Name} 年齢:{pc1.Age}");
                    pc2.ShowInformation();
                    break;

                case 5:
                    Destruct d = new Destruct();
                    Console.ReadLine();
                    break;

                case 6:
                    //Staticクラス(インスタンスを入れる箱)を5つ作る
                    Static[] S = new Static[5];
                    //Staticのインスタンスの数を表示
                    Static.ShowNumber();
                    //Staticクラスのインスタンスを生成
                    for (int i = 0; i < S.Length; i++)
                    {
                        //Dataのインスタンスを生成
                        S[i] = new Static(i * 64);
                        //Dataのインスタンスの数を表示
                        Static.ShowNumber();
                    }

                    break;

                case 7:
                    Console.Write("計算する数を入力してください:");
                    int count = int.Parse(Console.ReadLine());
                    //親クラスCalculatorのインスタンスを生成
                    Calculator C = new Calculator(count);
                    //親クラスの足し算の合計を表示
                    C.sum();

                    //継承クラスExCalculatorのインスタンスを生成
                    ExCalculator EC = new ExCalculator(count);
                    //継承クラスの掛け算の合計を表示
                    EC.mul();

                    Console.WriteLine("階乗を計算する値を入力してください");
                    EC.SetInformation(1);
                    //継承クラスの階乗を表示
                    EC.mul();

                    break;

                case 8:
                    //抽象クラスはインスタンスを生成できない→サブクラスのインスタンスを生成する
                    //抽象クラスを配列に複製することは出来る
                    Bird[] b = new Bird[2];
                    b[0] = new Crow();
                    b[1] = new Sparrow();
                    for (int i = 0; i < b.Length; i++)
                    {
                        Console.Write($"{b[i].Name}「");
                        b[i].Sing();
                        Console.WriteLine("」");
                    }

                    //抽象クラスには抽象メソッドだけでなく抽象プロパティも設定できる
                    VectorNormal VN = new VectorNormal();
                    Console.WriteLine("x,y 座標を入力してください");
                    Console.Write("X:");
                    VN.X = double.Parse(Console.ReadLine());
                    Console.Write("Y:");
                    VN.Y = double.Parse(Console.ReadLine());
                    Console.WriteLine($"座標({VN.X},{VN.Y})が入力されました");
                    VN.Polar();
                    break;

                case 9:
                    CellPhone CP = new CellPhone("*****@*****.**", "012-3456-7890");
                    //CellPhoneクラスから直接メソッドを使用
                    CP.Call("098-7654-3210");
                    CP.SendMail("*****@*****.**");

                    //CellPhoneインスタンスを各インタフェース変数にキャスト
                    //→インタフェースの機能のみ使用できるように制限できる
                    IEmail mail  = (IEmail)CP;
                    IPhone phone = (IPhone)CP;

                    //mailインタフェースでCellPhoneインスタンスにアクセス
                    mail.SendMail("*****@*****.**");
                    //phoneインタフェースでCellPhoneインスタンスにアクセス
                    phone.Call("019-2938-4756");

                    break;
                }
            }
            else
            {
                Calc  calc  = new Calc();
                Split split = new Split();
                int[] num   = new int[3];

                Console.WriteLine($"Input {num.Length} values ad {{a_b_c}}");
                num = split.main(Console.ReadLine());

                int    a = num[0], b = num[1], c = num[2];
                int    ans1 = calc.ave(a, b);
                int    ans2 = calc.ave(a, b, c);
                double ans3 = calc.ave((double)a, (double)b, (double)c);

                Console.WriteLine($"(a+b)/2 = {ans1}");
                Console.WriteLine($"(a+b+c)/3 = {ans2}");
                Console.WriteLine($"(double) (a+b+c)/3 = {ans3}");
            }
        }
Exemple #10
0
 public Result SendMail(EmailInfo info)
 {
     return(_email.SendMail(info));
 }