Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)//确认
 {
     if (!Check())
     {
         return;
     }
     if (Operation)
     {
         row               = table.NewRow();
         row["GroupID"]    = M.GetMaxLabelGroupID();
         row["GroupName"]  = textBox1.Text.Trim();
         row["GroupOrder"] = numericUpDown1.Value;
         row["LocationID"] = LocationID;
         table.Rows.Add(row);
     }
     else
     {
         row["GroupName"]  = textBox1.Text.Trim();
         row["GroupOrder"] = numericUpDown1.Value;
         row["LocationID"] = LocationID;
     }
     LB.Update();
     LB.Reload();
     ToAdd();
 }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)//确认保存
 {
     if (!Check())
     {
         return;
     }
     if (Operation)
     {
         row = table.NewRow();
         try { MaxID = (int)table.Select("", "GroupID DESC")[0]["GroupID"] + 1; }
         catch { MaxID = 1; }
         row["GroupID"]    = MaxID;
         row["GroupName"]  = textBox1.Text.Trim();
         row["GroupOrder"] = numericUpDown1.Value;
         table.Rows.Add(row);
     }
     else
     {
         row["GroupName"]  = textBox1.Text.Trim();
         row["GroupOrder"] = numericUpDown1.Value;
     }
     LB.Update();
     LB.Reload();
     ToAdd();
 }
Ejemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)//确认
 {
     if (!Check())
     {
         return;
     }
     if (Operation)
     {
         row = table.NewRow();
         //用如下这种办法新增主键值时,表主键不要设自动增长,否则新增后立马删除会报错。因为如果是自动增长,存入的表的主键值实际是历史最大值,而DataTable存入的是本次最大值,这样就会发生找不到对应数据的情况。
         try { MaxID = (int)table.Select("", "LocationID DESC")[0]["LocationID"] + 1; }//只有地点才能用这种方式取最大ID,因为它不会分组
         catch { MaxID = 1; }
         row["LocationID"]    = MaxID;
         row["LocationName"]  = textBox1.Text.Trim();
         row["LocationOrder"] = numericUpDown1.Value;
         table.Rows.Add(row);
     }
     else
     {
         row["LocationName"]  = textBox1.Text.Trim();
         row["LocationOrder"] = numericUpDown1.Value;
     }
     LB.Update();
     LB.Reload();
     ToAdd();
 }
Ejemplo n.º 4
0
 private void button2_Click(object sender, EventArgs e)//确认保存
 {
     if (!Check())
     {
         return;
     }
     if (Operation)
     {
         row = table.NewRow();
         try { MaxID = (int)table.Select("", "ID DESC")[0]["ID"] + 1; }
         catch { MaxID = 1; }
         row["ID"]        = MaxID;
         row["Title"]     = textBox1.Text.Trim();
         row["YearN"]     = dateTimePicker1.Value.Year;
         row["MonthN"]    = dateTimePicker1.Value.Month;
         row["DayN"]      = dateTimePicker1.Value.Day;
         row["ValidYear"] = checkBox1.Checked;
         table.Rows.Add(row);
     }
     else
     {
         row["Title"]     = textBox1.Text.Trim();
         row["YearN"]     = dateTimePicker1.Value.Year;
         row["MonthN"]    = dateTimePicker1.Value.Month;
         row["DayN"]      = dateTimePicker1.Value.Day;
         row["ValidYear"] = checkBox1.Checked;
     }
     LB.Update();
     LB.Reload();
     ToAdd();
 }
Ejemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)//日记本管理
 {
     new Groups().ShowDialog();
     LB.Reload();
     try { LB.SelectedIndex = 0; }
     catch { LB.SelectedIndex = -1; }
     ShowData();
 }
Ejemplo n.º 6
0
 void ReloadGroups()//重载笔记本列表
 {
     LB.Reload();
     CBB.Reload();
 }