private void submit_btn_Click(object sender, EventArgs e) { if (zengjiadao_textbox.Enabled == true) { if (!CheckString.CheckUInt(zengjiadao_textbox.Text.Trim())) { MessageBox.Show("请检查修改数量是否填写正确", "数量填写错误"); } else { Connector.Replenishment(1, isbn_textbox.Text.Trim(), int.Parse(zengjiadao_textbox.Text.Trim())); } } else { if (!CheckString.CheckUInt(zengjia_textbox.Text.Trim())) { MessageBox.Show("请检查增加数量是否填写正确", "数量填写错误"); } else { Connector.Replenishment(2, isbn_textbox.Text.Trim(), int.Parse(zengjia_textbox.Text.Trim())); } } }
private void submit_Click(object sender, EventArgs e) { String pwd_sha1 = SecurityUnit.EncryptToSHA1(pwd_textbox.Text.Trim()); if (mode == 1) { Connector.AddNewVip(num_textbox.Text.Trim(), name_textbox.Text.Trim(), pwd_sha1, phone_textbox.Text.Trim(), mail_textbox.Text.Trim()); num_textbox.Text = Connector.GetNewVipNum(); this.dataGridView1.DataSource = Connector.SelectVipTTable().Tables[0].DefaultView; name_textbox.Text = ""; pwd_textbox.Text = ""; phone_textbox.Text = ""; mail_textbox.Text = ""; } else if (mode == 2) { if (!CheckString.CheckUInt(num_textbox.Text.Trim())) { MessageBox.Show("编号填写错误", "编号错误"); } else { Connector.UpgradeVipLevel(num_textbox.Text.Trim()); this.dataGridView1.DataSource = Connector.SelectVipTTable().Tables[0].DefaultView; for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { if (dt.Rows[i].ItemArray[0].ToString().Equals(num_textbox.Text.Trim())) { name_textbox.Text = dt.Rows[i].ItemArray[1].ToString(); pwd_textbox.Text = dt.Rows[i].ItemArray[2].ToString(); phone_textbox.Text = dt.Rows[i].ItemArray[3].ToString(); mail_textbox.Text = dt.Rows[i].ItemArray[4].ToString(); level_textbox.Text = dt.Rows[i].ItemArray[5].ToString(); break; } } num_textbox.Enabled = false; } } else if (mode == 3) { Connector.ChangeVipInfo(num_textbox.Text.Trim(), name_textbox.Text.Trim(), pwd_sha1, phone_textbox.Text.Trim(), mail_textbox.Text.Trim()); this.dataGridView1.DataSource = Connector.SelectVipTTable().Tables[0].DefaultView; } }
private void button1_Click(object sender, EventArgs e) { if (!CheckString.CheckUInt(num_textbox.Text.Trim())) { MessageBox.Show("编号填写错误", "编号错误"); } else { for (int i = 0; i < dt.Rows[0].ItemArray.Length; i++) { if (dt.Rows[i].ItemArray[0].ToString().Equals(num_textbox.Text.Trim())) { name_textbox.Text = dt.Rows[i].ItemArray[1].ToString(); pwd_textbox.Text = dt.Rows[i].ItemArray[2].ToString(); phone_textbox.Text = dt.Rows[i].ItemArray[3].ToString(); mail_textbox.Text = dt.Rows[i].ItemArray[4].ToString(); level_textbox.Text = dt.Rows[i].ItemArray[5].ToString(); break; } } num_textbox.Enabled = false; } }
private void SubmitSell(object sender, EventArgs e) { if (!CheckString.CheckISBN(isbn_textbox.Text.Trim())) { MessageBox.Show("请检查ISBN填写是否正确", "ISBN格式错误"); } else if (!CheckString.CheckUInt(num_textbox.Text.Trim()) || int.Parse(num_textbox.Text.Trim()) == 0) { MessageBox.Show("请检查数量填写是否正确", "数量错误"); } else { money_textbox.Text = (double.Parse(Connector.GetPrice(isbn_textbox.Text.Trim())) * int.Parse(num_textbox.Text.Trim())).ToString(); String ISBN = isbn_textbox.Text.Trim(); int num = int.Parse(num_textbox.Text.Trim()); String TranMode = mode_textbox.Text.Trim(); String Remarks = remarks_textbox.Text.Trim(); Int64 VipNum; String time; double money = Double.Parse(money_textbox.Text.Trim()); bool flag = true; if (Object.Equals(vipnum_textbox.Text.Trim(), "")) { vipnum_textbox.Text = "0"; VipNum = 0; } else { if (!CheckString.CheckUInt(vipnum_textbox.Text.Trim())) { MessageBox.Show("会员编号填写错误", "会员编号错误"); VipNum = 0; flag = false; } else { VipNum = Int64.Parse(vipnum_textbox.Text.Trim()); } } if (Object.Equals(time_textbox.Text.Trim(), "")) { time_textbox.Text = string.Format("{0:G}", DateTime.Now); time = string.Format("{0:G}", System.DateTime.Now); } else { if (!CheckString.CheckDate(time_textbox.Text.Trim())) { MessageBox.Show("交易时间填写错误", "时间格式错误"); flag = false; time = string.Format("{0:G}", System.DateTime.Now); } else { time = time_textbox.Text.Trim(); } } if (flag) { trannum_textbox.Text = SecurityUnit.EncryptToMD5(VipNum + ISBN + time + TranMode); String TranNum = trannum_textbox.Text.Trim(); MessageBoxButtons messButton = MessageBoxButtons.OKCancel; DialogResult dr = MessageBox.Show("确定?", "确认订单", messButton); if (dr == DialogResult.OK)//如果点击“确定”按钮 { if (Connector.InquireBookNumbers(ISBN) >= num) { Connector.AddToSellList(VipNum, ISBN, time, num, money, TranMode, TranNum, Remarks); Connector.Replenishment(2, ISBN, -1 * num); money_textbox.Text = ""; isbn_textbox.Text = ""; num_textbox.Text = ""; mode_textbox.Text = ""; remarks_textbox.Text = ""; trannum_textbox.Text = ""; time_textbox.Text = ""; vipnum_textbox.Text = ""; if (money > 50 && VipNum == 0) { MessageBoxButtons messButton2 = MessageBoxButtons.OKCancel; DialogResult dr2 = MessageBox.Show("添加会员吗?", "添加会员", messButton2); if (dr2 == DialogResult.OK)//如果点击“确定”按钮 { VipManage newpage = new VipManage(); newpage.Show(); } } } else { MessageBox.Show("存货不足!"); } } else//如果点击“取消”按钮 { vipnum_textbox.Text = isbn_textbox.Text = time_textbox.Text = num_textbox.Text = money_textbox.Text = mode_textbox.Text = remarks_textbox.Text = trannum_textbox.Text = ""; } } } }