Ejemplo n.º 1
0
        public int UpdateWaiter(WaiterDetails wd)
        {
            tbl_waiter td = _db.tbl_waiter.Where(c => c.WaiterID == wd.WaiterID).FirstOrDefault();

            td.WaiterName    = wd.WaiterName;
            td.WaiterContact = wd.WaiterContact;
            td.WaiterAddress = wd.WaiterAddress;
            return(_db.SaveChanges());
        }
Ejemplo n.º 2
0
        public int AddNewWaiter(WaiterDetails wd)
        {
            tbl_waiter tw = new tbl_waiter();

            tw.WaiterName    = wd.WaiterName;
            tw.WaiterContact = wd.WaiterContact;
            tw.WaiterAddress = wd.WaiterAddress;
            _db.tbl_waiter.Add(tw);
            return(_db.SaveChanges());
        }
Ejemplo n.º 3
0
        private void LoadWaiter()
        {
            List <WaiterDetails> lstwt = blw.GetAllWaiters();
            WaiterDetails        pro   = new WaiterDetails();

            pro.WaiterName = "Choose Waiter";
            lstwt.Insert(0, pro);

            cmbWaiter.DataSource    = lstwt;
            cmbWaiter.DisplayMember = "WaiterName";
            cmbWaiter.ValueMember   = "WaiterID";
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtWaiterName.Text == "")
            {
                MessageBox.Show("Please Enter Waiter Name", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtWaiterName.Focus();
                return;
            }
            if (txtContact.Text == "")
            {
                MessageBox.Show("Please Enter Waiter Contact Number", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtContact.Focus();
                return;
            }
            if (txtAddress.Text == "")
            {
                MessageBox.Show("Please Enter Waiter Address", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtAddress.Focus();
                return;
            }
            WaiterDetails wd = new WaiterDetails();

            wd.WaiterName    = txtWaiterName.Text;
            wd.WaiterContact = txtContact.Text;
            wd.WaiterAddress = txtAddress.Text;

            bool isexists = blw.CheckContact(txtContact.Text);

            if (isexists)
            {
                MessageBox.Show("Waiter Already Exists in Database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtContact.Text = "";
                txtContact.Focus();
            }
            else
            {
                int i = blw.AddNewWaiter(wd);
                if (i > 0)
                {
                    MessageBox.Show("New Waiter Added Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtWaiterName.Text = "";
                    txtContact.Text    = "";
                    txtAddress.Text    = "";
                    txtWaiterName.Focus();
                }
            }
        }
Ejemplo n.º 5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtWaiterName.Text == "")
            {
                MessageBox.Show("Please Enter Waiter Name", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtWaiterName.Focus();
                return;
            }
            if (txtContact.Text == "")
            {
                MessageBox.Show("Please Enter Waiter Contact Number", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtContact.Focus();
                return;
            }
            if (txtAddress.Text == "")
            {
                MessageBox.Show("Please Enter Waiter Address", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtAddress.Focus();
                return;
            }
            WaiterDetails wd = new WaiterDetails();

            wd.WaiterID      = Convert.ToInt32(txtWaiterID.Text);
            wd.WaiterName    = txtWaiterName.Text;
            wd.WaiterContact = txtContact.Text;
            wd.WaiterAddress = txtAddress.Text;


            int i = blw.UpdateWaiter(wd);

            if (i > 0)
            {
                MessageBox.Show("Waiter Updated Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
        }