public int Post(orderform model) { using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Sqlconn"].ToString())) { return(conn.Execute($"update orderform set orderform.OF_site='{model.OF_site}' where OF_Id={model.OF_Id}")); } }
public int Post(orderform model) { using (SqlConnection conn = new SqlConnection(Mysql)) { return(conn.Execute($"update orderform set orderform.OF_status='{model.OF_status}' where OF_Id={model.OF_Id}")); } }
protected void Button3_Click(object sender, EventArgs e) { if (TextBox2.Text.Length != 0) { Session["memberid"] = TextBox2.Text.ToString(); } else { Session["memberid"] = "00000"; } int flag = 0; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1"); if (cbox.Checked == true) { flag++; //Response.Write(GridView1.DataKeys[i].Value.ToString()); //TextBox2.Text += GridView1.DataKeys[i].Value.ToString(); DataClassesDataContext data = new DataClassesDataContext("Data Source=.;Initial Catalog=DSMS;Integrated Security=True"); /////////////////////////////////////////////// var exist = from orderform1 in data.orderform where orderform1.orderformid == Session["orderformid"].ToString() select orderform1; if (flag == 1 && exist.Count() == 0) { orderform form = new orderform(); form.orderformid = Session["orderformid"].ToString(); form.stuffid = Session["stuffid"].ToString(); form.drugstoreid = Session["drugstoreid"].ToString(); if (TextBox2.Text.Length != 0) { form.memberid = TextBox2.Text.ToString(); } else { form.memberid = "00000"; } form.saletime = DateTime.Now; form.totalmoney = 0; data.orderform.InsertOnSubmit(form); data.SubmitChanges(); } ///////////////////////////////////////// orderDetails de = new orderDetails(); de.datailid = Session["detailid"].ToString(); //de.datailid = "111"; // de.orderformid = Session["orderformid"].ToString(); de.orderformid = Session["orderformid"].ToString(); de.drugid = GridView1.DataKeys[i].Value.ToString(); de.discount = 1; de.drugnumber = 1; data.orderDetails.InsertOnSubmit(de); data.SubmitChanges(); } } Response.Redirect("OrderDetails.aspx"); }