public override bool Update() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Input Parameters if (!string.IsNullOrEmpty(equipmentGroupKey)) { DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable(); object inputKey = DBNull.Value; object inputEditor = DBNull.Value; object inputEditTime = DBNull.Value; if (!string.IsNullOrEmpty(equipmentGroupKey)) { inputKey = equipmentGroupKey; } if (!string.IsNullOrEmpty(Editor)) { inputEditor = Editor; } if (!string.IsNullOrEmpty(EditTime)) { inputEditTime = EditTime; } inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime }); inputParamDataTable.AcceptChanges(); reqDS.Tables.Add(inputParamDataTable); } #endregion #region Build Equipment Groups Data this.DirtyList.Add(EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EDIT_TIME, new DirtyItem(EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EDIT_TIME, "", "")); Editor = PropertyService.Get(PROPERTY_FIELDS.USER_NAME); EditTimeZone = PropertyService.Get(PROPERTY_FIELDS.TIMEZONE); DataTable equipmentGroupsDataTable = EMS_EQUIPMENT_GROUPS_FIELDS.CreateDataTable(); FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentGroupsDataTable, DirtyList); equipmentGroupsDataTable.AcceptChanges(); reqDS.Tables.Add(equipmentGroupsDataTable); #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIEquipmentGroups().UpdateEquipmentGroups(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string outputEditTime = string.Empty; string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS, ref outputEditTime); if (string.IsNullOrEmpty(returnMsg)) { EditTime = outputEditTime; return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }
public override bool Insert() { #region Variables DataSet reqDS = new DataSet(); DataSet resDS = new DataSet(); #endregion #region Build Equipment Groups Data DataTable equipmentGroupsDataTable = EMS_EQUIPMENT_GROUPS_FIELDS.CreateDataTable(); Dictionary <string, string> dataRow = new Dictionary <string, string>() { { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY, equipmentGroupKey }, { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_EQUIPMENT_GROUP_NAME, equipmentGroupName }, { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_SPEC, spec }, { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_DESCRIPTION, description }, { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_CREATOR, Creator }, { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone }, { EMS_EQUIPMENT_GROUPS_FIELDS.FIELD_CREATE_TIME, string.Empty } }; FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentGroupsDataTable, dataRow); equipmentGroupsDataTable.AcceptChanges(); reqDS.Tables.Add(equipmentGroupsDataTable); #endregion #region Build Input Parameters if (!string.IsNullOrEmpty(equipmentGroupKey)) { DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable(); object inputKey = DBNull.Value; object inputEditor = DBNull.Value; object inputEditTime = DBNull.Value; if (!string.IsNullOrEmpty(equipmentGroupKey)) { inputKey = equipmentGroupKey; } if (!string.IsNullOrEmpty(Creator)) { inputEditor = Creator; } if (!string.IsNullOrEmpty(CreateTime)) { inputEditTime = CreateTime; } inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime }); inputParamDataTable.AcceptChanges(); reqDS.Tables.Add(inputParamDataTable); } #endregion #region Call Remoting Interface try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (serverFactory != null) { resDS = serverFactory.CreateIEquipmentGroups().InsertEquipmentGroups(reqDS); } } catch (Exception ex) { MessageService.ShowError(ex); return(false); } finally { CallRemotingService.UnregisterChannel(); } #endregion #region Process Output Parameters string outputcreateTime = string.Empty; string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS, ref outputcreateTime); if (string.IsNullOrEmpty(returnMsg)) { CreateTime = outputcreateTime; return(true); } else { MessageService.ShowError(returnMsg); return(false); } #endregion }