private void btnNext_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { if (!reload) { File.Copy("_db.db", "Manifest.db", true); } //if(!File.Exists("Manifest.db")) //{ // File.Copy("_db.db", "Manifest.db"); //} SettingViewModel setMode = new SettingViewModel { ID = 1, Ver = int.Parse(System.Reflection.Assembly.GetEntryAssembly().GetName().Version.Build.ToString()), Mode = mode }; Setting.Update(setMode); } catch (Exception) { MessageBox.Show("عملیات ایجاد مانیفست با مشکل مواجه شد. با پشتیبانی تماس بگیرید"); } Hide(); new Form3(mode).ShowDialog(); Show(); }
public static bool Insert(SettingViewModel _set) { try { using (IDbConnection db = new SQLiteConnection(DataAccess.GetConnectionString())) { string query = "INSERT INTO Setting (ID, Ver, Mode) VALUES(@ID, @Ver, @Mode)"; db.Execute(query, _set); } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool Update(SettingViewModel _sett) { try { using (IDbConnection db = new SQLiteConnection(DataAccess.GetConnectionString())) { string query = "UPDATE Setting " + "SET Ver =@Ver, Mode =@Mode, S1 =@S1, S2 =@S2, S3 =@S3, N1 =@N1, N2 =@N2, N3 =@N3 Where ID=@ID"; db.Execute(query, _sett); } return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }