Exemplo n.º 1
0
        //页面加载
        public void List_Load(object sender, EventArgs e)
        {
            //渲染listview
            listView1.GridLines     = true;
            listView1.FullRowSelect = true;
            listView1.View          = View.Details;
            listView1.HeaderStyle   = ColumnHeaderStyle.Nonclickable;

            listView1.Columns.Clear();
            listView1.Columns.Add("ID", 50, HorizontalAlignment.Left);
            listView1.Columns.Add("标题", 100, HorizontalAlignment.Left);
            listView1.Columns.Add("网址", 200, HorizontalAlignment.Left);
            listView1.Columns.Add("帐号", 120, HorizontalAlignment.Left);
            listView1.Columns.Add("remark", "备注");

            listView1.Columns["remark"].Width = -2;

            var model = new Record();
            var data  = model.select();

            var des = new DEScode(Session.password);

            listView1.Items.Clear();
            foreach (DataRow row in data)
            {
                ListViewItem item = new ListViewItem();
                item.SubItems.Clear();
                item.SubItems[0].Text = row["ID"].ToString();
                item.SubItems.Add(des.DecryptDES(row["标题"].ToString()));
                item.SubItems.Add(des.DecryptDES(row["网址"].ToString()));
                item.SubItems.Add(des.DecryptDES(row["账户"].ToString()));
                item.SubItems.Add(des.DecryptDES(row["备注"].ToString()));
                listView1.Items.Add(item);
            }
            //渲染状态栏
            toolStripStatusLabel1.Text = "欢迎光临," + Session.account;
        }
Exemplo n.º 2
0
        public Detail(int id)
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterParent;

            var     model = new Record();
            DataRow dr    = model.get(id);

            if (dr != null)
            {
                var des = new DEScode(Session.password);
                label7.Text  = des.DecryptDES(dr["标题"].ToString());
                label8.Text  = des.DecryptDES(dr["网址"].ToString());
                label9.Text  = des.DecryptDES(dr["账户"].ToString());
                label10.Text = des.DecryptDES(dr["密码"].ToString());
                label11.Text = des.DecryptDES(dr["二级密码"].ToString());
                label12.Text = des.DecryptDES(dr["备注"].ToString());
            }
        }
Exemplo n.º 3
0
        //重新加密
        public void rebuild(string old_password, string new_password)
        {
            DataRowCollection drc = this.select();
            var old_des           = new DEScode(old_password);
            var new_des           = new DEScode(new_password);

            foreach (DataRow row in drc)
            {
                int    id              = int.Parse(row["ID"].ToString());
                string title           = new_des.EncryptDES(old_des.DecryptDES(row["标题"].ToString()));
                string website         = new_des.EncryptDES(old_des.DecryptDES(row["网址"].ToString()));
                string account         = new_des.EncryptDES(old_des.DecryptDES(row["账户"].ToString()));
                string password        = new_des.EncryptDES(old_des.DecryptDES(row["密码"].ToString()));
                string second_password = new_des.EncryptDES(old_des.DecryptDES(row["二级密码"].ToString()));
                string remark          = new_des.EncryptDES(old_des.DecryptDES(row["备注"].ToString()));

                string[] columns = { "标题", "网址", "账户", "密码", "二级密码", "备注" };
                string[] values  = { title, website, account, password, second_password, remark };

                this.update(id, columns, values);
            }
        }
Exemplo n.º 4
0
        //构造函数
        public Add(List list, int id = 0)
        {
            InitializeComponent();
            this.parent = list;
            this.id     = id;

            if (this.id > 0)
            {
                var     model = new Record();
                DataRow dr    = model.get(this.id);
                if (dr != null)
                {
                    var des = new DEScode(Session.password);
                    textBox1.Text     = des.DecryptDES(dr["标题"].ToString());
                    textBox2.Text     = des.DecryptDES(dr["网址"].ToString());
                    textBox3.Text     = des.DecryptDES(dr["账户"].ToString());
                    textBox4.Text     = des.DecryptDES(dr["密码"].ToString());
                    textBox5.Text     = des.DecryptDES(dr["二级密码"].ToString());
                    richTextBox1.Text = des.DecryptDES(dr["备注"].ToString());
                }
            }

            this.StartPosition = FormStartPosition.CenterParent;
        }