//SQLiteConnection sqlconnection = new SQLiteConnection(@"Data Source=.\Data.db;Initial Catalog=T_Company;Persist Security Info=True;"); public AboutModel GetAboutMode() { AboutModel aboutmodel = new AboutModel(); string DeviceId = System.Configuration.ConfigurationManager.AppSettings["DeviceId"]; string sql = "select FilePath,Content,Phone,WebSit,Address,BusRoute from B_PropertyIntroduce where DeviceId="+DeviceId; DataSet ds = SQLiteHelper.Query(sql); if (ds.Tables[0].Rows.Count > 0) { aboutmodel.AboutImage = ds.Tables[0].Rows[0]["FilePath"].ToString(); aboutmodel.AboutContent = ds.Tables[0].Rows[0]["Content"].ToString(); aboutmodel.AboutTelephone = ds.Tables[0].Rows[0]["Phone"].ToString(); aboutmodel.AboutInternet = ds.Tables[0].Rows[0]["WebSit"].ToString(); aboutmodel.AboutAdress = ds.Tables[0].Rows[0]["Address"].ToString(); aboutmodel.AboutBus = ds.Tables[0].Rows[0]["BusRoute"].ToString(); } return aboutmodel; }
private void InitUI() { AboutModel aboutmodel = new AboutModel(); aboutmodel = bl.GetAboutMode(); this.txt_Content.Text=aboutmodel.AboutContent; this.txt_Telephone.Text=aboutmodel.AboutTelephone; this.txt_Internet.Text=aboutmodel.AboutInternet; this.txt_Adress.Text=aboutmodel.AboutAdress; this.txt_Bus.Text = aboutmodel.AboutBus; string internalResourcePath = Directory.GetCurrentDirectory();//保存当前目录 //string path = internalResourcePath + @"\Resources\"+aboutmodel.AboutImage; string path= "http://222.73.236.182:10023" + aboutmodel.AboutImage; //if (File.Exists(path)) //{ // this.Picture.Source = new BitmapImage(new Uri(path, UriKind.Absolute)); //} this.Picture.Source = new BitmapImage(new Uri(path, UriKind.Absolute)); }