Exemple #1
0
    public static void SendEmailReceiveToStaff(object param)
    {
        object[]      parameters = (object[])param;
        string        staffmail  = (string)parameters[0];
        Model_Setting s          = (Model_Setting)parameters[1];
        HttpContext   context    = (HttpContext)parameters[2];


        Model_OrderPaymentTransferConfirm con = (Model_OrderPaymentTransferConfirm)parameters[3];
        int    intProductID = (int)parameters[4];
        string body         = string.Empty;
        string text         = "";

        if (intProductID == 1)
        {
            text = File.ReadAllText(context.Server.MapPath("/Theme/emailtemplate/layout_r3.html"), Encoding.UTF8);
        }

        if (intProductID == 2)
        {
            text = File.ReadAllText(context.Server.MapPath("/Theme/emailtemplate/layout_coaching.html"), Encoding.UTF8);
        }
        //if (!string.IsNullOrEmpty(text))
        //{
        //    string path = ConfigurationManager.AppSettings["AuthorizeBaseURL"].ToString().Replace("/admin", "") + "Verify?ID=" + StringUtility.EncryptedData(user.UserID.ToString());
        //    body = text.Replace("<!--##@Linkverfiy##-->", "<a href=\"" + path + "\" />here</a>");
        //}


        body = "FirstName : " + con.Name + "\r\n";
        body = body + "email : " + con.Email + "\r\n";
        body = body + "datetime : " + con.DatePayment.ToThaiDateTime() + "\r\n";


        List <MailSenderFileAtt> list = new List <MailSenderFileAtt>
        {
            new MailSenderFileAtt
            {
                FileName = "",
                Path     = con.FilePath
            }
        };

        foreach (string email in staffmail.Split(';'))
        {
            MailSenderOption option = new MailSenderOption
            {
                MailSetting = s,
                context     = HttpContext.Current,
                mailTo      = email,
                Mailbody    = body,
                Attachment  = list,
                Subject     = "[Keen Staff] การชำระค่าบริการเสร็จสมบูรณ์แล้ว / Success Payment Confirmation [Confirmed Order#" + con.OrderID + "]"
            };
            MAilSender.SendMailEngine(option);
        }
    }
Exemple #2
0
    public static int ConfirmTransferPayment(int OrderID, Model_Users u, Model_OrderPaymentTransferConfirm con, int intProductID)
    {
        int ret = 0;

        try {
            Model_OrderPayment        payment     = new Model_OrderPayment();
            List <Model_OrderPayment> listpayment = payment.getPaymentByOrderID(con.OrderID);
            if (listpayment.Count > 0)
            {
                var total = listpayment.Sum(o => o.Amount);

                var PaymentID = listpayment.FirstOrDefault().PaymentID;


                if (con.Amount >= total)
                {
                    con.PaymentID = PaymentID;

                    if (con.InsertOrderPaymentTransferConfirm(con) > 0)
                    {
                        payment.UpdatePayment(PaymentID);

                        //Update user to Paid;
                        u.Ispaid = true;
                        UsersController.UpdateIsPaidUser(u);

                        Model_Setting s = new Model_Setting();
                        s = s.GetSetting();



                        HttpContext context = HttpContext.Current;

                        object[] parameters = new object[] { u, s, context, intProductID };
                        SendingEngineController.cpool.QueueWork(parameters, SendEmaiReceiveToCustomer);

                        string   staffEmail  = "[email protected];[email protected];[email protected]";
                        object[] parameters2 = new object[] { staffEmail, s, context, con, intProductID };

                        SendingEngineController.cpool.QueueWork(parameters2, SendEmailReceiveToStaff);
                    }
                }
            }



            ret = 1;
        } catch
        {
        }

        return(ret);
    }
Exemple #3
0
    protected void btn_confirm_Click(object sender, EventArgs e)
    {
        Model_Users u = this.UserActive;

        string orderID = Request.QueryString["orderID"];

        int    intOrderID = int.Parse(orderID);
        string Filename   = orderID + ".jpg";

        DirectoryInfo fdr = new DirectoryInfo(Server.MapPath("/orderconfirmfile/"));

        if (!fdr.Exists)
        {
            fdr.Create();
        }

        string FilePath = "/orderconfirmfile/" + Filename;

        string DAteconfirm = hd_date_payment.Value;

        string[] arrdatetime = DAteconfirm.Split('-');
        DateTime dpay        = new DateTime(int.Parse(arrdatetime[0]), int.Parse(arrdatetime[1]), int.Parse(arrdatetime[2]), int.Parse(arrdatetime[3]), int.Parse(arrdatetime[4]), int.Parse(arrdatetime[5])).ToUniversalTime();
        Model_OrderPaymentTransferConfirm con = new Model_OrderPaymentTransferConfirm
        {
            Name        = firstName.Text.Trim(),
            Email       = email.Text.Trim(),
            DatePayment = dpay,
            Amount      = decimal.Parse(amount.Text),
            Phone       = txtPhone.Text,
            Extra       = txtextra.Text,
            FilePath    = FilePath,
            OrderID     = intOrderID,
            GateWayID   = byte.Parse(dropgatway.SelectedValue),
            BankIssue   = functionBakIssue(byte.Parse(dropgatway.SelectedValue))
        };
        int intProductID = int.Parse(Request.QueryString["ProductID"]);

        int ret = OrderController.ConfirmTransferPayment(intOrderID, u, con, intProductID);

        if (ret > 0)
        {
            if (file.HasFile)
            {
                file.PostedFile.SaveAs(HttpContext.Current.Server.MapPath(FilePath));
            }

            Response.Redirect("~/Thankyou?Con=firm&OrderID=" + orderID + "&ProductID=" + intProductID);
        }
    }