public static void UpdateParams(WorkShopParam Param) { string strSql = "delete from TAB_Base_PlanParam where strWorkShopGUID=@strWorkShopGUID"; SqlParameter[] sqlParams = { new SqlParameter("strWorkShopGUID", Param.strWorkShopGUID) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); string strSqlAdd = @"insert into TAB_Base_PlanParam (dtAutoSaveTime1,dtAutoSaveTime2,dtPlanBeginTime,dtPlanEndTime,dtKeepSleepTime, strWorkShopGUID,strWEBHost,bEnableSleepCheck) values (@dtAutoSaveTime1,@dtAutoSaveTime2,@dtPlanBeginTime,@dtPlanEndTime,@dtKeepSleepTime, @strWorkShopGUID,@strWEBHost,@bEnableSleepCheck)"; SqlParameter[] sqlParamsAdd = { new SqlParameter("dtAutoSaveTime1", Param.dtAutoSaveTime1), new SqlParameter("dtAutoSaveTime2", Param.dtAutoSaveTime2), new SqlParameter("dtPlanBeginTime", Param.dtPlanBeginTime), new SqlParameter("dtPlanEndTime", Param.dtPlanEndTime), new SqlParameter("dtKeepSleepTime", Param.dtKeepSleepTime), new SqlParameter("strWorkShopGUID", Param.strWorkShopGUID), new SqlParameter("strWEBHost", Param.strWEBHost), new SqlParameter("bEnableSleepCheck", Param.bEnableSleepCheck) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSqlAdd, sqlParamsAdd); }
public static bool GetParams(string WorkShopGUID, WorkShopParam Param) { string strSql = "select * from TAB_Base_PlanParam where strWorkShopGUID=@strWorkShopGUID"; SqlParameter[] sqlParams = { new SqlParameter("strWorkShopGUID", WorkShopGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; if (dt.Rows.Count > 0) { Param.dtAutoSaveTime1 = DateTime.Parse(dt.Rows[0]["dtAutoSaveTime1"].ToString()); Param.dtAutoSaveTime2 = DateTime.Parse(dt.Rows[0]["dtAutoSaveTime2"].ToString()); Param.dtPlanBeginTime = DateTime.Parse(dt.Rows[0]["dtPlanBeginTime"].ToString()); Param.dtPlanEndTime = DateTime.Parse(dt.Rows[0]["dtPlanEndTime"].ToString()); Param.dtKeepSleepTime = DateTime.Parse(dt.Rows[0]["dtKeepSleepTime"].ToString()); Param.strWorkShopGUID = dt.Rows[0]["strWorkShopGUID"].ToString(); Param.strWEBHost = dt.Rows[0]["strWEBHost"].ToString(); Param.bEnableSleepCheck = bool.Parse(dt.Rows[0]["bEnableSleepCheck"].ToString()); return(true); } return(false); }