public JsonResult getPeriodDetails(int year, int month) { PeriodAidUtilities utilities = new PeriodAidUtilities(); var setting_item = periodDB.PeriodUserInfo.SingleOrDefault(m => m.UserName == User.Identity.Name); if (setting_item != null) { DateTime first_day = new DateTime(year, month, 1); DateTime last_day = first_day.AddMonths(1); var history_list = from m in periodDB.PeriodData where ((m.MC_Begin >= first_day && m.MC_Begin < last_day) || (m.MC_Finish >= first_day && m.MC_Finish < last_day)) && m.UserName == User.Identity.Name select m; PeriodResult s = new PeriodResult(); foreach (var item in history_list) { s = utilities.RenderPeriodHistory(year, month, item, s); } s = utilities.getPeriodResult(year, month, setting_item.Last_MC_Begin, setting_item.MC_days, setting_item.MC_Cycle, s); return(Json(new { result = "SUCCESS", p_day = s.p_days.ToArray(), e_day = s.e_days.ToArray(), prep_day = s.prep_days.ToArray() })); } else { return(Json(new { result = "FAILURE" })); } }
public void StartBlocking(int intervalInMs) { this.throughputs = new List <int>(30 * 1000 / intervalInMs); WorkerState lastState = Capture(); for (; lastState.threadsAlive != 0;) { System.Threading.Thread.Sleep(intervalInMs); WorkerState currentState = Capture(); PeriodResult tempResult = currentState.Difference(lastState); tempResult.Print(); this.throughputs.Add(tempResult.Throughput); lastState = currentState; } }
private void SourceFieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { object sourcedate = cache.GetValue(e.Row, _sourceField); if (sourcedate != null) { PeriodResult result = GetPeriod(cache, _searchType, (DateTime)sourcedate, new object[] { e.Row }, true); string newValue = result; bool haspending = false; try { object pendingValue = cache.GetValuePending(e.Row, _FieldName); if (pendingValue != null && pendingValue != PXCache.NotSetValue) { pendingValue = UnFormatPeriod((string)pendingValue); cache.RaiseFieldVerifying(_FieldName, e.Row, ref pendingValue); haspending = true; } } catch (PXSetPropertyException) { cache.SetValuePending(e.Row, _FieldName, newValue); } finally { if (cache.HasAttributes(e.Row)) { cache.RaiseExceptionHandling(_FieldName, e.Row, null, null); } //this will happen only if FirstOpenPeriod is set from OpenPeriod if (!haspending && result.StartDate > (DateTime?)sourcedate) { cache.SetValueExt(e.Row, _sourceField, result.StartDate); } else { cache.SetValueExt(e.Row, _FieldName, newValue); } } } else { cache.SetValue(e.Row, _FieldName, null); } }