Imports System.Data Imports System.Web.Mail Imports System.IO Partial Class checkout3Ar Inherits System.Web.UI.Page Dim code1 As New SuperClass Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then ImageButton2.Attributes.Add("onClick", "return checkConfirm();") filluser() fillItem() fillDelivaryAddress() If Request.QueryString("ptype") = "0" Then rdoCash2.Checked = True ElseIf Request.QueryString("ptype") = "1" Then rdoCredit2.Checked = True ElseIf Request.QueryString("ptype") = "3" Then rdoKnet2.Checked = True ElseIf Request.QueryString("ptype") = "4" Then rdoBank2.Checked = True End If End If End Sub Sub filluser() Dim ods As New DataSet ods = code1.Select_user(Session("user")) If ods.Tables(0).Rows.Count > 0 Then 'Project_Color.BackColor = CType((ods.Tables(0).Rows(0).Item("cat_color") & ""), Color) 'Hidden2.Value = ods.Tables(0).Rows(0).Item("ulogo") & "" lblCustomerID.Text = ods.Tables(0).Rows(0).Item("id") & "" lblCustName.Text = ods.Tables(0).Rows(0).Item("nameen") & "" lblEmail.Text = ods.Tables(0).Rows(0).Item("uEmail") & "" lblCustPhone.Text = ods.Tables(0).Rows(0).Item("uphone") & " - " & ods.Tables(0).Rows(0).Item("umobile") End If End Sub Sub fillDelivaryAddress() Dim codeShop As New ShoppingCart Dim ods As New DataSet ods = codeShop.Selectorder(0, Session("user")) If ods.Tables(0).Rows.Count > 0 Then 'Project_Color.BackColor = CType((ods.Tables(0).Rows(0).Item("cat_color") & ""), Color) 'Hidden2.Value = ods.Tables(0).Rows(0).Item("ulogo") & "" lblDelPhone.Text = ods.Tables(0).Rows(0).Item("phone") & "" lblDelArea.Text = ods.Tables(0).Rows(0).Item("Area") & "" Label1.Text = ods.Tables(0).Rows(0).Item("block") & "" Label2.Text = ods.Tables(0).Rows(0).Item("street") & "" Label3.Text = ods.Tables(0).Rows(0).Item("house") & "" Label4.Text = ods.Tables(0).Rows(0).Item("floor") & "" Label5.Text = ods.Tables(0).Rows(0).Item("flat") & "" End If End Sub Sub fillItem() Dim codeShop As New ShoppingCart Dim ods As New DataSet ods = codeShop.SelectShoppingCart(0, Session("user")) grdItems.DataSource = ods grdItems.DataBind() ods.Dispose() ods = Nothing Dim totalP As Double = 0 Dim TotalDel As Double = 0 If grdItems.Items.Count > 0 Then For i As Integer = 0 To grdItems.Items.Count - 1 TotalDel = TotalDel + grdItems.Items(i).Cells(6).Text Next End If lblTotalDel.Text = TotalDel & " دك" If grdItems.Items.Count > 0 Then For i As Integer = 0 To grdItems.Items.Count - 1 totalP = totalP + CDbl(grdItems.Items.Item(i).Cells(0).Text) Next End If lblTotal.Text = "دك " & totalP.ToString("##0.000") lblTotalDel.Text = "دك " & TotalDel.ToString("##0.000") lblTotalOrder.Text = "دك " & (totalP + TotalDel).ToString("##0.000") End Sub Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click Dim pcode As New ShoppingCart pcode.PlaceOrder(Session("sid"), Session("user")) sendmail() Response.Redirect("checkout4ar.aspx?ptype=" & Request.QueryString("ptype")) End Sub Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Response.Redirect("MyshoppingCartar.aspx") End Sub Public Function isImage(ByVal strimgName As String, ByVal strimagFolder As String, ByVal ReWidth As Integer, ByVal ReHeight As Integer) As String Try If (strimgName = "") Or (strimgName = "no") Then Return "" End If Dim strwidth As String strwidth = "width='" Dim strheight As String strheight = "height='" Dim fileHeight, fileWidth As Integer fileHeight = 0 fileWidth = 0 Dim Fs As FileStream Fs = New FileStream(MapPath(strimagFolder & strimgName), FileMode.Open, FileAccess.Read, FileShare.Read) Dim image As System.Drawing.Image image = System.Drawing.Image.FromStream(Fs) fileWidth = image.Width fileHeight = image.Height Fs.Close() Fs = Nothing If (fileWidth > ReWidth) Or (fileHeight > ReHeight) Then If (fileWidth > fileHeight) Then Dim wL, hL As Integer wL = ReWidth hL = (wL * fileHeight) / fileWidth strwidth = strwidth & wL & "'" strheight = strheight & hL & "'" Else Dim wL, hL As Integer hL = ReHeight wL = (hL * fileWidth) / fileHeight strwidth = CStr(strwidth & wL & "'") strheight = strheight & hL & "'" End If Else strwidth = strwidth & fileWidth & "'" strheight = strheight & fileHeight & "'" End If Return "" Catch Return "" End Try End Function Sub sendmail() Dim spCode As New SuperClass Dim objEmail As New MailMessage objEmail.To = spCode.select_Emailcontact() ' Response.Write(spCode.select_Emailcontact()) objEmail.From = "reservation@palazzo-kw.com" objEmail.Subject = "New Reservation" Dim bd As String bd = "" bd &= "الاسم : " & lblCustName.Text & "
" bd &= "الايميل : " & lblEmail.Text & "
" bd &= "الهاتف : " & lblCustPhone.Text & "
" bd &= "ملاحظة: " & "
" bd &= "لديك حجز من قبل لبعنيل السالف ذكره, يرجى متابعت الطلب من خلال لوحة التحكم" bd &= "" objEmail.Body = bd objEmail.BodyEncoding = System.Text.Encoding.GetEncoding("windows-1256") objEmail.BodyFormat = MailFormat.Html objEmail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objEmail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "webmaster@palazzo-kw.com" objEmail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "webmaster@123" SmtpMail.SmtpServer = "mail.palazzo-kw.com" Try SmtpMail.Send(objEmail) Catch exc As Exception End Try End Sub End Class