//可以多行刪除數據_period public HttpResponseBase SchedulePeriodDelete() { string json = string.Empty; SchedulePeriodQuery period = new SchedulePeriodQuery(); _secheduleServiceMgr = new ScheduleServiceMgr(mySqlConnectionString); try { string id = Request.Params["id"]; id = id.Substring(0, id.Length - 1).ToString(); string[] ids = id.Split(','); if (ids.Length>0) { period.rowid = int.Parse(ids[0].ToString()); period = _secheduleServiceMgr.GetSchedulePeriod(period); ScheduleMasterQuery query_master = new ScheduleMasterQuery(); query_master.schedule_code = period.schedule_code; //刪除 int result = _secheduleServiceMgr.SchedulePeriodDelete(id); if (result > 0) { ScheduleMasterQuery item = _secheduleServiceMgr.GetScheduleMaster(query_master); //更新ScheduleMaster表的previous_execute_time、next_execute_time、state; //獲取next_execute_time和schedule_period_id int schedule_period_id = 0; int next_execute_time = _secheduleServiceMgr.GetNext_Execute_Time(item.schedule_code, out schedule_period_id); //if (item.next_execute_time > next_execute_time || (item.next_execute_time == 0 && item.next_execute_time < next_execute_time)) { item.next_execute_time = next_execute_time; if (item.next_execute_time == 0) { item.schedule_state = 0; } item.schedule_period_id = schedule_period_id; //修改ScheduleMaster _secheduleServiceMgr.UpdateScheduleMaster(item); } } } json = "{success:true}"; } #region 只刪除一行數據時的代碼段 //if (!string.IsNullOrEmpty(Request.Params["id"])) //{ // query.id = Convert.ToUInt32(Request.Params["id"]); //} // int _dt = informationMgr.PersonInfromationDelete(query); //if (_dt > 0) //{ // json = "{success:true}"; //} //else //{ // json = "{success:false}"; //} #endregion catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }