示例#1
0
        private void UpdateMK_Click(object sender, EventArgs e)
        {
            if (this.textBox3.Text == "" || this.textBox4.Text == "")
            {
                MessageBox.Show("Insert data");
            }
            else
            {
                MarketingR i = new MarketingR();
                i.CampaignId = Convert.ToInt32(this.textBox3.Text);
                i.Budget     = Convert.ToInt32(this.textBox4.Text);

                FinanceRepository fr = new FinanceRepository();

                if (fr.UpdateBudget(i))
                {
                    MarketingRepository mr    = new MarketingRepository();
                    List <MarketingR>   iList = mr.GetAllApprovedCampaignAnd();
                    this.dataGrid2.DataSource = iList;
                    this.textBox3.Text        = "";
                    this.textBox4.Text        = "";
                }
                else
                {
                    MessageBox.Show("Insufficient Balance");
                    // MessageBox.Show("Can Not Update Campaign", "Update 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");
                }
            }
        }