public override bool Insert() { DataSet reqDS = new DataSet(); DataTable schedulePMDataTable = EMS_PM_SCHEDULE_FIELDS.CreateDataTable(false); Dictionary <string, string> dataRow = new Dictionary <string, string>() { { EMS_PM_SCHEDULE_FIELDS.FIELD_SCHEDULE_KEY, scheduleKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_SCHEDULE_NAME, scheduleName }, { EMS_PM_SCHEDULE_FIELDS.FIELD_EQUIPMENT_KEY, equipmentKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_CHECKLIST_KEY, checkListKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_DESCRIPTION, description }, { EMS_PM_SCHEDULE_FIELDS.FIELD_FREQUENCE, frequence }, { EMS_PM_SCHEDULE_FIELDS.FIELD_FREQUENCE_UNIT, frequenceUnit }, { EMS_PM_SCHEDULE_FIELDS.FIELD_NOTIFY_USER_KEY, notifyUserKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_NOTIFY_CC_USER_KEY, notifyCCUserKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_NOTIFY_ADVANCED_TIME, notifyAdvancedTime }, { EMS_PM_SCHEDULE_FIELDS.FIELD_NEXT_EVENT_TIME, string.Empty }, { EMS_PM_SCHEDULE_FIELDS.FIELD_BASE_ACTUAL_FINISH_TIME, isBaseActualFinishTime }, { EMS_PM_SCHEDULE_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_KEY, equipmentChangeStateKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_EQUIPMENT_CHANGE_REASON_KEY, equipmentChangeReasonKey }, { EMS_PM_SCHEDULE_FIELDS.FIELD_CREATOR, Creator }, { EMS_PM_SCHEDULE_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone }, { EMS_PM_SCHEDULE_FIELDS.FIELD_CREATE_TIME, string.Empty } }; FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref schedulePMDataTable, dataRow); schedulePMDataTable.AcceptChanges(); reqDS.Tables.Add(schedulePMDataTable); string msg; DataSet resDS = FanHai.Hemera.Utils.Common.Utils.ExecuteEngineMethod("FanHai.Hemera.Modules.EMS.EquipmentSchedulePMEngine, FanHai.Hemera.Modules.EMS", "InsertSchedulePM", reqDS, out msg); if (string.IsNullOrEmpty(msg)) { NextEventTime = resDS.ExtendedProperties.ContainsKey(EMS_PM_SCHEDULE_FIELDS.FIELD_NEXT_EVENT_TIME) ? resDS.ExtendedProperties[EMS_PM_SCHEDULE_FIELDS.FIELD_NEXT_EVENT_TIME].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); } }
/// <summary> /// Get Empty Schedule PM Data Table /// </summary> /// <returns></returns> /// Owner:Andy Gao 2011-08-04 08:44:29 private DataTable GetEmptySchedulePMDataTable() { DataTable dataTable = EMS_PM_SCHEDULE_FIELDS.CreateDataTable(true); dataTable.Columns.Add(EMS_PM_SCHEDULE_FIELDS.FIELD_NOTIFY_USER_NAME); dataTable.Columns.Add(EMS_PM_SCHEDULE_FIELDS.FIELD_NOTIFY_CC_USER_NAME); 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); dataTable.Columns.Add(EMS_CHECKLIST_FIELDS.FIELD_CHECKLIST_NAME); return(dataTable); }
public override bool Update() { DataSet reqDS = new DataSet(); reqDS.ExtendedProperties.Add(PARAMETERS.INPUT_KEY, scheduleKey); reqDS.ExtendedProperties.Add(PARAMETERS.INPUT_EDITOR, Editor); reqDS.ExtendedProperties.Add(PARAMETERS.INPUT_EDIT_TIME, EditTime); this.DirtyList.Add(EMS_PM_SCHEDULE_FIELDS.FIELD_EDIT_TIME, new DirtyItem(EMS_PM_SCHEDULE_FIELDS.FIELD_EDIT_TIME, string.Empty, string.Empty)); Editor = PropertyService.Get(PROPERTY_FIELDS.USER_NAME); EditTimeZone = PropertyService.Get(PROPERTY_FIELDS.TIMEZONE); DataTable schedulePMDataTable = EMS_PM_SCHEDULE_FIELDS.CreateDataTable(false); FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref schedulePMDataTable, this.DirtyList); schedulePMDataTable.AcceptChanges(); reqDS.Tables.Add(schedulePMDataTable); string msg; DataSet resDS = FanHai.Hemera.Utils.Common.Utils.ExecuteEngineMethod("FanHai.Hemera.Modules.EMS.EquipmentSchedulePMEngine, FanHai.Hemera.Modules.EMS", "UpdateSchedulePM", reqDS, out msg); if (string.IsNullOrEmpty(msg)) { NextEventTime = resDS.ExtendedProperties.ContainsKey(EMS_PM_SCHEDULE_FIELDS.FIELD_NEXT_EVENT_TIME) ? resDS.ExtendedProperties[EMS_PM_SCHEDULE_FIELDS.FIELD_NEXT_EVENT_TIME].ToString() : string.Empty; EditTime = resDS.ExtendedProperties.ContainsKey(PARAMETERS.OUTPUT_EDIT_TIME) ? resDS.ExtendedProperties[PARAMETERS.OUTPUT_EDIT_TIME].ToString() : string.Empty; return(true); } else { MessageService.ShowError(msg); return(false); } }