public static void Init_from_DB() { if ((DateTime.Now - EDItime_master.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } EDItime_master.Reset(); DB_select selt = new DB_select(EDI_times.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { EDI_times et = new EDI_times(); et.Init_from_reader(reader); if (!EDItime_master.ccd_dic.ContainsKey(et.cntry_cd.Value)) { List <EDI_times> et_list = new List <EDI_times>(); EDItime_master.ccd_dic[et.cntry_cd.Value] = et_list; } EDItime_master.ccd_dic[et.cntry_cd.Value].Add(et); } reader.Close(); EDItime_master.lastUpdateTime = DateTime.Now; }
public EDI_times GetCopy() { EDI_times newEntity = new EDI_times(); if (!this.cntry_cd.IsNull_flag) { newEntity.cntry_cd.Value = this.cntry_cd.Value; } if (!this.bo_cor.IsNull_flag) { newEntity.bo_cor.Value = this.bo_cor.Value; } if (!this.timebar.IsNull_flag) { newEntity.timebar.Value = this.timebar.Value; } if (!this.eoy.IsNull_flag) { newEntity.eoy.Value = this.eoy.Value; } if (!this.pay_dt.IsNull_flag) { newEntity.pay_dt.Value = this.pay_dt.Value; } if (!this.expect_dt.IsNull_flag) { newEntity.expect_dt.Value = this.expect_dt.Value; } if (!this.effect_dt.IsNull_flag) { newEntity.effect_dt.Value = this.effect_dt.Value; } if (!this.from_dt.IsNull_flag) { newEntity.from_dt.Value = this.from_dt.Value; } if (!this.created_dt.IsNull_flag) { newEntity.created_dt.Value = this.created_dt.Value; } if (!this.modified_dt.IsNull_flag) { newEntity.modified_dt.Value = this.modified_dt.Value; } if (!this.migratedId.IsNull_flag) { newEntity.migratedId.Value = this.migratedId.Value; } if (!this.sec_type.IsNull_flag) { newEntity.sec_type.Value = this.sec_type.Value; } return(newEntity); }
/// <summary> /// Initialize object from DB /// </summary> public bool Init_from_DB() { if (this.id < 0) { return(false); } HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(EDI_times.Get_cmdTP()); db_sel.tableName = "times"; HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("id", HssUtility.General.RelationalOperator.Equals, this.id); db_sel.SetCondition(rela); bool res_flag = false; HssUtility.SQLserver.DB_reader reader = new HssUtility.SQLserver.DB_reader(db_sel, Utility.Get_EDI_hDB()); if (reader.Read()) { this.Init_from_reader(reader); res_flag = true; } reader.Close(); return(res_flag); }
internal HssUtility.SQLserver.DB_update Get_DBupdate() { if (!this.CheckValueChanges()) { return(null); } HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(EDI_times.Get_cmdTP()); if (this.cntry_cd.ValueChanged) { upd.AddValue("cntry_cd", this.cntry_cd); } if (this.bo_cor.ValueChanged) { upd.AddValue("bo_cor", this.bo_cor); } if (this.timebar.ValueChanged) { upd.AddValue("timebar", this.timebar); } if (this.eoy.ValueChanged) { upd.AddValue("eoy", this.eoy); } if (this.pay_dt.ValueChanged) { upd.AddValue("pay_dt", this.pay_dt); } if (this.expect_dt.ValueChanged) { upd.AddValue("expect_dt", this.expect_dt); } if (this.effect_dt.ValueChanged) { upd.AddValue("effect_dt", this.effect_dt); } if (this.from_dt.ValueChanged) { upd.AddValue("from_dt", this.from_dt); } if (this.created_dt.ValueChanged) { upd.AddValue("created_dt", this.created_dt); } if (this.modified_dt.ValueChanged) { upd.AddValue("modified_dt", this.modified_dt); } if (this.migratedId.ValueChanged) { upd.AddValue("migratedId", this.migratedId); } if (this.sec_type.ValueChanged) { upd.AddValue("sec_type", this.sec_type); } HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("id", HssUtility.General.RelationalOperator.Equals, this.pk_ID); upd.SetCondition(rela); return(upd); }
internal HssUtility.SQLserver.DB_insert Get_DBinsert() { HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(EDI_times.Get_cmdTP()); dbIns.AddValue("cntry_cd", this.cntry_cd); dbIns.AddValue("bo_cor", this.bo_cor); dbIns.AddValue("timebar", this.timebar); dbIns.AddValue("eoy", this.eoy); dbIns.AddValue("pay_dt", this.pay_dt); dbIns.AddValue("expect_dt", this.expect_dt); dbIns.AddValue("effect_dt", this.effect_dt); dbIns.AddValue("from_dt", this.from_dt); dbIns.AddValue("created_dt", this.created_dt); dbIns.AddValue("modified_dt", this.modified_dt); dbIns.AddValue("migratedId", this.migratedId); dbIns.AddValue("sec_type", this.sec_type); return(dbIns); }