public virtual void Import(DataPortable imp) { string buffer = ""; imp.ExportBuffer(ref buffer); this.ImportBuffer(buffer); }
public DataPortable MemoryGet(string tag) { if (this.hsh_DataSave[(object)tag] == null) { return(new DataPortable()); } DataPortable dataPortable1 = this.hsh_DataSave[(object)tag] as DataPortable; DataPortable dataPortable2 = new DataPortable(); string buffer = ""; dataPortable1.ExportBuffer(ref buffer); dataPortable2.ImportBuffer(buffer); this.hsh_DataSave.Remove((object)tag); return(dataPortable2); }
public void ExportBuffer(ref string buffer) { int count = this.lst_mapTags.Count; int num = count - 1; StringBuilder stringBuilder = new StringBuilder(buffer); stringBuilder.Append(this.str_open_portable); for (int index1 = 0; index1 < count; ++index1) { string lstMapTag = this.lst_mapTags[index1] as string; string lstCtrlTag = this.lst_ctrlTags[index1] as string; stringBuilder.Append(lstMapTag); stringBuilder.Append(this.str_tag_value); if (lstCtrlTag == "0") { stringBuilder.Append(this.str_field_sep); stringBuilder.Append(this.hsh_tagValue[(object)lstMapTag] as string); stringBuilder.Append(this.str_field_sep); } else if (lstCtrlTag == "1") { stringBuilder.Append(this.str_open_portable); ArrayList arrayList = this.hsh_tagValue[(object)lstMapTag] as ArrayList; for (int index2 = 0; index2 < arrayList.Count; ++index2) { DataPortable dataPortable = arrayList[index2] as DataPortable; string buffer1 = ""; dataPortable.ExportBuffer(ref buffer1); stringBuilder.Append(buffer1); } stringBuilder.Append(this.str_close_portable); } if (index1 < num) { stringBuilder.Append(this.str_tag_value); } } stringBuilder.Append(this.str_close_portable); buffer = stringBuilder.ToString(); }
public override bool execute( ) { Registry("execute infra_SchedulerDispatcher "); /// USER [ execute ] I_Scheduler sch = new I_Scheduler(this); DateTime time_now = DateTime.Now; if (sch.selectAll()) { while (sch.fetch()) { bool Exec = false; if (sch.get_tg_status() == Context.CLOSED) { continue; } switch (sch.get_tg_type()) { case Scheduler.Specific: { DateTime time = Convert.ToDateTime(sch.get_dt_specific()); if (time_now.Year == time.Year) { if (time_now.Month == time.Month) { if (time_now.Day == time.Day) { if (time_now.Hour == time.Hour) { if (time_now.Minute == time.Minute) { Exec = true; } } } } } break; } case Scheduler.Daily: { int daily_hh = Convert.ToInt32(sch.get_st_daily_hhmm().Substring(0, 2)); int daily_mm = Convert.ToInt32(sch.get_st_daily_hhmm().Substring(2, 2)); if (time_now.Hour == daily_hh) { if (time_now.Minute == daily_mm) { Exec = true; } } break; } case Scheduler.Weekly: { long weekly_dow = sch.get_int_st_weekly_dow(); long weekly_hh = Convert.ToInt64(sch.get_st_daily_hhmm().Substring(0, 2)); long weekly_mm = Convert.ToInt64(sch.get_st_daily_hhmm().Substring(2, 2)); switch (weekly_dow) { case 0: if (time_now.DayOfWeek != DayOfWeek.Sunday) { continue; } break; case 1: if (time_now.DayOfWeek != DayOfWeek.Monday) { continue; } break; case 2: if (time_now.DayOfWeek != DayOfWeek.Tuesday) { continue; } break; case 3: if (time_now.DayOfWeek != DayOfWeek.Wednesday) { continue; } break; case 4: if (time_now.DayOfWeek != DayOfWeek.Thursday) { continue; } break; case 5: if (time_now.DayOfWeek != DayOfWeek.Friday) { continue; } break; case 6: if (time_now.DayOfWeek != DayOfWeek.Saturday) { continue; } break; default: break; // 7 is everyday } if (time_now.Hour == weekly_hh) { if (time_now.Minute == weekly_mm) { Exec = true; } } break; } case Scheduler.Monthly: { long monthly_dd = sch.get_int_nu_monthly_day(); long monthly_hh = Convert.ToInt64(sch.get_st_monthly_hhmm().Substring(0, 2)); long monthly_mm = Convert.ToInt64(sch.get_st_monthly_hhmm().Substring(2, 2)); if (time_now.Day == monthly_dd) { if (time_now.Hour == monthly_hh) { if (time_now.Minute == monthly_mm) { Exec = true; } } } break; } case Scheduler.Minute: { Exec = true; break; } default: { Registry("Unrecognized code! " + sch.get_tg_type()); break; } } if (Exec) { Registry(sch.get_st_job() + " >> MATCH!"); } Registry(sch.get_st_job()); if (!Exec) { Registry(sch.get_st_job() + " >> Checking backlog...."); DateTime tim = Convert.ToDateTime(sch.get_dt_prev()); Registry(tim.ToString()); Registry(time_now.ToString()); if (time_now >= tim) { Registry("Back log for: " + sch.get_st_job()); Exec = true; } } if (!Exec) { continue; } Registry("Running: " + sch.get_st_job()); ApplicationUtil var_util = new ApplicationUtil(); int max_params = var_util.indexCSV(sch.get_st_job(), ';'); string job = var_util.getCSV(0); string path = var_SessionKey + "\\Log_" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + DateTime.Now.Second.ToString().PadLeft(2, '0') + "_" + job + "_" + sch.get_identity() + ".txt.wrk"; FileStream logFile; StreamWriter logStream; if (File.Exists(path)) { logFile = new FileStream(path, FileMode.Append, FileAccess.Write); } else { logFile = new FileStream(path, FileMode.Create, FileAccess.Write); } logStream = new StreamWriter(logFile); logStream.AutoFlush = true; var_Comm.Clear(); DB_Access new_access = new DB_Access(ref m_gen_my_access); var_disp.var_Translator = var_Translator; if (max_params >= 3) { DataPortable port = new DataPortable(); for (int t = 1; t < max_params;) { string ident = var_util.getCSV(t); ++t; string ident_val = var_util.getCSV(t); ++t; port.setValue(ident, ident_val); } string buffer = ""; port.ExportBuffer(ref buffer); Registry(buffer); new_access.MemorySave("input", ref port); } // Runnig in a new thread var_disp.ExecuteThreadTransaction(job, Convert.ToInt32(sch.get_identity()), ref logStream, ref var_Comm, ref new_access, path); } } /// USER [ execute ] END Registry("execute done infra_SchedulerDispatcher "); return(true); }