Пример #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
        }
Пример #2
0
        public override bool Delete()
        {
            #region Variables

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

            #endregion

            #region Build Input Parameters

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

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

                if (!string.IsNullOrEmpty(equipmentKey))
                {
                    inputKey = equipmentKey;
                }

                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.CreateIEquipments().DeleteEquipments(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
        }
Пример #3
0
        public override bool Update()
        {
            #region Variables

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

            #endregion

            #region Build Input Parameters

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

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

                if (!string.IsNullOrEmpty(equipmentKey))
                {
                    inputKey = equipmentKey;
                }

                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 Data

            this.DirtyList.Add(EMS_EQUIPMENTS_FIELDS.FIELD_EDIT_TIME, new DirtyItem(EMS_EQUIPMENTS_FIELDS.FIELD_EDIT_TIME, "", ""));

            Editor       = PropertyService.Get(PROPERTY_FIELDS.USER_NAME);
            EditTimeZone = PropertyService.Get(PROPERTY_FIELDS.TIMEZONE);

            DataTable equipmentsDataTable = EMS_EQUIPMENTS_FIELDS.CreateDataTable();

            FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentsDataTable, DirtyList);

            equipmentsDataTable.AcceptChanges();

            reqDS.Tables.Add(equipmentsDataTable);

            #endregion

            #region Call Remoting Interface

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipments().UpdateEquipments(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
        }
Пример #4
0
        public override bool Insert(DataSet ds)
        {
            #region Variables

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

            #endregion

            #region Build Equipment Data
            DataTable equipmentsDataTable = EMS_EQUIPMENTS_FIELDS.CreateDataTable();

            Dictionary <string, string> dataRow = new Dictionary <string, string>()
            {
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_KEY, equipmentKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_NAME, equipmentName },
                { EMS_EQUIPMENTS_FIELDS.FIELD_DESCRIPTION, description },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CODE, equipmentCode },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_MODE, equipmentMode },
                { EMS_EQUIPMENTS_FIELDS.FIELD_MAXQUANTITY, maxQuantity },
                { EMS_EQUIPMENTS_FIELDS.FIELD_MINQUANTITY, minQuantity },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_TYPE, equipmentType },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_GROUP_KEY, equipmentGroupKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_LOCATION_KEY, equipmentLocationKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_ISBATCH, isBatch },
                { EMS_EQUIPMENTS_FIELDS.FIELD_ISCHAMBER, IsChamber },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CHAMBER_INDEX, chamberIndex },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CHAMBER_TOTAL, chamberTotal },
                { EMS_EQUIPMENTS_FIELDS.FIELD_ISMULTICHAMBER, isMultiChamber },
                { EMS_EQUIPMENTS_FIELDS.FIELD_PARENT_EQUIPMENT_KEY, parentEquipmentKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_STATE_KEY, equipmentStateKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_CHANGE_STATE_KEY, equipmentChangeStateKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_REAL_KEY, equipmentRealKey },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CREATOR, Creator },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone },
                { EMS_EQUIPMENTS_FIELDS.FIELD_CREATE_TIME, string.Empty },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_ASSETSNO, equipment_assetsno },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_AV_TIME, equipment_av_time },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_WPH, equipment_wph },
                { EMS_EQUIPMENTS_FIELDS.FIELD_EQUIPMENT_TRACT_TIME, equipment_tract_time }
            };

            FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentsDataTable, dataRow);

            equipmentsDataTable.AcceptChanges();

            //reqDS.Tables.Add(equipmentsDataTable);
            ds.Tables.Add(equipmentsDataTable);

            #endregion

            #region Build Input Parameters

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

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

                if (!string.IsNullOrEmpty(equipmentKey))
                {
                    inputKey = equipmentKey;
                }

                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);
                ds.Tables.Add(inputParamDataTable);
            }

            #endregion

            #region Call Remoting Interface

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    resDS = serverFactory.CreateIEquipments().InsertEquipments(ds);
                }
            }
            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
        }
Пример #5
0
        public override bool Insert()
        {
            #region Variables

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

            #endregion

            #region Build Equipment State Data

            DataTable equipmentStateDataTable = EMS_EQUIPMENT_STATES_FIELDS.CreateDataTable();

            Dictionary <string, string> dataRow = new Dictionary <string, string>()
            {
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_EQUIPMENT_STATE_KEY, equipmentStateKey },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_EQUIPMENT_STATE_NAME, equipmentStateName },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_DESCRIPTION, description },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_EQUIPMENT_STATE_TYPE, equipmentStateType },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_EQUIPMENT_STATE_CATEGORY, equipmentStateCategory },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_CREATOR, Creator },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_CREATE_TIMEZONE_KEY, CreateTimeZone },
                { EMS_EQUIPMENT_STATES_FIELDS.FIELD_CREATE_TIME, string.Empty }
            };

            FanHai.Hemera.Utils.Common.Utils.AddKeyValuesToDataTable(ref equipmentStateDataTable, dataRow);

            equipmentStateDataTable.AcceptChanges();

            reqDS.Tables.Add(equipmentStateDataTable);

            #endregion

            #region Build Input Parameters

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

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

                if (!string.IsNullOrEmpty(equipmentStateKey))
                {
                    inputKey = equipmentStateKey;
                }

                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.CreateIEquipmentStates().InsertEquipmentStates(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
        }
Пример #6
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
        }