private void Get_TDlist_threadRun() { if (this.curr_reader == null) { return; } while (this.curr_reader.Read()) { if (this.threadStop_flag) { break; } Task_Detail td = new Task_Detail(); td.Init_from_reader(this.curr_reader); this.taskDetail_list.Add(td); } Thread th = new Thread(this.curr_reader.Close); th.Name = "DB Reader thread " + DateTime.Now.ToString(); th.Start(); this.dataFinishedLoading_flag = true; }
public static List <Task_Detail> GetTaskDetail_list(int taskID, string sourceID, string taskName) { List <Task_Detail> list = new List <Task_Detail>(); DB_select db_sel = new DB_select(Task_Detail.Get_cmdTP()); SQL_relation rela0 = new SQL_relation("TaskID", RelationalOperator.Equals, taskID); SQL_relation rela1 = new SQL_relation("sourceID", RelationalOperator.Equals, sourceID); SQL_condition cond = new SQL_condition(rela0, ConditionalOperator.And, rela1); if (taskName != null) { SQL_relation rela2 = new SQL_relation("TaskName", RelationalOperator.Equals, taskName); cond = new SQL_condition(cond, ConditionalOperator.And, rela2); } db_sel.SetCondition(cond); DB_reader reader = new DB_reader(db_sel, Utility.Get_DRWIN_hDB()); while (reader.Read()) { Task_Detail dp = new Task_Detail(); dp.Init_from_reader(reader); list.Add(dp); } reader.Close(); return(list); }
/// <summary> /// Get DB_reader for retrieving Task_Detail info /// </summary> /// <param name="completed_option">0 for Uncompleted, 1 for Completed, other values for all</param> /// <param name="extraCond">Extra Condition</param> public static DB_reader Get_DB_reader(int completed_option, SQL_condition extraCond) { DB_select selt = new DB_select(Task_Detail.Get_cmdTP()); SQL_relation rela = null; if (completed_option == 0) { rela = new SQL_relation("Completed", RelationalOperator.Equals, false); } else if (completed_option == 1) { rela = new SQL_relation("Completed", RelationalOperator.Equals, true); } SQL_condition cond = new SQL_condition(rela, ConditionalOperator.And, extraCond); selt.SetCondition(cond); DB_reader reader = new DB_reader(selt, Utility.Get_DRWIN_hDB()); return(reader); }
/// <summary> /// Add some rows from list to DT /// </summary> /// <param name="limit">max number of rows to be added</param> /// <returns>how many rows added</returns> public int Add_TDrows_to_DT(int limit = UltraGrid_helper.RowsLoaded_per_scroll) { int count = 0; if (limit < 1) { limit = UltraGrid_helper.RowsLoaded_per_scroll; } while (this.currList_id < this.taskDetail_list.Count) { Task_Detail td = this.taskDetail_list[this.currList_id]; DataRow row = sourceDT.Rows.Add(); row[UltraGrid_helper.SelectColumnName] = false; row["TaskDetailID"] = td.TaskDetailID; row["TaskID"] = td.TaskID.Value; row["TaskName"] = td.TaskName.Value; row["SourceTable"] = td.SourceTable.Value; row["SourceID"] = td.SourceID.Value; row["Country"] = td.Country.Value; row["CreatedBy"] = td.CreatedBy.Value; if (!td.CreatedDateTime.IsNull_flag) { row["CreatedDateTime"] = td.CreatedDateTime.Value; } row["Completed"] = td.Completed.Value; row["Notes"] = td.Notes.Value; ++this.currList_id; if (++count >= limit) { break; } } return(count); }
public Task_Detail GetCopy() { Task_Detail newEntity = new Task_Detail(); if (!this.TaskID.IsNull_flag) { newEntity.TaskID.Value = this.TaskID.Value; } if (!this.TaskName.IsNull_flag) { newEntity.TaskName.Value = this.TaskName.Value; } if (!this.Country.IsNull_flag) { newEntity.Country.Value = this.Country.Value; } if (!this.Depositary.IsNull_flag) { newEntity.Depositary.Value = this.Depositary.Value; } if (!this.Issue.IsNull_flag) { newEntity.Issue.Value = this.Issue.Value; } if (!this.CUSIP.IsNull_flag) { newEntity.CUSIP.Value = this.CUSIP.Value; } if (!this.RecordDate.IsNull_flag) { newEntity.RecordDate.Value = this.RecordDate.Value; } if (!this.SourceTable.IsNull_flag) { newEntity.SourceTable.Value = this.SourceTable.Value; } if (!this.SourceID.IsNull_flag) { newEntity.SourceID.Value = this.SourceID.Value; } if (!this.StartDate.IsNull_flag) { newEntity.StartDate.Value = this.StartDate.Value; } if (!this.PriorityDate.IsNull_flag) { newEntity.PriorityDate.Value = this.PriorityDate.Value; } if (!this.EndDate.IsNull_flag) { newEntity.EndDate.Value = this.EndDate.Value; } if (!this.Notes.IsNull_flag) { newEntity.Notes.Value = this.Notes.Value; } if (!this.Priority.IsNull_flag) { newEntity.Priority.Value = this.Priority.Value; } if (!this.Completed.IsNull_flag) { newEntity.Completed.Value = this.Completed.Value; } if (!this.CreatedBy.IsNull_flag) { newEntity.CreatedBy.Value = this.CreatedBy.Value; } if (!this.CreatedDateTime.IsNull_flag) { newEntity.CreatedDateTime.Value = this.CreatedDateTime.Value; } if (!this.CompletedBy.IsNull_flag) { newEntity.CompletedBy.Value = this.CompletedBy.Value; } if (!this.CompletedDateTime.IsNull_flag) { newEntity.CompletedDateTime.Value = this.CompletedDateTime.Value; } if (!this.LastModifiedBy.IsNull_flag) { newEntity.LastModifiedBy.Value = this.LastModifiedBy.Value; } if (!this.LastModifiedDateTime.IsNull_flag) { newEntity.LastModifiedDateTime.Value = this.LastModifiedDateTime.Value; } return(newEntity); }
internal HssUtility.SQLserver.DB_update Get_DBupdate() { if (!this.CheckValueChanges()) { return(null); } else { this.LastModifiedBy.Value = Utility.CurrentUser; this.LastModifiedDateTime.Value = DateTime.Now; } HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(Task_Detail.Get_cmdTP()); if (this.TaskID.ValueChanged) { upd.AddValue("TaskID", this.TaskID); } if (this.TaskName.ValueChanged) { upd.AddValue("TaskName", this.TaskName); } if (this.Country.ValueChanged) { upd.AddValue("Country", this.Country); } if (this.Depositary.ValueChanged) { upd.AddValue("Depositary", this.Depositary); } if (this.Issue.ValueChanged) { upd.AddValue("Issue", this.Issue); } if (this.CUSIP.ValueChanged) { upd.AddValue("CUSIP", this.CUSIP); } if (this.RecordDate.ValueChanged) { upd.AddValue("RecordDate", this.RecordDate); } if (this.SourceTable.ValueChanged) { upd.AddValue("SourceTable", this.SourceTable); } if (this.SourceID.ValueChanged) { upd.AddValue("SourceID", this.SourceID); } if (this.StartDate.ValueChanged) { upd.AddValue("StartDate", this.StartDate); } if (this.PriorityDate.ValueChanged) { upd.AddValue("PriorityDate", this.PriorityDate); } if (this.EndDate.ValueChanged) { upd.AddValue("EndDate", this.EndDate); } if (this.Notes.ValueChanged) { upd.AddValue("Notes", this.Notes); } if (this.Priority.ValueChanged) { upd.AddValue("Priority", this.Priority); } if (this.Completed.ValueChanged) { upd.AddValue("Completed", this.Completed); } if (this.CreatedBy.ValueChanged) { upd.AddValue("CreatedBy", this.CreatedBy); } if (this.CreatedDateTime.ValueChanged) { upd.AddValue("CreatedDateTime", this.CreatedDateTime); } if (this.CompletedBy.ValueChanged) { upd.AddValue("CompletedBy", this.CompletedBy); } if (this.CompletedDateTime.ValueChanged) { upd.AddValue("CompletedDateTime", this.CompletedDateTime); } if (this.LastModifiedBy.ValueChanged) { upd.AddValue("LastModifiedBy", this.LastModifiedBy); } if (this.LastModifiedDateTime.ValueChanged) { upd.AddValue("LastModifiedDateTime", this.LastModifiedDateTime); } HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("TaskDetailID", HssUtility.General.RelationalOperator.Equals, this.pk_ID); upd.SetCondition(rela); return(upd); }
internal HssUtility.SQLserver.DB_insert Get_DBinsert() { this.LastModifiedBy.Value = Utility.CurrentUser; this.LastModifiedDateTime.Value = DateTime.Now; this.CreatedBy.Value = Utility.CurrentUser; this.CreatedDateTime.Value = DateTime.Now; HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(Task_Detail.Get_cmdTP()); dbIns.AddValue("TaskID", this.TaskID.Value); dbIns.AddValue("TaskName", this.TaskName); /*Optional 3*/ dbIns.AddValue("Country", this.Country); /*Optional 4*/ dbIns.AddValue("Depositary", this.Depositary); /*Optional 5*/ dbIns.AddValue("Issue", this.Issue); /*Optional 6*/ dbIns.AddValue("CUSIP", this.CUSIP); /*Optional 7*/ dbIns.AddValue("RecordDate", this.RecordDate); /*Optional 8*/ dbIns.AddValue("SourceTable", this.SourceTable); /*Optional 9*/ dbIns.AddValue("SourceID", this.SourceID); /*Optional 10*/ dbIns.AddValue("StartDate", this.StartDate); /*Optional 11*/ dbIns.AddValue("PriorityDate", this.PriorityDate); /*Optional 12*/ dbIns.AddValue("EndDate", this.EndDate); /*Optional 13*/ dbIns.AddValue("Notes", this.Notes); /*Optional 14*/ dbIns.AddValue("Priority", this.Priority); /*Optional 15*/ dbIns.AddValue("Completed", this.Completed); /*Optional 16*/ dbIns.AddValue("CreatedBy", this.CreatedBy); /*Optional 17*/ dbIns.AddValue("CreatedDateTime", this.CreatedDateTime); /*Optional 18*/ dbIns.AddValue("CompletedBy", this.CompletedBy); /*Optional 19*/ dbIns.AddValue("CompletedDateTime", this.CompletedDateTime); /*Optional 20*/ dbIns.AddValue("LastModifiedBy", this.LastModifiedBy); /*Optional 21*/ dbIns.AddValue("LastModifiedDateTime", this.LastModifiedDateTime); /*Optional 22*/ return(dbIns); }
/// <summary> /// Initialize object from DB /// </summary> public bool Init_from_DB() { if (this.TaskDetailID < 0) { return(false); } HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(Task_Detail.Get_cmdTP()); db_sel.tableName = "Task_Detail"; HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("TaskDetailID", HssUtility.General.RelationalOperator.Equals, this.TaskDetailID); 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); }