Beispiel #1
0
        private void btninsert_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofp = new OpenFileDialog();

            byte[] fileb = imgtoarray(pbfood.Image);
            System.Data.Linq.Binary filebi = new System.Data.Linq.Binary(fileb);
            string paths = txtpath.Text;
            //System.Data.Linq.Binary pathbi = new System.Data.Linq.Binary(paths);
            int menus  = Convert.ToInt32(txtmenuid.Text);
            int prices = Convert.ToInt32(txtprice.Text);
            var tabs   = new msmenu
            {
                menuid = menus,
                photo  = filebi,
                name   = txtmenun.Text,
                price  = prices,
                path   = txtpath.Text,
            };

            dbku.msmenus.InsertOnSubmit(tabs);
            dbku.SubmitChanges();
            MessageBox.Show("Successfull");

            this.bind();
            dgrid.Refresh();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            msmenu sm       = new msmenu();
            var    userpass = (from u in dbku.msemployees where u.password == txtoldpass.Text select u).First();

            string newpass1 = txtnewpass1.Text;
            string newpass2 = txtnewpass2.Text;
            string oldpass  = txtoldpass.Text;

            if (oldpass == userpass.password)
            {
                if (newpass1 == newpass2)
                {
                    userpass.password = newpass1;
                    dbku.SubmitChanges();
                    MessageBox.Show("Password Berhasil Di Perbaharui");
                }
                else
                {
                    MessageBox.Show("Password Tidak Cocok, Silahkan Check Kembali");
                    oldpass  = "";
                    newpass1 = "";
                    newpass2 = "";
                }
            }
            else
            {
                MessageBox.Show("Password Lama Salah");
                oldpass  = "";
                newpass1 = "";
                newpass2 = "";
            }
        }
 partial void Updatemsmenu(msmenu instance);
 partial void Deletemsmenu(msmenu instance);
 partial void Insertmsmenu(msmenu instance);