Пример #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();
        }
Пример #2
0
        private void insertadmin()
        {
            string         userem;
            string         conv;
            int            conv2id;
            ManageEmployee me     = new ManageEmployee();
            msemployee     mep    = new msemployee();
            var            usera1 = (from s in dbku.msemployees where s.position == "admin" orderby s.employeeid descending select s).First();
            string         potong;
            string         user1;
            string         dapat;
            int            newid;

            if (usera1 != null)
            {
                user1          = usera1.employeeid;
                conv           = Convert.ToString(user1);
                potong         = conv.Substring(2, 2);
                conv2id        = Convert.ToInt32(potong);
                newid          = conv2id + 01;
                userem         = Convert.ToString("A-0" + newid);
                dapat          = userem;
                mep.name       = "" + txtname.Text;
                mep.email      = "" + txtemail.Text;
                mep.handphone  = "" + txthp.Text;
                mep.position   = "" + cmbpost.SelectedItem;
                mep.password   = "" + txtpassword.Text;
                mep.employeeid = "" + dapat;

                dbku.msemployees.InsertOnSubmit(mep);
                dbku.SubmitChanges();
                MessageBox.Show("DATA PENGGUNA BERHASIL DI INPUT");
                txtname.Text     = null;
                txtemail.Text    = null;
                txthp.Text       = null;
                txtpassword.Text = null;
            }
            else
            {
                string userid  = "A-00".Substring(2, 2);
                int    convert = Convert.ToInt32(userid);
                int    newids  = convert + 01;
                string userid2 = Convert.ToString("A-0" + newids);
                mep.name       = "" + txtname.Text;
                mep.email      = "" + txtemail.Text;
                mep.handphone  = "" + txthp.Text;
                mep.position   = "" + cmbpost.SelectedItem;
                mep.password   = "" + txtpassword.Text;
                mep.employeeid = "" + userid2;

                dbku.msemployees.InsertOnSubmit(mep);
                dbku.SubmitChanges();
                MessageBox.Show("DATA PENGGUNA BERHASIL DI INPUT");
                txtname.Text     = null;
                txtemail.Text    = null;
                txthp.Text       = null;
                txtpassword.Text = null;
            }
        }
Пример #3
0
        private void inscash()
        {
            koneksikuDataContext dbku = new koneksikuDataContext();
            var        chaspos        = (from u in dbku.msemployees where u.position == "cashier" orderby u.employeeid descending select u).First();
            string     chaspost       = chaspos.employeeid;
            int        start          = +1;
            msemployee mse            = new msemployee();

            if (chaspost != null)
            {
                string chasa       = chaspost.Substring(3, 2);
                int    convertchas = Convert.ToInt32(chasa);
                int    tambah      = convertchas + start;
                string convst      = Convert.ToString("CH-0" + tambah);
                mse.name       = "" + txtname.Text;
                mse.email      = "" + txtemail.Text;
                mse.handphone  = "" + txthp.Text;
                mse.position   = "" + cmbpost.SelectedItem;
                mse.password   = "" + txtpassword.Text;
                mse.employeeid = "" + convst;

                dbku.msemployees.InsertOnSubmit(mse);
                dbku.SubmitChanges();
                MessageBox.Show("DATA PENGGUNA BERHASIL DI INPUT");
                txtname.Text     = null;
                txtemail.Text    = null;
                txthp.Text       = null;
                txtpassword.Text = null;
            }
        }
Пример #4
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 = "";
            }
        }
Пример #5
0
        private void insbtn()
        {
            //int memid = Convert.ToInt32(txtmemid.Text);
            //var member = (from m in dbku.msmembers orderby m.memberid descending select m).First();
            DateTime dtime;

            dtime = dateTimePicker1.Value;
            var member = (from b in dbku.msmembers select b).First();

            if (member.memberid != 0)
            {
                var member1 = (from m in dbku.msmembers orderby m.memberid descending select m).First();

                int members = member1.memberid;
                int auto    = members + 1;
                msm.memberid  = auto;
                msm.email     = txtemail.Text;
                msm.handphone = txthp.Text;
                msm.name      = txtname.Text;
                msm.joindate  = dtime;
                msm.password  = txtpass.Text;

                dbku.msmembers.InsertOnSubmit(msm);
                dbku.SubmitChanges();
                MessageBox.Show("Data Member berhasil Di Input");
            }
            //msm.joindate = dtp.ToString(joindHPW
            else
            {
                int idstart = 1;
                msm.memberid  = idstart;
                msm.email     = txtemail.Text;
                msm.handphone = txthp.Text;
                msm.name      = txtname.Text;
                msm.joindate  = dtime;
                dbku.msmembers.InsertOnSubmit(msm);
                dbku.SubmitChanges();
                MessageBox.Show("Data Member berhasil Di Input");
            }
        }