请高手帮忙解释一下这段代码的意思?

lijizun 2009-04-21 10:07:21
private bool SaveBill()
{
if (this.txtBillNo.Text.Trim() == string.Empty
|| this.txtBillNo.Text.Trim().ToUpper() == this.BillPrefix)
{
this.ShowInfo("请按规则录入单号。");
this.txtBillNo.Focus();
return false;
}
if (this.cboStorage.SelectedIndex < 0)
{
this.ShowInfo("请选择仓库。");
this.cboStorage.Focus();
return false;
}
if (this.txtBizer.Tag == null)
{
this.ShowInfo("请输入" + this.BizerTitle + "。");
this.txtBizer_GotFocus(null, null);
this.cboStorage.Focus(); //光标定位
return false;
}
if (_grid.Count == 0)
{
this.ShowInfo("没有记录保存。");
return false;
}
BizerInfo bizer = (BizerInfo)this.txtBizer.Tag;
BizBillInfo info = new BizBillInfo();
info.BillNo = this.txtBillNo.Text.Trim();
info.BillDate = DateTime.Now;
info.StorageId = int.Parse(this.cboStorage.SelectedValue.ToString());
info.StorageName = this.cboStorage.Text.Trim();
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;
}
...全文
156 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wartim 2009-04-21
  • 打赏
  • 举报
回复
private bool 保存单据()
{
if (单据编号没填
|| 单据编号只填了单据固定前缀(意思是只输入了前缀忘了加编号等信息?))
{
this.ShowInfo("请按规则录入单号。");
单据编号控件获得焦点;
返回false继续重输;
}
if (仓库下拉框没选)
{
this.ShowInfo("请选择仓库。");
仓库下拉框控件获得焦点;
返回false继续重输;
}
if (this.txtBizer.Tag == null) Bizer是什么东东
{
this.ShowInfo("请输入" + this.BizerTitle + "。");
this.txtBizer_GotFocus(null, null); 好像是实现一个功能:输入一些信息给一个类实例,然后把类实例存在tag里
this.cboStorage.Focus(); //光标定位
return false; 重输
}
if (产品明细数据表格里一条记录也没有)
{
this.ShowInfo("没有记录保存。");
return false; 重输
}
BizerInfo bizer = (BizerInfo)this.txtBizer.Tag; Tag里事前存了一个类实例(真是多此一举)
BizBillInfo info = new BizBillInfo(); 单据类
info.BillNo = this.txtBillNo.Text.Trim(); 一下保存参数进这个类
info.BillDate = DateTime.Now;
info.StorageId = int.Parse(this.cboStorage.SelectedValue.ToString());
info.StorageName = this.cboStorage.Text.Trim();
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()); // 类实例值都赋好了,调用savebill的重载方法实际存数据给数据库
this.HideStatus();
this.HasSaved = true;
return true;
}
Myth_NiuNiu 2009-04-21
  • 打赏
  • 举报
回复
晕了,不就一个保存吗?
zgke 2009-04-21
  • 打赏
  • 举报
回复
检查 附值 保存
peterb 2009-04-21
  • 打赏
  • 举报
回复
好像是一个类似于仓库系统保存入库单方法,先对输入的内容进行验证,合法的话就保存到库中
pennymay 2009-04-21
  • 打赏
  • 举报
回复

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; //返回真
}

热学沸腾56 2009-04-21
  • 打赏
  • 举报
回复
up,mark
ericzhangbo1982111 2009-04-21
  • 打赏
  • 举报
回复
这个。。。。怎么解释呢。!
哎!

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧