public Task21_security GetCopy() { Task21_security newEntity = new Task21_security(); if (!this.SecurityID.IsNull_flag) { newEntity.SecurityID.Value = this.SecurityID.Value; } if (!this.TaskName.IsNull_flag) { newEntity.TaskName.Value = this.TaskName.Value; } if (!this.Status.IsNull_flag) { newEntity.Status.Value = this.Status.Value; } if (!this.ValueStr.IsNull_flag) { newEntity.ValueStr.Value = this.ValueStr.Value; } if (!this.CreateBy.IsNull_flag) { newEntity.CreateBy.Value = this.CreateBy.Value; } if (!this.CreateDate.IsNull_flag) { newEntity.CreateDate.Value = this.CreateDate.Value; } return(newEntity); }
public static void Init_from_DB() { if ((DateTime.Now - Task21_secMaster.lastUpdateTime).TotalHours < Utility.RefreshInterval) { return; } Task21_secMaster.Reset(); DB_select selt = new DB_select(Task21_security.Get_cmdTP()); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Task21_security cty = new Task21_security(); cty.Init_from_reader(reader); Task21_secMaster.ID_dic[cty.ID] = cty; if (!Task21_secMaster.secID_dic.ContainsKey(cty.SecurityID.Value)) { List <Task21_security> list = new List <Task21_security>(); Task21_secMaster.secID_dic[cty.SecurityID.Value] = list; } Task21_secMaster.secID_dic[cty.SecurityID.Value].Add(cty); } reader.Close(); Task21_secMaster.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(Task21_security.Get_cmdTP()); if (this.SecurityID.ValueChanged) { upd.AddValue("SecurityID", this.SecurityID); } if (this.TaskName.ValueChanged) { upd.AddValue("TaskName", this.TaskName); } if (this.Status.ValueChanged) { upd.AddValue("Status", this.Status); } if (this.ValueStr.ValueChanged) { upd.AddValue("ValueStr", this.ValueStr); } if (this.CreateBy.ValueChanged) { upd.AddValue("CreateBy", this.CreateBy); } if (this.CreateDate.ValueChanged) { upd.AddValue("CreateDate", this.CreateDate); } HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("ID", HssUtility.General.RelationalOperator.Equals, this.pk_ID); upd.SetCondition(rela); return(upd); }
/// <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(Task21_security.Get_cmdTP()); db_sel.tableName = "Task_21"; 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_DRWIN_hDB()); if (reader.Read()) { this.Init_from_reader(reader); res_flag = true; } reader.Close(); return(res_flag); }
internal HssUtility.SQLserver.DB_insert Get_DBinsert() { HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(Task21_security.Get_cmdTP()); dbIns.AddValue("SecurityID", this.SecurityID); /*Optional 2*/ dbIns.AddValue("TaskName", this.TaskName); /*Optional 3*/ dbIns.AddValue("Status", this.Status); /*Optional 4*/ dbIns.AddValue("ValueStr", this.ValueStr); /*Optional 5*/ dbIns.AddValue("CreateBy", this.CreateBy); /*Optional 6*/ dbIns.AddValue("CreateDate", this.CreateDate); /*Optional 7*/ return(dbIns); }