/// <summary> /// 更新一条数据 /// </summary> public bool Update(SeatManage.ClassModel.AMS_SlipCustomer model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SlipCustomer set "); strSql.Append("Name=@Name,"); strSql.Append("ImageUrl=@ImageUrl,"); strSql.Append("SlipTemplate=@SlipTemplate,"); strSql.Append("EffectDate=@EffectDate,"); strSql.Append("EndDate=@EndDate,"); strSql.Append("Type=@Type,"); strSql.Append("PrintAmount=@PrintAmount,"); strSql.Append("LookOverAmount=@LookOverAmount,"); strSql.Append("CustomerImage=@CustomerImage,"); strSql.Append("CampusNum=@CampusNum, "); strSql.Append("IsPrint=@IsPrint "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@ImageUrl", SqlDbType.NVarChar, 200), new SqlParameter("@SlipTemplate", SqlDbType.Text), new SqlParameter("@EffectDate", SqlDbType.DateTime), new SqlParameter("@EndDate", SqlDbType.DateTime), new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@Id", SqlDbType.NVarChar, 20), new SqlParameter("@PrintAmount", SqlDbType.Int, 4), new SqlParameter("@LookOverAmount", SqlDbType.Int, 4), new SqlParameter("@CustomerImage", SqlDbType.NVarChar, 200), new SqlParameter("@CampusNum", SqlDbType.NVarChar, 50), new SqlParameter("@IsPrint", SqlDbType.Bit) }; parameters[0].Value = model.Name; parameters[1].Value = model.ImageName; parameters[2].Value = model.SlipTemplate; parameters[3].Value = model.EffectDate; parameters[4].Value = model.EndDate; parameters[5].Value = model.Type; parameters[6].Value = model.Id; parameters[7].Value = model.PrintAmount; parameters[8].Value = model.LookOverAmount; parameters[9].Value = model.CustomerLogo; parameters[10].Value = model.CampusNum; parameters[11].Value = model.IsPrint; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
///// <summary> ///// 增加一条数据 ///// </summary> public bool Add(SeatManage.ClassModel.AMS_SlipCustomer model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SlipCustomer("); strSql.Append("No,Name,ImageUrl,SlipTemplate,EffectDate,EndDate,Type,PrintAmount,LookOverAmount,CustomerImage,CampusNum,IsPrint,Num)"); strSql.Append(" values ("); strSql.Append("@No,@Name,@ImageUrl,@SlipTemplate,@EffectDate,@EndDate,@Type,@PrintAmount,@LookOverAmount,@CustomerImage,@CampusNum,@IsPrint,@Num)"); SqlParameter[] parameters = { new SqlParameter("@No", SqlDbType.NVarChar, 20), new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@ImageUrl", SqlDbType.NVarChar, 200), new SqlParameter("@SlipTemplate", SqlDbType.Text), new SqlParameter("@EffectDate", SqlDbType.DateTime), new SqlParameter("@EndDate", SqlDbType.DateTime), new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@PrintAmount", SqlDbType.Int, 4), new SqlParameter("@LookOverAmount", SqlDbType.Int, 4), new SqlParameter("@CustomerImage", SqlDbType.NVarChar, 200), new SqlParameter("@CampusNum", SqlDbType.NVarChar, 50), new SqlParameter("@IsPrint", SqlDbType.Bit), new SqlParameter("@Num", model.Num) }; parameters[0].Value = model.No; parameters[1].Value = model.Name; parameters[2].Value = model.ImageName; parameters[3].Value = model.SlipTemplate; parameters[4].Value = model.EffectDate; parameters[5].Value = model.EndDate; parameters[6].Value = model.Type; parameters[7].Value = model.PrintAmount; parameters[8].Value = model.LookOverAmount; parameters[9].Value = model.CustomerLogo; parameters[10].Value = model.CampusNum; parameters[11].Value = model.IsPrint; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }