Пример #1
0
 public FormEditAccount(int mode, Account accIn)
 {
     InitializeComponent();
     sqlconn = new Sqlite3();
     acc = accIn;
     modeForm = mode;
     if (modeForm == 2)
         fillFields();
 }
Пример #2
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            Acc1 = new Account();
            sqlconn = new Sqlite3();
            RefreshDg();

            //Acc1 = new Account();
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
Пример #3
0
        public void deleteRecord(Account Acc)
        {
            openConnectionDb();
            SQLiteCommand cmd = new SQLiteCommand(@"UPDATE tbl_passwords SET del = 1 WHERE resource_name = @rn AND login = @lg AND email = @em", connection);

            SQLiteParameter param = new SQLiteParameter();
            param.ParameterName = "@rn";
            param.Value = Acc.getWebName();
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@lg";
            param.Value = Acc.getNameAccount();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@em";
            param.Value = Acc.getEmail();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            //param = new SQLiteParameter();
            //param.ParameterName = "@nt";
            //param.Value = Acc.getNote();
            //param.SqlDbType = SqlDbType.Text;
            //cmd.Parameters.Add(param);

            try
                {
                    cmd.ExecuteNonQuery();
                }
            catch
            {
                Console.WriteLine("Ошибка, при выполнении запроса на удаление записи");
                return;
            }
            connection.Close();
        }
Пример #4
0
        public void editRecord(Account Acc)
        {
            //int id;
            openConnectionDb();
            SQLiteCommand cmd = new SQLiteCommand(@"UPDATE tbl_passwords SET email = @em, password = @pw, note = @nt WHERE resource_name = @rn AND login = @lg AND del = 0", connection);
            //SQLiteDataReader reader = cmd.ExecuteReader();
            SQLiteParameter param = new SQLiteParameter();
            param.ParameterName = "@rn";
            param.Value = Acc.getWebName();
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@lg";
            param.Value = Acc.getNameAccount();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@em";
            param.Value = Acc.getEmail();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@pw";
            param.Value = Acc.getPasswordCr();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@nt";
            param.Value = Acc.getNote();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);
            //id = reader;

            //SQLiteCommand cmd = new SQLiteCommand(@"UPDATE tBl_passwords SET resource_name = @rn, login = @lg, email = @em, password = @pw, note = @nt, del = 0", connection);
            //SqlParameter param = new SqlParameter();

            try
                {
                    cmd.ExecuteNonQuery();
                }
            catch
            {
                Console.WriteLine("Ошибка, при выполнении запроса на изменение записи");
               return;
            }
        }
Пример #5
0
        //(string rn, string lg, string em, string pw, string nt)
        public void newRecord(Account Acc)
        {
            //connection = new SQLiteConnection(string.Format("Data Source={0};", dbName));
            //connection.Open();
            openConnectionDb();

            SQLiteCommand cmd = new SQLiteCommand(@"INSERT INTO tbl_passwords (resource_name, login, email, password, note, del) values (@rn, @lg, @em, @pw, @nt, 0)", connection);

            SQLiteParameter param = new SQLiteParameter();
            param.ParameterName = "@rn";
            param.Value = Acc.getWebName();
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@lg";
            param.Value = Acc.getNameAccount();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@em";
            param.Value = Acc.getEmail();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@pw";
            param.Value = Acc.getPasswordCr();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            param = new SQLiteParameter();
            param.ParameterName = "@nt";
            param.Value = Acc.getNote();
            //param.SqlDbType = SqlDbType.Text;
            cmd.Parameters.Add(param);

            try
                {
                    cmd.ExecuteNonQuery();
                }
            catch
            {
                Console.WriteLine("Ошибка, при выполнении запроса на добавление записи");
                return;
            }
            connection.Close();
        }