/// <summary> /// Get Empty Task Data Table /// </summary> /// <returns></returns> /// Owner:Andy Gao 2011-08-18 08:22:50 private DataTable GetEmptyTaskDataTable() { DataTable dataTable = EMS_EQUIPMENT_TASKS_FIELDS.CreateDataTable(true); dataTable.Columns.Add(EMS_EQUIPMENT_CHANGE_STATES_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_NAME); dataTable.Columns.Add(EMS_EQUIPMENT_CHANGE_REASONS_FIELDS.FIELD_EQUIPMENT_CHANGE_REASON_NAME); dataTable.Columns.Add(EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME); return(dataTable); }
public override bool Insert() { DataSet reqDS = new DataSet(); DataTable tasksDataTable = EMS_EQUIPMENT_TASKS_FIELDS.CreateDataTable(false); Dictionary <string, string> dataRow = new Dictionary <string, string>() { { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_TASK_KEY, taskKey }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_TASK_NAME, taskName }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_DESCRIPTION, description }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_TASK_STATE, taskState }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_CREATE_USER_KEY, createUserKey }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_KEY, equipmentKey }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_KEY, equipmentChangeStateKey }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_CHANGE_REASON_KEY, equipmentChangeReasonKey }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_CREATOR, Creator }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone }, { EMS_EQUIPMENT_TASKS_FIELDS.FIELD_CREATE_TIME, string.Empty } }; FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref tasksDataTable, dataRow); tasksDataTable.AcceptChanges(); reqDS.Tables.Add(tasksDataTable); reqDS.ExtendedProperties.Add(EMS_EQUIPMENT_TASK_COURSES_FIELDS.FIELD_EQUIPMENT_TASK_COURSE_KEY, CommonUtils.GenerateNewKey(0)); reqDS.ExtendedProperties.Add(EMS_EQUIPMENT_TASK_COURSES_FIELDS.FIELD_RECEIVE_DEPT_KEY, receiveDeptKey); reqDS.ExtendedProperties.Add(EMS_EQUIPMENT_TASK_COURSES_FIELDS.FIELD_RECEIVE_DEPT_NAME, receiveDeptName); reqDS.ExtendedProperties.Add(EMS_EQUIPMENT_TASK_COURSES_FIELDS.FIELD_COMMENTS, comments); string msg; DataSet resDS = FanHai.Hemera.Utils.Common.Utils.ExecuteEngineMethod("FanHai.Hemera.Modules.EMS.EquipmentTasksEngine, FanHai.Hemera.Modules.EMS", "InsertTask", reqDS, out msg); if (string.IsNullOrEmpty(msg)) { TaskName = resDS.ExtendedProperties.ContainsKey(EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_TASK_NAME) ? resDS.ExtendedProperties[EMS_EQUIPMENT_TASKS_FIELDS.FIELD_EQUIPMENT_TASK_NAME].ToString() : string.Empty; CreateTimeStamp = resDS.ExtendedProperties.ContainsKey(EMS_EQUIPMENT_TASKS_FIELDS.FIELD_CREATE_TIMESTAMP) ? resDS.ExtendedProperties[EMS_EQUIPMENT_TASKS_FIELDS.FIELD_CREATE_TIMESTAMP].ToString() : string.Empty; CreateTime = resDS.ExtendedProperties.ContainsKey(PARAMETERS.OUTPUT_EDIT_TIME) ? resDS.ExtendedProperties[PARAMETERS.OUTPUT_EDIT_TIME].ToString() : string.Empty; return(true); } else { MessageService.ShowError(msg); return(false); } }