Exemple #1
0
 /// <summary>
 /// 修改计划1
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPlan1Update_Click(object sender, EventArgs e)
 {
     if (btnPlan1Update.Text == "修改")
     {
         txtPlan1.ReadOnly   = false;
         btnPlan1Update.Text = "确定修改";
     }
     else if (btnPlan1Update.Text == "添加")
     {
         txtPlan1.ReadOnly   = false;
         btnPlan1Update.Text = "确定添加";
     }
     else if (btnPlan1Update.Text == "确定修改" || btnPlan1Update.Text == "确定添加")//执行添加
     {
         FrmUpdateWhy frm = new FrmUpdateWhy(this);
         frm.ShowDialog();
         txtPlan1.ReadOnly = true;
         Plan plan = new Plan();
         plan.CreateTime  = DateTime.Now;
         plan.MyPlanType  = PlanType.LongPlan;
         plan.PlanContent = txtPlan1.Text;
         plan.PlanName    = "计划1";
         plan.PlanWhy     = whyStr;
         if (dataOperation.AddPlan(plan))
         {
             MessageBox.Show("修改成功!");
             UpdatePlan();
         }
         else
         {
             MessageBox.Show("修改失败!");
         }
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.textBox1.Text == "")
     {
         MessageBox.Show("要添加的内容不能空!");
     }
     else
     {
         string[] sentences = this.textBox1.Text.Split('|');
         int      count     = 0;
         foreach (string item in sentences)
         {
             if (item != "")
             {
                 Plan plan = new Plan();
                 plan.CreateTime  = DateTime.Now;
                 plan.MyPlanType  = PlanType.Sentence;
                 plan.PlanContent = item;
                 plan.PlanName    = "";
                 plan.PlanWhy     = "";
                 if (dp.AddPlan(plan))
                 {
                     count++;
                 }
             }
         }
         MessageBox.Show("成功添加了 " + count + " 条!");
         InitialStatu();
     }
 }
Exemple #3
0
        private void btnAddPlan_Click(object sender, EventArgs e)
        {
            if (txt1.Text == "" || txt2.Text == "" || txt3.Text == "" || txt4.Text == "")
            {
                MessageBox.Show("内容不能为空,均要填写!");
                return;
            }
            DialogResult result = MessageBox.Show("每日计划创建后是不能修改的,确定这样创建吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                Plan plan = new Plan();
                plan.CreateTime  = DateTime.Now;
                plan.MyPlanType  = PlanType.DayPlan;
                plan.PlanContent = txt1.Text + "|" + txt2.Text + "|" + txt3.Text + "|" + txt4.Text;
                plan.PlanName    = "";
                plan.PlanWhy     = "";
                if (dp.AddPlan(plan))
                {
                    MessageBox.Show("创建成功!");
                    btnAddPlan.Enabled = false;
                    btnAddPlan.Text    = "想修改每日计划?问问开发者吧";
                }
                else
                {
                    MessageBox.Show("发生错误!创建失败!");
                }
            }
        }
Exemple #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text == "计划1" || comboBox1.Text == "计划2" || comboBox1.Text == "计划3" || comboBox1.Text == "计划4" || comboBox1.Text == "计划5")
     {
         MessageBox.Show("不能使用这个名字作为类型名!");
         return;
     }
     if (txtA.Text == "" || txtB.Text == "" || txtC.Text == "" || txtD.Text == "" || txtTitle.Text == "" || comboBox1.Text == "")
     {
         MessageBox.Show("内容不能为空!");
     }
     else
     {
         Plan question = new Plan();
         question.MyPlanType = PlanType.Question;
         question.CreateTime = DateTime.Now;
         //数据的格式是:标题|选项A|选项B|选项C|选项D|正确答案
         string rightStr = "";
         if (rdoA.Checked)
         {
             rightStr = "A";
         }
         else if (rdoB.Checked)
         {
             rightStr = "B";
         }
         else if (rdoC.Checked)
         {
             rightStr = "C";
         }
         else if (rdoD.Checked)
         {
             rightStr = "D";
         }
         question.PlanContent = txtTitle.Text + "|" + txtA.Text + "|" + txtB.Text + "|" + txtC.Text + "|" + txtD.Text + "|" + rightStr;
         string planName = comboBox1.Text;
         question.PlanName = planName;
         question.PlanWhy  = "";
         if (dp.AddPlan(question))
         {
             MessageBox.Show("添加成功!");
             txtTitle.Text = "";
             txtA.Text     = "";
             txtB.Text     = "";
             txtC.Text     = "";
             txtD.Text     = "";
             main.InitialQuestionType();
         }
         else
         {
             MessageBox.Show("发生错误!添加失败!");
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Plan plan = new Plan();

            plan.CreateTime  = DateTime.Now;
            plan.MyPlanType  = PlanType.Diary;
            plan.PlanContent = txtContent.Text;
            plan.PlanName    = "";
            plan.PlanWhy     = "";
            if (dataOperation.AddPlan(plan))
            {
                MessageBox.Show("添加成功!");
                this.Close();
                diary.UpdateInfo();
            }
        }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != textBox2.Text)
            {
                MessageBox.Show("第一次密码必须和第二次密码一致!");
                return;
            }
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "")
            {
                Plan plan = new Plan();
                plan.MyPlanType  = PlanType.Diary;
                plan.PlanName    = "pwd";
                plan.PlanContent = textBox2.Text;
                plan.PlanWhy     = textBox3.Text;
                plan.CreateTime  = DateTime.Now;

                if (this.Text == "设置密码")
                {
                    if (dp.AddPlan(plan))
                    {
                        MessageBox.Show("设置成功!");
                    }
                    else
                    {
                        MessageBox.Show("设置失败!");
                    }
                }
                else if (this.Text == "修改密码")
                {
                    plan.Id = dp.GetPwd().Id;
                    if (dp.UpdatePwd(plan))
                    {
                        MessageBox.Show("修改成功!");
                    }
                    else
                    {
                        MessageBox.Show("发生错误,修改失败");
                    }
                }
            }
            else
            {
                MessageBox.Show("内容不能有空!");
            }
        }
Exemple #7
0
        private void btnAddPlan_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("年度计划创建后是不能修改的,确定这样创建吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                Plan plan = new Plan();
                plan.CreateTime  = DateTime.Now;
                plan.MyPlanType  = PlanType.YearPlan;
                plan.PlanContent = this.textBox1.Text;
                plan.PlanName    = "";
                plan.PlanWhy     = "";
                if (dp.AddPlan(plan))
                {
                    MessageBox.Show("创建成功!");
                    btnAddPlan.Enabled = false;
                    btnAddPlan.Text    = "想修改年度计划?问问开发者吧";
                }
                else
                {
                    MessageBox.Show("发生错误!创建失败!");
                }
            }
        }