Esempio n. 1
0
        /// <summary>
        /// Load Equipment Change Reasons Data
        /// </summary>
        /// <param name="equipmentChangeStateKey"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        /// Owner:Andy Gao 2011-08-03 14:58:11
        public DataTable LoadEquipmentChangeReasonsData(string equipmentChangeStateKey, out string msg)
        {
            #region Call Remoting Interface

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

            if (!string.IsNullOrEmpty(equipmentChangeStateKey))
            {
                DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable();

                object inputKey      = DBNull.Value;
                object inputEditor   = DBNull.Value;
                object inputEditTime = DBNull.Value;

                inputKey = equipmentChangeStateKey;

                inputParamDataTable.Rows.Add(new object[] { inputKey, inputEditor, inputEditTime });

                inputParamDataTable.AcceptChanges();

                reqDS.Tables.Add(inputParamDataTable);
            }

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                resDS = serverFactory.CreateIEquipmentChangeReasons().GetEquipmentChangeReasons(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_CHANGE_REASONS_FIELDS.DATABASE_TABLE_NAME]);

            #endregion
        }
Esempio n. 2
0
        /// <summary>
        /// Update Equipment Change Reasons Data
        /// </summary>
        /// <returns></returns>
        /// Owner:Andy Gao 2010-07-20 14:52:52
        private bool UpdateEquipmentChangeReasonsData()
        {
            #region Variables

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

            #endregion

            #region Build Equipment Change Reasons Data

            if (this.grdChangeReasons.DataSource != null && this.grdChangeReasons.DataSource is DataTable)
            {
                DataTable equipmentChangeReasonsDataTable = (DataTable)this.grdChangeReasons.DataSource;

                DataTable addedDataTable    = equipmentChangeReasonsDataTable.GetChanges(DataRowState.Added);
                DataTable modifiedDataTable = equipmentChangeReasonsDataTable.GetChanges(DataRowState.Modified);
                DataTable deletedDataTable  = equipmentChangeReasonsDataTable.GetChanges(DataRowState.Deleted);

                if ((addedDataTable != null && addedDataTable.Rows.Count > 0) ||
                    (modifiedDataTable != null && modifiedDataTable.Rows.Count > 0) ||
                    (deletedDataTable != null && deletedDataTable.Rows.Count > 0))
                {
                    equipmentChangeReasonsDataTable.TableName = EMS_EQUIPMENT_CHANGE_REASONS_FIELDS.DATABASE_TABLE_NAME;

                    reqDS.Tables.Add(equipmentChangeReasonsDataTable.Copy());
                }
                else
                {
                    MessageService.ShowMessage("${res:FanHai.Hemera.Addins.EMS.EquipmentChangeReasons.M0006}", "${res:Global.InformationText}");

                    return(false);
                }
            }

            #endregion

            #region Call Remoting Interface

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipmentChangeReasons().UpdateEquipmentChangeReasons(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. 3
0
        private void LoadEquipmentChangeReasonsData(string equipmentChangeStateKey)
        {
            #region Variables

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

            #endregion

            #region Build Input Parameters

            if (!string.IsNullOrEmpty(equipmentChangeStateKey))
            {
                DataTable inputParamDataTable = PARAMETERS_INPUT.CreateDataTable();

                object inputKey      = DBNull.Value;
                object inputEditor   = DBNull.Value;
                object inputEditTime = DBNull.Value;

                inputKey = equipmentChangeStateKey;

                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.CreateIEquipmentChangeReasons().GetEquipmentChangeReasons(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))
            {
                BindDataToChangeReasonsGrid(resDS.Tables[EMS_EQUIPMENT_CHANGE_REASONS_FIELDS.DATABASE_TABLE_NAME]);
            }
            else
            {
                MessageService.ShowError(returnMsg);
            }

            #endregion
        }