private void ButtonAdd_OnClick(object sender, RoutedEventArgs e) { if (!CheckInput()) { return; } android_update android = new android_update(); android.create_time = HelpFunction.ConvertToTimestamp(DateTime.Now); android.update_intro = this.TextIntro.HtmlContent; android.update_url = this.TextUrl.GetUrl(); android.version_no = this.TextBoxVersionNo.Text; android.version_id = this.TextBoxVersionId.Value ?? 0; bool bl = AndroidMgr.Instance.SaveAndroidApk(android); if (bl) { MessageBox.Show("保存成功"); this.DialogResult = true; } else { MessageBox.Show("保存失败"); this.DialogResult = false; } }
public bool SaveAndroidApk(android_update android) { using (userEntities userEntities = new userEntities()) { try { userEntities.android_update.Add(android); int iRent = userEntities.SaveChanges(); return(iRent > 0); } catch (Exception ex) { Trace.WriteLine(ex); } } return(false); }