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).Delete(); GridView1.DataSource = ds.tSells; GridView1.DataBind(); Session["ds"] = ds; } catch { } }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { String CodePro = GridView2.SelectedValue.ToString(); DstSells ds = null; try { ds = (DstSells)Session["ds"]; } catch {} System.Data.DataRow row; try { row = ds.tSells.NewRow(); } catch { ds = new DstSells(); row = ds.tSells.NewRow(); } row[ds.tSells.fCodeProductColumn] = CodePro; try { row[ds.tSells.fCodeUserColumn] = Session["ID"].ToString(); } catch { Label7.Text = "کنید Login لطفا برای خرید کالا"; return; } row[ds.tSells.fDateColumn] = BijanComponents.ShamsiDate.GetShamsiDate(DateTime.Now); ds.tSells.Rows.Add(row); Session["ds"] = ds; LinkButton3.Visible = true; lbOk.Text = "کالای انتخاب شده به سبد خرید شما اضافه شد"; }
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("Default.aspx"); } } }