谁能帮我啊
我想把本月的收入查询出来并且算出总营业额也可以直接联系我QQ:307619191
用的三层模式
程序代码:
Model层 namespace Model { public class BetrayInFo { private int _BetrayID; /** * 卖出编号 **/ public int BetrayID { get { return _BetrayID; } set { _BetrayID = value; } } private string _BetrayName; /** * 卖出商品 **/ public string BetrayName { get { return _BetrayName; } set { _BetrayName = value; } } private string _BetrayTypes; /** * 卖出型号 **/ public string BetrayTypes { get { return _BetrayTypes; } set { _BetrayTypes = value; } } private string _BetrayType; /** * 卖出类型 **/ public string BetrayType { get { return _BetrayType; } set { _BetrayType = value; } } private int _BetrayMoney; /** * 卖出单价 **/ public int BetrayMoney { get { return _BetrayMoney; } set { _BetrayMoney = value; } } private int _BetrayMoneys; /** * 卖出总价 **/ public int BetrayMoneys { get { return _BetrayMoneys; } set { _BetrayMoneys = value; } } private int _BetrayAmount; /** * 卖出数量 **/ public int BetrayAmount { get { return _BetrayAmount; } set { _BetrayAmount = value; } } private int _BetrayMone; public int BetrayMone { get { return _BetrayMone; } set { _BetrayMone = value; } } private string _BetrayNames; /** * 购买人 **/ public string BetrayNames { get { return _BetrayNames; } set { _BetrayNames = value; } } private string _BetrayZhangTai; public string BetrayZhangTai { get { return _BetrayZhangTai; } set { _BetrayZhangTai = value; } } private DateTime _BetrayTimes; public DateTime BetrayTimes { get { return _BetrayTimes; } set { _BetrayTimes = value; } } private DateTime _BetrayTime; /** * 卖出时间 **/ private DateTime _BetrayTim; public DateTime BetrayTim { get { return _BetrayTim; } set { _BetrayTim = value; } } public DateTime BetrayTime { get { return _BetrayTime; } set { _BetrayTime = value; } } private string _Betraybeizhu; public string Betraybeizhu { get { return _Betraybeizhu; } set { _Betraybeizhu = value; } } } DAL层 public List<BetrayInFo> Selrcts(BetrayInFo entity) { string strSQL = "select * from Betray where 1=1 and BetrayZhangTai='已付清'"; List<BetrayInFo> objItems = new List<BetrayInFo>(); if (entity != null) { strSQL = strSQL + " and BetrayTimes between '" + entity.BetrayTimes + "' and '" + entity.BetrayTim + "'"; } using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnString, CommandType.Text, strSQL, null)) { while (rdr.Read()) { BetrayInFo objinfo = new BetrayInFo(); objinfo.BetrayID = Convert.ToInt32(rdr["BetrayID"]); objinfo.BetrayName = rdr["BetrayName"].ToString(); objinfo.BetrayTypes = rdr["BetrayTypes"].ToString(); objinfo.BetrayType = rdr["BetrayType"].ToString(); objinfo.BetrayMoney = Convert.ToInt32(rdr["BetrayMoney"]); objinfo.BetrayMoneys = Convert.ToInt32(rdr["BetrayMoneys"]); objinfo.BetrayMone = Convert.ToInt32(rdr["BetrayMone"]); objinfo.BetrayAmount = Convert.ToInt32(rdr["BetrayAmount"]); objinfo.BetrayNames = rdr["BetrayNames"].ToString(); objinfo.BetrayZhangTai = rdr["BetrayZhangTai"].ToString(); objinfo.BetrayTimes = Convert.ToDateTime(rdr["BetrayTimes"]); objinfo.BetrayTime = Convert.ToDateTime(rdr["BetrayTime"]); objinfo.Betraybeizhu = rdr["Betraybeizhu"].ToString(); objItems.Add(objinfo); } } return objItems; } BLL层 public static List<BetrayInFo> Selrcts(BetrayInFo entity) { BetrayDAL dal = new BetrayDAL(); return dal.Selrcts(entity); } 界面层 public BetrayInFo Obinfos { get { BetrayInFo obj = new BetrayInFo(); if (dateTimePicker3.Text != "") { obj.BetrayTimes = dateTimePicker3.Value; } if (dateTimePicker4.Text != "") { obj.BetrayTim = dateTimePicker4.Value; } return obj; } set { if (value != null) { dateTimePicker3.Value = value.BetrayTimes; } if (value != null) { dateTimePicker4.Value = value.BetrayTim; } } } private void btnJieSuan_Click(object sender, EventArgs e) { dataGridView4.DataSource = BLL.BetrayBLL.Selrcts(Obinfos); MessageBox.Show("执行完毕!"); }