private static IWorkbook huiyuanExitDan <T>(List <T> list, ISheet sheet) { int rowIndex = 0; IRow row = sheet.CreateRow(rowIndex); #region MyRegion//表头 row.CreateCell(0).SetCellValue("会员名称"); row.CreateCell(1).SetCellValue("会员卡号"); row.CreateCell(2).SetCellValue("业务员"); row.CreateCell(3).SetCellValue("所属店铺"); row.CreateCell(4).SetCellValue("金额"); row.CreateCell(5).SetCellValue("服务名称"); row.CreateCell(6).SetCellValue("退单时间"); rowIndex++; #endregion foreach (T item in list) { ExitDanModel model = item as ExitDanModel; //每遍历一条数据创建一行 row = sheet.CreateRow(rowIndex); //创建行中的单元格 row.CreateCell(0).SetCellValue(model.memberName); row.CreateCell(1).SetCellValue(model.memberCardNo); row.CreateCell(2).SetCellValue(model.saleMen); row.CreateCell(3).SetCellValue(model.DPName); row.CreateCell(4).SetCellValue(model.DanMoney); row.CreateCell(5).SetCellValue(model.StaffName); row.CreateCell(6).SetCellValue(model.ExitDanTime); rowIndex++; } return(sheet.Workbook); }
//查询退弹信息 在统计报表中显示 public List <ExitDanModel> SelectAllList(string begindate, string enddate, string dpname) { List <ExitDanModel> list = new List <ExitDanModel>(); string dpna = FilterClass.DianPu1.UserName; ExitDanModel model; string str = ""; if (dpname == "全部") { foreach (KeyValuePair <string, int> iteam in FilterClass.dic) { str += "select * from "; str += "ExitDan" + iteam.Value + ""; str += " where ExitDanTime between '" + begindate + "' and '" + enddate + "'"; str += " union all "; } str = str.Substring(0, str.Length - 10); } else if (dpname == "") { str = "select * from ExitDan" + ID + " where ExitDanTime BETWEEN '" + begindate + "' and '" + enddate + "'"; } else { int id = FilterClass.dic[dpname.Trim()]; str = "select * from ExitDan" + id + " where ExitDanTime BETWEEN '" + begindate + "' and '" + enddate + "'"; } SqlDataReader read = SqlHelper.ExecuteReader(str); while (read.Read()) { if (read.HasRows) { model = new ExitDanModel(); model.ID = Convert.ToInt32(read["ID"]); model.memberName = read["memberName"].ToString().Trim(); model.memberCardNo = read["memberCardNo"].ToString().Trim(); model.saleMen = read["saleMen"].ToString().Trim(); model.DPName = read["DPName"].ToString().Trim(); model.DanMoney = read["DanMoney"].ToString().Trim(); model.StaffName = read["StaffName"].ToString().Trim(); model.ExitDanTime = read["ExitDanTime"].ToString().Trim(); model.IsMoney = read["IsMoney"].ToString(); list.Add(model); } } return(list); }
//添加退单信息 public void AddExitDan(ExitDanModel model) { if (ID == null) { return; } string str = "insert into ExitDan" + ID + "(memberName,memberCardNo,saleMen,DPName,DanMoney,StaffName,ExitDanTime,IsMoney) values(@memberName,@memberCardNo,@saleMen,@DPName,@DanMoney,@StaffName,@ExitDanTime,@IsMoney)"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@memberName", model.memberName), new SqlParameter("@memberCardNo", model.memberCardNo), new SqlParameter("@saleMen", model.saleMen), new SqlParameter("@DPName", model.DPName), new SqlParameter("@DanMoney", model.DanMoney), new SqlParameter("@StaffName", model.StaffName), new SqlParameter("@ExitDanTime", model.ExitDanTime), new SqlParameter("@IsMoney", model.IsMoney) }; SqlHelper.ExecuteNonQuery(str, pms); }
public void AddExitDan(ExitDanModel model) { dal.AddExitDan(model); }