Beispiel #1
0
 private void Buttondelete_Click(object sender, EventArgs e)
 {
     if (CBfeedback.SelectedIndex > -1)
     {
         TxtAddfeedback.Clear();
         AddorDeleteissue(CBfeedback.Text.Trim(), "DELETE");
         FillUpcomboBox();
     }
 }
Beispiel #2
0
        private void AddorDeleteissue(string customer, string choice)
        {
            int selectedCB = CBfeedback.SelectedIndex;

            collect = string.Empty;
            try
            {
                if (choice == "ADD")
                {
                    if (Mydb.Addnewcustomer(customer.ToUpper(), addedby))
                    {
                        this.Visible = false;
                        MessageBox.Show("New customer has been addded Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else if (choice == "DELETE")
                {
                    DialogResult result = MessageBox.Show("Are you sure going to delete permanently?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (result == DialogResult.Yes)
                    {
                        if (Mydb.Deletecustomer(customer.ToUpper()))
                        {
                            this.Visible = false;
                            MessageBox.Show("customer has been Deleted Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            TxtAddfeedback.Clear();
            TxtAddfeedback.Focus();

            this.Visible = true;
        }
Beispiel #3
0
 private void ButtonAdd_Click(object sender, EventArgs e)
 {
     if (TxtAddfeedback.Text != "")
     {
         if (!TxtAddfeedback.Text.Contains(";"))
         {
             AddorDeleteissue(TxtAddfeedback.Text.Trim(), "ADD");
             FillUpcomboBox();
         }
         else
         {
             MessageBox.Show("Please be removed this character semicolon ';'", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             TxtAddfeedback.SelectAll();
             TxtAddfeedback.Focus();
         }
     }
     else
     {
         MessageBox.Show("Cannot be Added. please fill up customer name", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TxtAddfeedback.Focus();
     }
 }
        private void AddorDeleteissue(string newissue, string choice)
        {
            int selectedCB = CBfeedback.SelectedIndex;

            collect = string.Empty;

            for (int select = 0; select < CBfeedback.Items.Count; select++)
            {
                if (choice == "ADD")
                {
                    CBfeedback.SelectedIndex = select; collect += CBfeedback.Text.Trim() + ";";
                }
                else if (choice == "DELETE")
                {
                    CBfeedback.SelectedIndex = select;

                    if (CBfeedback.SelectedIndex != selectedCB)
                    {
                        collect += CBfeedback.Text.Trim() + ";";
                    }
                }
            }

            if (choice == "ADD")
            {
                collect += newissue;
            }
            else
            {
                if (collect.Substring(collect.Length - 1) == ";")
                {
                    collect = collect.Remove(collect.Length - 1);
                }
            }

            Myini.IniWriteValue("Report_Feedback", "Issue", collect);
            TxtAddfeedback.Clear();
            TxtAddfeedback.Focus();
        }