Exemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 0)
            {
                if (checkBox4.Checked == false)
                {
                    MessageBox.Show("Please select delete checkbox above for Deleting Package", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }


                else if (checkBox4.Enabled)
                {
                    if (textBox1.Text == "")
                    {
                        MessageBox.Show("Please Fill correctly and do not leave blank" + "\n 1.PackageName to Delete", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        DomesticPackage pc = new DomesticPackage();
                        pc.Packagename = textBox1.Text;
                        // pc.Schedule = textBox2.Text;
                        //pc.Amount = int.Parse(textBox3.Text);
                        DBAccess dbp = new DBAccess();
                        dbp.DeleteDomesticPackage(pc);
                        MessageBox.Show("Package Has Been Deleted", "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                if (checkBox4.Checked == false)
                {
                    MessageBox.Show("Please select delete checkbox above for Deleting Package", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                else if (checkBox4.Enabled)
                {
                    if (textBox1.Text == "")
                    {
                        MessageBox.Show("Please Fill correctly and do not leave blank" + "\n 1.PackageName to Delete", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        InternationalPackage pc = new InternationalPackage();
                        pc.Packagename = textBox1.Text;
                        //pc.Schedule = textBox2.Text;
                        //pc.Amount = int.Parse(textBox3.Text);
                        DBAccess dbp = new DBAccess();
                        dbp.DeleteInternationalPackage(pc);
                        MessageBox.Show("Package Has Been Deleted", "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            else if (comboBox1.SelectedIndex <= 0)
            {
                MessageBox.Show("Please Select the Package Category", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        public void UpdateInterSchAmo(InternationalPackage ip)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = "Data Source=NYIHEINHTET;Initial Catalog=yadanarmyay;Integrated Security=true";
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con;
            cmd.CommandText = "update InternationalPackage set Schedule='" + ip.Schedule + "',Amount=" + ip.Amount + " where PackageName='" + ip.Packagename + "'";

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemplo n.º 3
0
        public void SaveInternationalPackage(InternationalPackage ip)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = "Data Source=NYIHEINHTET;Initial Catalog=yadanarmyay;Integrated Security=true";
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con;
            cmd.CommandText = "Insert Into InternationalPackage Values('" + ip.Packagename + "','" + ip.Schedule + "'," + ip.Amount + ")";

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemplo n.º 4
0
        public void DeleteInternationalPackage(InternationalPackage ip)
        {
            SqlConnection con = new SqlConnection();

            con.ConnectionString = "Data Source=NYIHEINHTET;Initial Catalog=yadanarmyay;Integrated Security=true";
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con;
            cmd.CommandText = "delete from InternationalPackage where PackageName='" + ip.Packagename + "'";

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemplo n.º 5
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 0)
            {
                if (checkBox3.Checked == false)
                {
                    MessageBox.Show("Please select Update Schedule & Amount checkbox above for Updating", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                else if (checkBox3.Enabled)
                {
                    if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
                    {
                        MessageBox.Show("Please Fill correctly and do not leave blank" + "\n 1. Old PackageName for Updating Schedule & Amount" + "\n 2. New Schedule for Updating" + "\n 3. New Amount for Updating", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        try
                        {
                            if (int.Parse(textBox3.Text) <= 0)
                            {
                                MessageBox.Show("Please Enter Amount of Package wih at least $100", "Amount Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                DomesticPackage pc = new DomesticPackage();
                                pc.Packagename = textBox1.Text;
                                pc.Schedule    = textBox2.Text;
                                pc.Amount      = int.Parse(textBox3.Text);
                                DBAccess dbp = new DBAccess();
                                dbp.UpdateDomSchAmo(pc);
                                MessageBox.Show("Schedule & Amount Has Been Updated", "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        catch (FormatException)
                        {
                            MessageBox.Show("Please Enter Correct Number format for Amount of Packages", "Amount Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        catch (OverflowException)
                        {
                            MessageBox.Show("Please Enter Correct Sensible Amount of Package", "Package Amount Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                if (checkBox3.Checked == false)
                {
                    MessageBox.Show("Please select Update Schedule & Amount checkbox above for Updating", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                else if (checkBox3.Enabled)
                {
                    if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
                    {
                        MessageBox.Show("Please Fill correctly and do not leave blank" + "\n 1. Old PackageName for Updating Schedule & Amount" + "\n 2. New Schedule for Updating" + "\n 3. New Amount for Updating", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        try
                        {
                            if (int.Parse(textBox3.Text) <= 0)
                            {
                                MessageBox.Show("Please Enter Amount of Package wih at least $100", "Amount Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                InternationalPackage pc = new InternationalPackage();
                                pc.Packagename = textBox1.Text;
                                pc.Schedule    = textBox2.Text;
                                pc.Amount      = int.Parse(textBox3.Text);
                                DBAccess dbp = new DBAccess();
                                dbp.UpdateInterSchAmo(pc);
                                MessageBox.Show("Schedule & Amount Has Been Updated", "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        catch (FormatException)
                        {
                            MessageBox.Show("Please Enter Correct Number format for Amount of Packages", "Amount Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        catch (OverflowException)
                        {
                            MessageBox.Show("Please Enter Correct Sensible Amount of Package", "Package Amount Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Select the Package Category", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }