private void txt_branch_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txt_branch.Text.Trim())) { errMsg = "请输入仓库"; return; } { errMsg = ""; } string branch = this.txt_branch.Text.Trim(); IBLL.IBranch bll = new BLL.BranchBLL(); bi_t_branch_info branch_Info = new bi_t_branch_info() { branch_no = branch }; branch_Info = bll.GetItem(branch_Info); if (branch_Info == null || string.IsNullOrEmpty(branch_Info.branch_no)) { frmSelect frm = new frmSelect("5", branch); frm.ShowDialog(); if (frm.item_no != "") { if (frm.item_no != "") { branch_Info.branch_no = frm.item_no; branch_Info = bll.GetItem(branch_Info); } } } this.branch = branch_Info; if (branch_Info == null || string.IsNullOrEmpty(branch_Info.branch_no)) { errMsg = "仓库不存在"; this.lbl_branch.Text = ""; this.txt_branch.Text = ""; } else { errMsg = ""; this.lbl_branch.Text = branch_Info.branch_name; this.txt_branch.Text = branch_Info.branch_no; } }
private void OK() { IBLL.IBranch bll = new BLL.BranchBLL(); if (branch == null || string.IsNullOrEmpty(branch.branch_no)) { //添加 bi_t_branch_info banks = new bi_t_branch_info() { display_flag = checkIsStop.Checked ? "0" : "1", branch_no = txtBranchNo.Text, branch_name = txtBranchName.Text, branch_man = txtBranchMan.Text, update_time = DateTime.Now, }; bll.Add(banks); if (banks.branch_no.Length == 2) { banks = new bi_t_branch_info() { display_flag = checkIsStop.Checked ? "0" : "1", branch_no = txtBranchNo.Text + "01", branch_name = txtBranchName.Text, branch_man = txtBranchMan.Text, update_time = DateTime.Now, }; bll.Add(banks); } } else { //修改 branch.display_flag = this.checkIsStop.Checked ? "0" : "1"; branch.branch_name = this.txtBranchName.Text; branch.branch_man = this.txtBranchMan.Text; branch.address = this.txtBranchAddres.Text; branch.update_time = DateTime.Now; bll.Upload(branch); } }