Example #1
0
        private void NextE_btn_Click(object sender, EventArgs e)
        {
            DateTime date = new DateTime(EventDateE_pkr.Value.Date.Year, EventDateE_pkr.Value.Date.Month, EventDateE_pkr.Value.Date.Day);

            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][0] = refToEmployeeEvents.id;
            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][1] = TitleE_txt.Text;
            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][2] = EventDuration_cmbo.GetItemText(EventDuration_cmbo.SelectedItem);
            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][3] = date;
            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][4] = Budget_txt.Text;
            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][5] = CapacityE_txt.Text;
            refToEmployeeEvents.dataset.Tables[0].Rows[refToEmployeeEvents.index][6] = PrivacyE_cmbo.GetItemText(PrivacyE_cmbo.SelectedItem);
            OracleCommandBuilder builder = new OracleCommandBuilder(refToEmployeeEvents.adapter);

            refToEmployeeEvents.adapter.Update(refToEmployeeEvents.dataset.Tables[0]);
            this.Hide();
            refToEmployeeEvents.Show();
        }
Example #2
0
        private void NextE_btn_Click(object sender, EventArgs e)
        {
            if (NextE_btn.Text.ToString() == "Next")
            {
                con = new OracleConnection(ordb);
                con.Open();

                OracleCommand c = new OracleCommand();
                c.Connection  = con;
                c.CommandText = "CREATEEVENT";
                c.CommandType = CommandType.StoredProcedure;
                c.Parameters.Add("ussn", refToEmployee.ssn);
                c.Parameters.Add("EDate", EventDateE_pkr.Value.Date.Day.ToString() + "-" + EventDateE_pkr.Value.Date.Month.ToString() + "-" + EventDateE_pkr.Value.Date.Year.ToString());
                c.Parameters.Add("Epriv", PrivacyE_cmbo.GetItemText(PrivacyE_cmbo.SelectedItem));
                c.Parameters.Add("Ecap", CapacityE_txt.Text);
                c.Parameters.Add("budget", Budget_txt.Text);
                c.Parameters.Add("Eduration", EventDuration_cmbo.SelectedItem);
                string str = PlaceE_cmbo.GetItemText(PlaceE_cmbo.SelectedItem);

                char[]   spearator = { ' ' };
                string[] strlist   = str.Split(spearator);

                c.Parameters.Add("hallName", strlist[0]);
                c.Parameters.Add("title", TitleE_txt.Text);
                c.Parameters.Add("specialty", Speacialty_cmbo.GetItemText(Speacialty_cmbo.SelectedItem));
                OracleParameter ret = c.Parameters.Add("Eid", OracleDbType.Int32);
                ret.Direction = ParameterDirection.Output;

                c.ExecuteNonQuery();

                returnval = c.Parameters["Eid"].Value.ToString();
                con.Close();

                con = new OracleConnection(ordb);
                con.Open();
                OracleCommand c2 = new OracleCommand();
                c2.Connection  = con;
                c2.CommandType = CommandType.Text;
                c2.CommandText = "insert into supply (vendor_id, event_id) values (:vendorID,:eventID)";

                string str2 = VendorE_cmbo.GetItemText(VendorE_cmbo.SelectedItem);

                char[]   spearator2 = { ' ' };
                string[] strlist2   = str2.Split(spearator);

                int id = Convert.ToInt32(strlist2[0]);
                c2.Parameters.Add("vendorID", id);
                c2.Parameters.Add("eventID", Convert.ToInt32(returnval));
                c2.ExecuteNonQuery();
                con.Close();

                DialogResult IsAddSec = MessageBox.Show("Do You Want To add Sections?", "Making Event", MessageBoxButtons.YesNo);
                if (IsAddSec == DialogResult.Yes)
                {
                    BackE_btn.Show();
                    Event2ndE_pnl.Show();
                    EventFirstE_pnl.Hide();
                    NextE_btn.Text = "Done";
                }
                else
                {
                    MessageBox.Show("OK! Your Event Has Been Created :)", "Done Event");
                    refToEmployee.Show();
                    this.Hide();
                }
            }
            else
            {
                con = new OracleConnection(ordb);
                con.Open();
                OracleCommand c2 = new OracleCommand();
                c2.Connection  = con;
                c2.CommandText = "INSERTSECTION";
                c2.CommandType = CommandType.StoredProcedure;
                c2.Parameters.Add("cood_name", Coor_txt.Text);
                c2.Parameters.Add("duration", SecDuration_cmbo.SelectedItem.ToString());
                c2.Parameters.Add("content", SecContentE_txt.Text);
                c2.Parameters.Add("title", SecTitleE_txt.Text);
                c2.Parameters.Add("event_id", Convert.ToInt32(returnval));

                c2.ExecuteNonQuery();

                for (int i = 1; i < num; i++)
                {
                    OracleCommand c1 = new OracleCommand();
                    c1.Connection  = con;
                    c1.CommandText = "INSERTSECTION";
                    c1.CommandType = CommandType.StoredProcedure;
                    string name = ((TextBox)Event2ndE_pnl.Controls["Coor_txt" + i.ToString()]).Text;
                    c1.Parameters.Add("cood_name", name);
                    string duration = ((ComboBox)Event2ndE_pnl.Controls["SecDuration_cmbo" + i.ToString()]).Text;
                    c1.Parameters.Add("duration", duration);
                    string content = ((TextBox)Event2ndE_pnl.Controls["SecContentE_txt" + i.ToString()]).Text;
                    c1.Parameters.Add("content", content);
                    string title = ((TextBox)Event2ndE_pnl.Controls["SecTitleE_txt" + i.ToString()]).Text;
                    c1.Parameters.Add("title", title);
                    c1.Parameters.Add("event_id", Convert.ToInt32(returnval));

                    c1.ExecuteNonQuery();
                }
                con.Close();
                MessageBox.Show("OK! Your Event Has Been Created :)", "Done Event");
                refToEmployee.Show();
                this.Hide();
            }
        }