Esempio n. 1
0
        /// <summary>
        /// Load Equipment Group Data
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        /// Owner:Andy Gao 2011-07-20 13:11:03
        public DataTable LoadEquipmentGroupData(out string msg)
        {
            #region Call Remoting Interface

            DataSet reqDS = new DataSet();
            DataSet resDS = new DataSet();

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                resDS = serverFactory.CreateIEquipmentGroups().GetEquipmentGroups(reqDS);
            }
            catch (Exception ex)
            {
                msg = ex.Message;

                return(null);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            msg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS);

            return(resDS.Tables[EMS_EQUIPMENT_GROUPS_FIELDS.DATABASE_TABLE_NAME]);

            #endregion
        }
Esempio n. 2
0
        /// <summary>
        /// Load Equipment Groups Data
        /// </summary>
        private void LoadEquipmentGroupsData()
        {
            #region Variables

            DataSet reqDS = new DataSet();
            DataSet resDS = new DataSet();

            #endregion

            #region Call Remoting Interface

            try
            {
                //远程调用
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipmentGroups().GetEquipmentGroups(reqDS);
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);

                return;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            #endregion

            #region Process Output Parameters

            string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS);

            if (string.IsNullOrEmpty(returnMsg))
            {
                BindDataToStatesGrid(resDS.Tables[EMS_EQUIPMENT_GROUPS_FIELDS.DATABASE_TABLE_NAME]);
            }
            else
            {
                MessageService.ShowError(returnMsg);
            }

            #endregion
        }
Esempio n. 3
0
        public override bool Delete()
        {
            #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 Call Remoting Interface

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipmentGroups().DeleteEquipmentGroups(reqDS);
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);

                return(false);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            #endregion

            #region Process Output Parameters

            string returnMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(resDS);

            if (string.IsNullOrEmpty(returnMsg))
            {
                return(true);
            }
            else
            {
                MessageService.ShowError(returnMsg);

                return(false);
            }

            #endregion
        }
Esempio n. 4
0
        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
        }
Esempio n. 5
0
        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
        }