protected void LinkButton1_Click(object sender, EventArgs e) { string sql = "select top 1 * from Place where Places='" + DropDownList1.SelectedItem.Text.ToString().Trim() + "'"; PlaceInfoBLL bll = new PlaceInfoBLL(); int id = int.Parse(bll.GetPlaceID(sql).ToString().Trim()); //string title = Context.Request["title"].ToString().Trim(); //string txtintroduction = Context.Request["txtintroduction"].ToString().Trim(); string Introduce = Context.Request["introduce"].ToString().Trim(); string dir = ""; //try //{ if (Directory.Exists(Server.MapPath("images/place/" + DropDownList1.SelectedItem.Text)) == false) { //创建用户的文件夹 Directory.CreateDirectory(Server.MapPath("images/place/" + DropDownList1.SelectedItem.Text)); } if (FileUpload2.HasFile) { dir = Server.MapPath("/images/place/" + DropDownList1.SelectedItem.Text + "/"); if (File.Exists(dir + FileUpload2.FileName)) { Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('文件已存在!')", true); return; } FileUpload2.SaveAs(dir + FileUpload2.FileName); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('请选择要上传的文件!')", true); return; } placeInfo p = new placeInfo(); p.PlaceID = id; p.Image = "/place/" + DropDownList1.SelectedItem.Text + "/" + FileUpload2.FileName; p.Title = title.Text; p.Introduction = txtintroduction.Text; p.Introduce = Introduce; bll.AddPlaceInfo(p); Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('数据提交成功!')", true); //title.Text = ""; //txtintroduction.Text = ""; //Editor.Text = ""; //} //catch (Exception ee) //{ // Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('数据提交失败!')", true); //} }
private IEnumerator GetHalligan() { using (UnityWebRequest uwr = UnityWebRequest.Get(halliganURL)) { yield return(uwr.SendWebRequest()); if (uwr.isNetworkError || uwr.isHttpError) { Debug.Log(uwr.error); } else { var data = uwr.downloadHandler.text; Debug.Log(data); Halligan = JsonUtility.FromJson <placeInfo>(data); Debug.Log("Success!"); } } }
public void AddPlaceInfo(placeInfo p) { string sql = "select top 1 * from PlaceInfo"; DataSet ds = db.GetDataSet(sql); DataRow dr = ds.Tables[0].NewRow(); dr["PlaceID"] = p.PlaceID; dr["image"] = p.Image; dr["title"] = p.Title; dr["Introduction"] = p.Introduction; //dr["Price"] = p.Price; dr["Introduce"] = p.Introduce; //dr["Location"] = p.Location; //dr["Traffic"] = p.Traffic; //dr["Surrounding"] = p.Surrounding; //dr["Information"] = p.Information; //dr["Amenities"] = p.Amenities; //dr["Fee"] = p.Fee; //dr["Tip"] = p.Tip; ds.Tables[0].Rows.Add(dr); db.UpdateDataset(sql, ds); }
public void AddPlaceInfo(placeInfo p) { dal.AddPlaceInfo(p); }