コード例 #1
0
        private void metroTile_addMenu_Click(object sender, EventArgs e)
        {
            if (metroTextBox_NameMenu.Text == "" || metroTextBox_PriceMenu.Text == "")
            {
                MessageBox.Show("Please input Full menu's information !");
                return;
            }


            DTO.Menu_DTO m = new DTO.Menu_DTO();
            //m.Id = int.Parse(metroTextBox_IDMenu.Text);
            m.Name           = metroTextBox_NameMenu.Text;
            m.Original_price = float.Parse(metroTextBox_PriceMenu.Text);
            m.Kind           = idKindCurrent;
            m.Sale_price     = float.Parse(metroTextBox_salePrice.Text);
            m.Amout          = 0; // default !

            if (menu_BUS.AddMenu(m) == false)
            {
                MessageBox.Show("Can't add this menu !");
                return;
            }
            MessageBox.Show("Menu was added !");

            Load_Menu_By_ID(idKindCurrent);


            //flowLayoutPanel_ServicesInfo.Refresh();
        }
コード例 #2
0
        private void metroTile_EditMenu_Click(object sender, EventArgs e)
        {
            if (metroTextBox_NameMenu.Text == "" || metroTextBox_PriceMenu.Text == "")
            {
                MessageBox.Show("Please input Full menu's information !");
                return;
            }

            DTO.Menu_DTO m = new DTO.Menu_DTO();
            m.Id             = int.Parse(metroTextBox_IDMenu.Text);
            m.Name           = metroTextBox_NameMenu.Text;
            m.Original_price = int.Parse(metroTextBox_PriceMenu.Text);
            m.Kind           = int.Parse(metroTextBox_IdKindOfMenu.Text);
            m.Amout          = int.Parse(metroTextBox_AmoutMenu.Text); // default !

            if (menu_BUS.EditMenu(m) == true)
            {
                MessageBox.Show("Menu was updated !");
                Load_Room();
            }
            else
            {
                MessageBox.Show("Can't update this menu !");
            }
            Load_Menu_By_ID(int.Parse(metroTextBox_IdKindOfMenu.Text));
        }
コード例 #3
0
ファイル: menu_DAO.cs プロジェクト: vtquy98/Karaoke-Manager
        public static List <DTO.Menu_DTO> GetInfoMenuByID(int id)
        {
            string stringquery = "select * from MENU where Id_nenu = " + id;

            con = DataProvider.OpenConnection();
            DataTable dt = DataProvider.ExcuteQuery(stringquery, con);

            if (dt.Rows.Count == 0)
            {
                return(null);
            }
            List <DTO.Menu_DTO> listInfo = new List <DTO.Menu_DTO>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DTO.Menu_DTO menu = new DTO.Menu_DTO();
                menu.Id             = int.Parse(dt.Rows[i]["Id_nenu"].ToString());
                menu.Name           = dt.Rows[i]["name"].ToString();
                menu.Original_price = float.Parse(dt.Rows[i]["original_price"].ToString());
                menu.Sale_price     = float.Parse(dt.Rows[i]["sale_Price"].ToString());
                menu.Amout          = int.Parse(dt.Rows[i]["amout"].ToString());
                menu.Kind           = int.Parse(dt.Rows[i]["id_Kind"].ToString());
                listInfo.Add(menu);
            }

            return(listInfo);
        }