예제 #1
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "" || this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text == "" || this.textBox5.Text == "")
            {
                MessageBox.Show("Insert the data");
            }
            else
            {
                string campaignId = this.textBox1.Text;

                MarketingRepository mr = new MarketingRepository();

                if (mr.Delete(campaignId))
                {
                    List <MarketingR> iList = mr.GetAllCampaign();
                    this.dataGrid1.DataSource = iList;

                    this.textBox1.Text        = "";
                    this.textBox2.Text        = "";
                    this.textBox3.Text        = "";
                    this.textBox4.Text        = "";
                    this.textBox5.Text        = "";
                    this.dateTimePicker1.Text = "";
                    this.dateTimePicker2.Text = "";
                }
                else
                {
                    MessageBox.Show("Can Not Delete Campaign", "Delete Error");
                }
            }
        }
예제 #2
0
        private void insertBtn_Click(object sender, EventArgs e)
        {
            if (this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text == "" || this.textBox5.Text == "")
            {
                MessageBox.Show("Please insert data");
            }

            else
            {
                //(ProductName,ProductId,Volume,Price,Store,Category,Tax)
                MarketingR i = new MarketingR();

                i.CampaignName = this.textBox2.Text;
                i.Objective    = this.textBox3.Text;
                i.Placement    = this.textBox4.Text;
                i.EmployeeName = this.textBox5.Text;
                i.LaunchDate   = this.dateTimePicker1.Value.ToShortDateString();
                i.EndDate      = this.dateTimePicker2.Value.ToShortDateString();
                i.RunningCost  = 0;
                i.Report       = "";
                i.Budget       = 0;
                i.Status       = "Not Approved";

                MarketingRepository mr = new MarketingRepository();
                if (mr.Insert(i))
                {
                    List <MarketingR> iList = mr.GetAllCampaign();
                    this.dataGrid1.DataSource = iList;

                    this.textBox1.Text        = "";
                    this.textBox2.Text        = "";
                    this.textBox3.Text        = "";
                    this.textBox4.Text        = "";
                    this.textBox5.Text        = "";
                    this.dateTimePicker1.Text = "";
                    this.dateTimePicker2.Text = "";

                    this.comboBox1.Text = "";
                }
                else
                {
                    MessageBox.Show("Can Not Insert Campaign", "Insert Error");
                }
            }
        }
예제 #3
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "" || this.textBox2.Text == "" || this.textBox3.Text == "" || this.textBox4.Text == "" || this.textBox5.Text == "")
            {
                MessageBox.Show("Insert the data");
            }

            else
            {
                MarketingR i = new MarketingR();

                i.CampaignId   = Convert.ToInt32(this.textBox1.Text);
                i.CampaignName = this.textBox2.Text;
                i.Objective    = this.textBox3.Text;
                i.Placement    = this.textBox4.Text;
                i.EmployeeName = this.textBox5.Text;
                i.LaunchDate   = this.dateTimePicker1.Value.ToShortDateString();
                i.EndDate      = this.dateTimePicker2.Value.ToShortDateString();
                i.RunningCost  = 0;
                i.Report       = "";
                i.Budget       = 0;
                i.Status       = this.comboBox1.GetItemText(this.comboBox1.SelectedItem);

                MarketingRepository mr = new MarketingRepository();
                if (mr.Update(i))
                {
                    List <MarketingR> iList = mr.GetAllCampaign();
                    this.dataGrid1.DataSource = iList;

                    this.textBox1.Text        = "";
                    this.textBox2.Text        = "";
                    this.textBox3.Text        = "";
                    this.textBox4.Text        = "";
                    this.textBox5.Text        = "";
                    this.comboBox1.Text       = "";
                    this.dateTimePicker1.Text = "";
                    this.dateTimePicker2.Text = "";
                }
                else
                {
                    MessageBox.Show("Can Not Update Campaign", "Update Error");
                }
            }
        }
예제 #4
0
        private void campaignsTab_Click(object sender, EventArgs e)
        {
            this.dataGrid.Visible  = false;
            this.dataGrid1.Visible = true;
            this.dataGrid2.Visible = false;

            this.groupBox1.Visible = true;
            this.groupBox2.Visible = false;
            this.groupBox3.Visible = false;

            MarketingRepository mr          = new MarketingRepository();
            List <MarketingR>   allCampaign = mr.GetAllCampaign();

            this.dataGrid1.DataSource = allCampaign;

            dataGrid1.Columns[7].Visible = false;
            dataGrid1.Columns[8].Visible = false;
            dataGrid1.Columns[9].Visible = false;
        }