Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DbCalls db = new DbCalls();

            WindowsFormsApplication1.Call w = new WindowsFormsApplication1.Call();
            try
            {
                w.Id = int.Parse(textBox1.Text);
                if (db.CallExist(w.Id) == true)
                {
                    DialogResult dialogResult = MessageBox.Show("Are You Sure To Delete Call?", "Delete", MessageBoxButtons.YesNoCancel);
                    if (dialogResult == DialogResult.Yes)
                    {
                        db.DeleteCall(w);
                        MessageBox.Show("Call was deleted Successfully");
                    }
                }
                else
                {
                    MessageBox.Show("Call with similar ID was not found , try again", "Error");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DbCalls db = new DbCalls();

            try
            {
                WindowsFormsApplication1.Call w = new WindowsFormsApplication1.Call();
                w.Id = int.Parse(textBox1.Text);

                if (comboBox1.SelectedIndex == 0)
                {
                    dataGridView1.DataSource = db.SearchCallByCallId(w.Id).Tables[0];
                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    dataGridView1.DataSource = db.SearchCallByWorkerId(w.Id).Tables[0];
                }
                else
                {
                    dataGridView1.DataSource = db.SearchCallByClientId(w.Id).Tables[0];
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            WindowsFormsApplication1.Call w = new WindowsFormsApplication1.Call();
            DbCalls db = new DbCalls();

            w.Id          = int.Parse(textBox1.Text);
            w.CallDate    = textBox3.Text;
            w.CallTime    = textBox2.Text;
            w.WorkerId    = int.Parse(textBox4.Text);
            w.ClientId    = int.Parse(textBox5.Text);
            w.Description = textBox6.Text;
            db.UpdateCall(w);
            MessageBox.Show("Successfully updated Call");
        }
Example #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            WindowsFormsApplication1.Call w = new WindowsFormsApplication1.Call();
            DbCalls db = new DbCalls();
            DataSet ds = new DataSet();



            try
            {
                w.Id = int.Parse(textBox1.Text);

                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
                textBox4.Clear();
                textBox5.Clear();
                textBox6.Clear();


                if (db.CallExist(w.Id) == true)
                {
                    ds = db.getCallInfo(w);

                    textBox1.Text = ds.Tables[0].Rows[0]["CallCode"].ToString();
                    textBox3.Text = ds.Tables[0].Rows[0]["CallDate"].ToString();
                    textBox2.Text = ds.Tables[0].Rows[0]["CallTime"].ToString();
                    textBox4.Text = ds.Tables[0].Rows[0]["WorkerId"].ToString();
                    textBox5.Text = ds.Tables[0].Rows[0]["ClientId"].ToString();
                    textBox6.Text = ds.Tables[0].Rows[0]["Description"].ToString();
                }
                else
                {
                    textBox1.Text = "Id does not exist";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            DbCalls db = new DbCalls();

            WindowsFormsApplication1.Call w = new WindowsFormsApplication1.Call();
            try
            {
                w.Id          = int.Parse(textBox1.Text);
                w.CallDate    = textBox3.Text;
                w.CallTime    = textBox2.Text;
                w.WorkerId    = int.Parse(textBox4.Text);
                w.ClientId    = int.Parse(textBox5.Text);
                w.Description = textBox6.Text;


                DbWorker  wdb = new DbWorker();
                DbClients cdb = new DbClients();

                if (!wdb.WorkerExist(w.WorkerId))
                {
                    MessageBox.Show("Invalid Worker", "Error");
                    return;
                }

                if (!cdb.ClientExist(w.ClientId))
                {
                    MessageBox.Show("Invalid Client", "Error");
                    return;
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Invalid parameters", "Error");
                return;
            }
            db.insertCall(w);
            MessageBox.Show("add workstation Success");
        }