using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Ajax_AJAXcart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = CDatabase.wtoconn();
        switch (Request.QueryString["type"].ToString().Trim())
        { 
            case "s":
                conn.Open();
                SqlCommand smd1 = new SqlCommand("select DefrayExpenses,GuaranteesPrice from PWway where id=" + Request.QueryString["cartid"].ToString().Trim(), conn);
                SqlDataReader sdr1 = smd1.ExecuteReader();
                sdr1.Read();
                Response.Write(Convert.ToString(sdr1.GetDecimal(0).ToString("0.00"))+"$"+Convert.ToString(sdr1.GetDecimal(1).ToString("0.00"))+"$"+Request.QueryString["T"].ToString());
                sdr1.Close();
                conn.Close();
                break;
            case "p":
                conn.Open();
                SqlCommand smd2 = new SqlCommand("select Payment from Payway where id=" + Request.QueryString["cartid"].ToString().Trim(), conn);
                SqlDataReader sdr2 = smd2.ExecuteReader();
                sdr2.Read();
                Response.Write(Convert.ToString(sdr2.GetDecimal(0).ToString("0.00"))+"$"+Request.QueryString["T"]);
                sdr2.Close();
                conn.Close();
                break;
        }
    }
}
