PDA

View Full Version : سوال: سبد خرید کالا



فاطمه ک
دوشنبه 29 تیر 1394, 12:30 عصر
باعرض سلام وخسته نباشید
این قطعه کد رو باکلی جستجو و جابه جایی پیداکرده ام داخل ویژوال استودیو زدم برای سبد خرید کالا کاملا جواب میده فکر میکنم واسه سایر دوستان هم مفید باشه
منتها نمیدونم خط به خط دستور واسه چی به کارمیره ،از استادان گرامی خواهش میکنم راهنماییم کنن که متوجه شم .:گریه::عصبانی++:




protected void btnAccept_Click(object sender, EventArgs e)
{
DstSells ds=new DstSells();
ds = (DstSells)Session["ds"];
DstSellsTableAdapters.tSellsTableAdapter sda = new DstSellsTableAdapters.tSellsTableAdapter();
for (int i = 0; i < ds.tSells.Rows.Count; i++)
{
ds.tSells.Rows[i][ds.tSells.fFishNumberColumn] = txtFish.Text.Trim();
ds.tSells.Rows[i][ds.tSells.fBankNameColumn] = RadioButtonList1.SelectedValue.ToString();

}
sda.Update(ds);
Session["ds"]="";
Response.Redirect("Tanx.aspx");
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
tProductsTableAdapter sdaProduct=new tProductsTableAdapter();
DstSells ds=new DstSells();
ds = (DstSells)Session["ds"];
ds.tSells.Rows.Find(GridView1.SelectedValue).Delet e();
GridView1.DataSource=ds.tSells;
GridView1.DataBind();
Session["ds"]=ds;
}
catch
{ }
}
protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
try
{
tProductsTableAdapter sdaProduct = new tProductsTableAdapter();
DstSells ds = new DstSells();
ds = (DstSells)Session["ds"];
GridView1.DataSource = ds.tSells;

for (int i=0;i<ds.tSells.Rows.Count;i++)
{
ds.tSells.Rows[i][ds.tSells.fNameProductColumn] = sdaProduct.GetNameByCode(int.Parse(ds.tSells.Rows[i][ds.tSells.fCodeProductColumn].ToString()));
ds.tSells.Rows[i][ds.tSells.fPriceColumn] = sdaProduct.GetPriceByCode(int.Parse( ds.tSells.Rows[i][ds.tSells.fCodeProductColumn].ToString()));
}
GridView1.DataBind();
}
catch
{
Response.Redirect("safhe asli1.aspx");
}

}