public static void Init_from_DB() { if ((DateTime.Now - FX_Input_master.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } FX_Input_master.Reset(); DB_select selt = new DB_select(FX_Input.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { FX_Input fxi = new FX_Input(); fxi.Init_from_reader(reader); FX_Input_master.fi_dic[fxi.FX_InputID] = fxi; } reader.Close(); FX_Input_master.lastUpdateTime = DateTime.Now; }
internal HssUtility.SQLserver.DB_update Get_DBupdate() { if (!this.CheckValueChanges()) { return(null); } HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(FX_Input.Get_cmdTP()); if (this.CountryName.ValueChanged) { upd.AddValue("CountryName", this.CountryName); } if (this.Custodian.ValueChanged) { upd.AddValue("Custodian", this.Custodian); } if (this.AccountNumber.ValueChanged) { upd.AddValue("AccountNumber", this.AccountNumber); } if (this.Currency_Code.ValueChanged) { upd.AddValue("Currency_Code", this.Currency_Code); } if (this.FX_NotificationDate.ValueChanged) { upd.AddValue("FX_NotificationDate", this.FX_NotificationDate); } if (this.LocalAmountReceived.ValueChanged) { upd.AddValue("LocalAmountReceived", this.LocalAmountReceived); } if (this.Depositary_ReceivedDate.ValueChanged) { upd.AddValue("Depositary_ReceivedDate", this.Depositary_ReceivedDate); } if (this.FX_RequestedDate.ValueChanged) { upd.AddValue("FX_RequestedDate", this.FX_RequestedDate); } if (this.FX_ReceivedDate.ValueChanged) { upd.AddValue("FX_ReceivedDate", this.FX_ReceivedDate); } if (this.Depositary.ValueChanged) { upd.AddValue("Depositary", this.Depositary); } if (this.FX_Rate.ValueChanged) { upd.AddValue("FX_Rate", this.FX_Rate); } if (this.USDAmountReceived.ValueChanged) { upd.AddValue("USDAmountReceived", this.USDAmountReceived); } if (this.ActualCheckRequestDate.ValueChanged) { upd.AddValue("ActualCheckRequestDate", this.ActualCheckRequestDate); } if (this.PayToBrokerDate.ValueChanged) { upd.AddValue("PayToBrokerDate", this.PayToBrokerDate); } if (this.LastModifiedBy.ValueChanged) { upd.AddValue("LastModifiedBy", this.LastModifiedBy); } if (this.ModifiedDateTime.ValueChanged) { upd.AddValue("ModifiedDateTime", this.ModifiedDateTime); } if (this.Forex_Fee.ValueChanged) { upd.AddValue("Forex_Fee", this.Forex_Fee); } HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("FX_InputID", 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(FX_Input.Get_cmdTP()); dbIns.AddValue("CountryName", this.CountryName); /*Optional 2*/ dbIns.AddValue("Custodian", this.Custodian); /*Optional 3*/ dbIns.AddValue("AccountNumber", this.AccountNumber); /*Optional 4*/ dbIns.AddValue("Currency_Code", this.Currency_Code); /*Optional 5*/ dbIns.AddValue("FX_NotificationDate", this.FX_NotificationDate); /*Optional 6*/ dbIns.AddValue("LocalAmountReceived", this.LocalAmountReceived); /*Optional 7*/ dbIns.AddValue("Depositary_ReceivedDate", this.Depositary_ReceivedDate); /*Optional 8*/ dbIns.AddValue("FX_RequestedDate", this.FX_RequestedDate); /*Optional 9*/ dbIns.AddValue("FX_ReceivedDate", this.FX_ReceivedDate); /*Optional 10*/ dbIns.AddValue("Depositary", this.Depositary); /*Optional 11*/ dbIns.AddValue("FX_Rate", this.FX_Rate); /*Optional 12*/ dbIns.AddValue("USDAmountReceived", this.USDAmountReceived); /*Optional 13*/ dbIns.AddValue("ActualCheckRequestDate", this.ActualCheckRequestDate); /*Optional 14*/ dbIns.AddValue("PayToBrokerDate", this.PayToBrokerDate); /*Optional 15*/ dbIns.AddValue("LastModifiedBy", this.LastModifiedBy); /*Optional 16*/ dbIns.AddValue("ModifiedDateTime", this.ModifiedDateTime); /*Optional 17*/ dbIns.AddValue("Forex_Fee", this.Forex_Fee); /*Optional 18*/ return(dbIns); }
/// <summary> /// Initialize object from DB /// </summary> public bool Init_from_DB() { if (this.FX_InputID < 0) { return(false); } HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(FX_Input.Get_cmdTP()); db_sel.tableName = "FX_Input"; HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("FX_InputID", HssUtility.General.RelationalOperator.Equals, this.FX_InputID); db_sel.SetCondition(rela); bool res_flag = false; HssUtility.SQLserver.DB_reader reader = new HssUtility.SQLserver.DB_reader(db_sel, Utility.Get_DRWIN_hDB()); if (reader.Read()) { this.Init_from_reader(reader); res_flag = true; } reader.Close(); return(res_flag); }