110,561
社区成员
发帖
与我相关
我的任务
分享
private bool SaveBill()
{
if (this.txtBillNo.Text.Trim() == string.Empty
|| this.txtBillNo.Text.Trim().ToUpper() == this.BillPrefix) //文本框如果输入空或者大写后等于BillPrefix 条件成立
{
this.ShowInfo("请按规则录入单号。"); //显示"请按规则录入单号。"
this.txtBillNo.Focus(); // 光标定位为txtBillno
return false; //返回假
}
if (this.cboStorage.SelectedIndex < 0) //cboStorage如果没有选择 条件成立
{
this.ShowInfo("请选择仓库。");
this.cboStorage.Focus();
return false;
}
if (this.txtBizer.Tag == null) //txtBizer的tag为空 条件成立
{
this.ShowInfo("请输入" + this.BizerTitle + "。");
this.txtBizer_GotFocus(null, null);
this.cboStorage.Focus(); //光标定位
return false;
}
if (_grid.Count == 0) //_grid的数量为0
{
this.ShowInfo("没有记录保存。");
return false;
}
BizerInfo bizer = (BizerInfo)this.txtBizer.Tag;
BizBillInfo info = new BizBillInfo(); //重NEW 一个新的BizBillInfo Class, 叫info
info.BillNo = this.txtBillNo.Text.Trim(); //info的BillNo 等于文本框txtBillNo的内容
info.BillDate = DateTime.Now; //info的日期等于当前
info.StorageId = int.Parse(this.cboStorage.SelectedValue.ToString()); //info的StorageId等于cboStorage选择的值
info.StorageName = this.cboStorage.Text.Trim(); //info的StorageName等于cboStorage的内容
info.BizerId = bizer.BizerId; //类似以上
info.BizerName = bizer.BizerName;
info.InputMan = "mobile";
info.Remark = string.Empty;
info.Amount = _grid.Amount;
info.Money = _grid.Money;
this.ShowStatus("正在保存信息");
this.SaveBill(info, _grid.ProductList.ToArray());
this.HideStatus();
this.HasSaved = true;
return true; //返回真
}