private static IWorkbook huiyuanExitCard <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("所属店铺"); rowIndex++; #endregion foreach (T item in list) { ExitCardModel model = item as ExitCardModel; //每遍历一条数据创建一行 row = sheet.CreateRow(rowIndex); //创建行中的单元格 row.CreateCell(0).SetCellValue(model.memberName); row.CreateCell(1).SetCellValue(model.DateTimeCard); row.CreateCell(2).SetCellValue(model.saleMen); row.CreateCell(3).SetCellValue(model.CardMoney); row.CreateCell(4).SetCellValue(model.CardType); row.CreateCell(5).SetCellValue(model.DPName); rowIndex++; } return(sheet.Workbook); }
public bool ExitCard(ExitCardModel model) { string dpname = FilterClass.DianPu1.UserName.Trim(); model.DPName = dpname; return(dal.ExitCard(model)); }
//在统计报表中显示的信息 显示的退卡信息 public List <ExitCardModel> SelectAllList(string begindate, string enddate, string dpname) { List <ExitCardModel> list = new List <ExitCardModel>(); ExitCardModel model; string str = ""; //SqlParameter[] pms; if (dpname == "全部") { foreach (KeyValuePair <string, int> iteam in FilterClass.dic) { str += "select * from "; str += "ExitCard" + iteam.Value + ""; str += " where DateTimeCard between '" + begindate + "' and '" + enddate + "'"; str += " union all "; } } else if (dpname == "") { string dpna = FilterClass.DianPu1.UserName; str = "select * from ExitCard" + ID + " where DateTimeCard BETWEEN '" + begindate + "' and '" + enddate + "'"; } else { int id = FilterClass.dic[dpname.Trim()]; str = "select * from ExitCard where DateTimeCard" + id + " BETWEEN '" + begindate + "' and '" + enddate + "'"; } SqlDataReader read = SqlHelper.ExecuteReader(str); while (read.Read()) { if (read.HasRows) { model = new ExitCardModel(); model.memberName = read["memberName"].ToString().Trim(); model.DateTimeCard = read["DateTimeCard"].ToString().Trim(); model.saleMen = read["saleMen"].ToString().Trim(); model.CardMoney = read["CardMoney"].ToString().Trim(); model.CardType = read["CardType"].ToString().Trim(); model.DPName = read["DPName"].ToString().Trim(); model.ID = Convert.ToInt32(read["ID"]); list.Add(model); } } return(list); }
private void button1_Click(object sender, EventArgs e) { bool result = bll.deleteInfoModel(zhanshimolde.ID.ToString().Trim()); if (result) { ExitCardModel model = new ExitCardModel(); model.CardMoney = textBox7.Text.Trim(); model.CardType = zhanshimolde.cardType; model.memberName = zhanshimolde.memberName; model.DateTimeCard = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); model.saleMen = FilterClass.DianPu1.LoginName; result = exitbll.ExitCard(model); if (result) { MessageBox.Show("退卡成功!"); bind1(); this.Close(); return; } } MessageBox.Show("失败,请稍后再试!"); }
//添加退卡信息 public bool ExitCard(ExitCardModel model) { if (ID == null) { return(false); } bool result = false; string str = "insert into ExitCard" + ID + "(memberName,DateTimeCard,saleMen,CardMoney,CardType,DPName) values(@memberName,@DateTimeCard,@saleMen,@CardMoney,@CardType,@DPName)"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@memberName", model.memberName), new SqlParameter("@DateTimeCard", model.DateTimeCard), new SqlParameter("@saleMen", model.saleMen), new SqlParameter("@CardMoney", model.CardMoney), new SqlParameter("@CardType", model.CardType), new SqlParameter("@DPName", model.DPName) }; if (SqlHelper.ExecuteNonQuery(str, pms) > 0) { result = true; } return(result); }