public bool InsertShippingDetail(Model.ShippingDetail sd) { SqlConnection con = new SqlConnection(SqlCon.constring); con.Open(); SqlCommand cmd = new SqlCommand("insert into shipping_details values(@ship_id,@uid,@cart_id,@address,@name,@contact,@email)", con); cmd.Parameters.AddWithValue("@ship_id", sd.Ship_id); cmd.Parameters.AddWithValue("@uid", sd.Uid); cmd.Parameters.AddWithValue("@cart_id", sd.Ship_id); cmd.Parameters.AddWithValue("@address", sd.Shipping_address); cmd.Parameters.AddWithValue("@name", sd.Name); cmd.Parameters.AddWithValue("@contact", sd.Contact); cmd.Parameters.AddWithValue("@email", sd.Email); int cnt = cmd.ExecuteNonQuery(); con.Close(); if (cnt > 0) { return(true); } else { return(false); } }
public bool ShippingValidate(Model.ShippingDetail sd) { DAO.ShippingDetail dsd = new DAO.ShippingDetail(); bool status = false; if (sd.Ship_id != 0 && sd.Uid != 0 && sd.Cart_id != 0 && sd.Contact != null && sd.Name != null && sd.Email != null) { status = dsd.InsertShippingDetail(sd); } return(status); }
public Model.ShippingDetail GetShippingDetailByPaymentId(int paymentid) { SqlConnection con = new SqlConnection(SqlCon.constring); SqlDataAdapter da = new SqlDataAdapter("select * from shipping_details where ship_id in (select ship_id from payment_details where payment_id=" + paymentid + ")", con); DataSet shipset = new DataSet(); da.Fill(shipset, "Shipping"); Model.ShippingDetail sd = new Model.ShippingDetail(); sd.Cart_id = int.Parse(shipset.Tables["Shipping"].Rows[0][2].ToString()); sd.Uid = int.Parse(shipset.Tables["Shipping"].Rows[0][1].ToString()); sd.Shipping_address = shipset.Tables["Shipping"].Rows[0][3].ToString(); sd.Name = shipset.Tables["Shipping"].Rows[0][4].ToString(); sd.Contact = shipset.Tables["Shipping"].Rows[0][5].ToString(); sd.Email = shipset.Tables["Shipping"].Rows[0][6].ToString(); return(sd); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["shipid"] == null | Session["TotalAmount"] == null) { Response.Redirect("~/AccessDenied.aspx"); } int uid = int.Parse(Session["UserId"].ToString()); int cart_id = int.Parse(Session["CartId"].ToString()); BindView(uid, cart_id); Model.ShippingDetail sd = sdd.GetShippingDetail(int.Parse(Request.QueryString["shipid"].ToString())); Name.InnerHtml = sd.Name; Contact.InnerHtml = sd.Contact; Email.InnerHtml = sd.Email; Address.InnerHtml = sd.Shipping_address; amount.InnerHtml = string.Format("₹{0:F2}", double.Parse(Session["TotalAmount"].ToString())); }