示例#1
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            string msg = "Are you sure to give a penalty?";

            main_page.Create_Warning_Form(msg, Color.DarkRed);

            if (main_page.Warning_form.Result)
            {
                this.pt_name = cb_penalties.SelectedItem.ToString().Trim();
                this.fee     = int.Parse(this.tb_fee.Text.Trim());
                Receipt new_penalty = new Penalty(0, book.Book_id, user.User_id, manager.Employee_id, pt_name, fee);
                manager.Give_Penalty_To_User(user, book, new_penalty, detail_form);
                this.dgw_penalties.DataSource = user.Show_All_Penalties();
            }

            main_page.Warning_form.Refresh_Form();
        }
        private void btn_remove_Click(object sender, EventArgs e)
        {
            string message = "Are you sure to delete that receipt?";

            main_page.Create_Warning_Form(message, Color.DarkRed);

            if (main_page.Warning_form.Result)
            {
                Remove();
            }

            main_page.Warning_form.Refresh_Form();

            main_page.Pnl_receipt_list.VerticalScroll.Value = 0;
            main_page.Receipt_search_list.Delete_All_List();
            main_page.Main_receipt_list.Draw_All_Receipts();
            main_page.Receipt_searched_already = false;

            this.Dispose();
            MessageBox.Show("That operation has been canceled.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void btn_remove_Click(object sender, EventArgs e)
        {
            Microwave main_page = (Microwave)Application.OpenForms["Microwave"];



            string msg = "Are you sure to delete a popularity type?";

            main_page.Create_Warning_Form(msg, Color.DarkRed);

            if (main_page.Warning_form.Result)
            {
                main_page.Warning_form.Refresh_Form();
                this.id = int.Parse(dgw_popularity.SelectedRows[0].Cells[0].Value.ToString());

                if (this.id == -1)
                {
                    return;
                }

                if (this.id == 0)
                {
                    MessageBox.Show("Default cannot be deleted.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                Popularity pop_delete = new Popularity(id, name, score);
                pop_delete.Delete();

                this.dgw_popularity.DataSource = Popularity.Show_All_Popularities();
            }
            main_page.Warning_form.Refresh_Form();


            return;
        }