/// <summary> /// 更新一条数据 /// </summary> public bool Update(KryptonAccessController.AccessDataBase.Model.InteractHoliday model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update InteractHoliday set "); strSql.Append("InteractHolidayName=@InteractHolidayName,"); strSql.Append("InteractHolidayDate=@InteractHolidayDate,"); strSql.Append("InteractHolidayType=@InteractHolidayType"); strSql.Append(" where InteractHolidayID=@InteractHolidayID "); SqlParameter[] parameters = { new SqlParameter("@InteractHolidayName", SqlDbType.NVarChar, 50), new SqlParameter("@InteractHolidayDate", SqlDbType.NVarChar, 10), new SqlParameter("@InteractHolidayType", SqlDbType.Int, 4), new SqlParameter("@InteractHolidayID", SqlDbType.Int, 4) }; parameters[0].Value = model.InteractHolidayName; parameters[1].Value = model.InteractHolidayDate; parameters[2].Value = model.InteractHolidayType; parameters[3].Value = model.InteractHolidayID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.InteractHoliday DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.InteractHoliday model=new KryptonAccessController.AccessDataBase.Model.InteractHoliday(); if (row != null) { if(row["InteractHolidayID"]!=null && row["InteractHolidayID"].ToString()!="") { model.InteractHolidayID=int.Parse(row["InteractHolidayID"].ToString()); } if(row["InteractHolidayName"]!=null) { model.InteractHolidayName=row["InteractHolidayName"].ToString(); } if(row["InteractHolidayDate"]!=null) { model.InteractHolidayDate=row["InteractHolidayDate"].ToString(); } if(row["InteractHolidayType"]!=null && row["InteractHolidayType"].ToString()!="") { model.InteractHolidayType=int.Parse(row["InteractHolidayType"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.InteractHoliday DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.InteractHoliday model = new KryptonAccessController.AccessDataBase.Model.InteractHoliday(); if (row != null) { if (row["InteractHolidayID"] != null && row["InteractHolidayID"].ToString() != "") { model.InteractHolidayID = int.Parse(row["InteractHolidayID"].ToString()); } if (row["InteractHolidayName"] != null) { model.InteractHolidayName = row["InteractHolidayName"].ToString(); } if (row["InteractHolidayDate"] != null) { model.InteractHolidayDate = row["InteractHolidayDate"].ToString(); } if (row["InteractHolidayType"] != null && row["InteractHolidayType"].ToString() != "") { model.InteractHolidayType = int.Parse(row["InteractHolidayType"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.InteractHoliday GetModel(int InteractHolidayID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 InteractHolidayID,InteractHolidayName,InteractHolidayDate,InteractHolidayType from InteractHoliday "); strSql.Append(" where InteractHolidayID=@InteractHolidayID "); SqlParameter[] parameters = { new SqlParameter("@InteractHolidayID", SqlDbType.Int, 4) }; parameters[0].Value = InteractHolidayID; KryptonAccessController.AccessDataBase.Model.InteractHoliday model = new KryptonAccessController.AccessDataBase.Model.InteractHoliday(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.InteractHoliday GetModel(int InteractHolidayID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 InteractHolidayID,InteractHolidayName,InteractHolidayDate,InteractHolidayType from InteractHoliday "); strSql.Append(" where InteractHolidayID=@InteractHolidayID "); SqlParameter[] parameters = { new SqlParameter("@InteractHolidayID", SqlDbType.Int,4) }; parameters[0].Value = InteractHolidayID; KryptonAccessController.AccessDataBase.Model.InteractHoliday model=new KryptonAccessController.AccessDataBase.Model.InteractHoliday(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }