private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("定价不能为空!"); textBox1.Focus(); return; } IDictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("isbn", label7.Text); parameters.Add("fixedPrice", textBox1.Text); parameters.Add("name", label9.Text); parameters.Add("press", ("" == label8.Text) ? "无" : label8.Text); parameters.Add("author", ("" == label10.Text)? "无" : label10.Text); string gbookid; if (yg.InsertNewBookInfo(parameters, out gbookid)) { YouGeWinformApi.Localbookinfo lbi = new YouGeWinformApi.Localbookinfo(); lbi.author = label10.Text; lbi.fixedprice = textBox1.Text; lbi.guid = gbookid; lbi.imgpath = ""; lbi.isbn = label7.Text; lbi.name = label9.Text; lbi.press = label8.Text; if (ygw.InsertNewBookInfo(lbi, out gbookid)) { MessageBox.Show("添加成功,重新搜索即可查到"); return; } } MessageBox.Show("添加失败,请在网络状态良好的情况下重试"); MyOperation.DebugPrint("复制图书信息失败,请在网络状态良好的情况下重试"); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { MessageBox.Show("请输入书名"); textBox1.Focus(); return; } if (string.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("请输入作者"); textBox2.Focus(); return; } if (string.IsNullOrEmpty(textBox3.Text)) { MessageBox.Show("请输入出版社"); textBox3.Focus(); return; } if (string.IsNullOrEmpty(textBox4.Text)) { MessageBox.Show("请输入定价"); textBox4.Focus(); return; } if (string.IsNullOrEmpty(textBox5.Text)) { MessageBox.Show("请输入ISBN"); textBox5.Focus(); return; } IDictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("isbn", textBox5.Text); parameters.Add("fixedPrice", textBox4.Text); parameters.Add("name", textBox1.Text); parameters.Add("press", textBox3.Text); parameters.Add("author", textBox2.Text); string gbookid; if (yg.InsertNewBookInfo(parameters, out gbookid)) { YouGeWinformApi.Localbookinfo lbi = new YouGeWinformApi.Localbookinfo(); lbi.author = textBox2.Text; lbi.fixedprice = textBox4.Text; lbi.guid = gbookid; lbi.imgpath = ""; lbi.isbn = textBox5.Text; lbi.name = textBox1.Text; lbi.press = textBox3.Text; if (ygw.InsertNewBookInfo(lbi, out gbookid)) { MessageBox.Show("添加成功,重新搜索即可查到"); this.Dispose(); return; } } MessageBox.Show("添加失败,请在网络状态良好的情况下重试"); MyOperation.DebugPrint("添加图书信息失败,请在网络状态良好的情况下重试"); }