Esempio n. 1
0
 /// <summary>
 /// Get enterprise via key
 /// </summary>
 /// <param name="enterpriseKey">enterpriseKey</param>
 public void GetEnterpriseByKey(string enterpriseKey)
 {
     try
     {
         string            msg      = string.Empty;
         DataSet           dsReturn = null;
         IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
         if (null != factor)
         {
             dsReturn = factor.CreateIEnterpriseEngine().GetEnterpriseByKey(enterpriseKey);
             msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
             if (msg != string.Empty)
             {
                 MessageService.ShowError(msg);
             }
             else
             {
                 SetEnterpriseProperties(dsReturn.Tables[POR_ROUTE_ENTERPRISE_VER_FIELDS.DATABASE_TABLE_NAME]);
                 if (dsReturn.Tables[POR_ROUTE_EP_VER_R_VER_FIELDS.DATABASE_TABLE_NAME].Rows.Count > 0)
                 {
                     SetEpAndRtRelation(dsReturn.Tables[POR_ROUTE_EP_VER_R_VER_FIELDS.DATABASE_TABLE_NAME]);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageService.ShowError(ex);
     }
     finally
     {
         CallRemotingService.UnregisterChannel();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Send delete data to server
        /// </summary>
        /// <returns>bool</returns>
        public override bool Delete()
        {
            try
            {
                string            msg      = string.Empty;
                DataSet           dsReturn = null;
                IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                if (null != factor)
                {
                    dsReturn = factor.CreateIEnterpriseEngine().EnterpriseDelete(_enterpriseKey);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                        return(false);
                    }
                    else
                    {
                        MessageService.ShowMessage("${res:Global.SuccessMessage}", "${res:Global.SystemInfo}");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            return(true);
        }
Esempio n. 3
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                Hashtable hashTable = new Hashtable();
                DataSet   dataSet   = new DataSet();

                string strName = this.txtName.Text.Trim();

                if (strName.Length > 0)
                {
                    hashTable.Add(POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_NAME, strName);
                }

                DataTable dataTable = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(hashTable);
                dataTable.TableName = POR_ROUTE_ENTERPRISE_VER_FIELDS.DATABASE_TABLE_NAME;
                dataSet.Tables.Add(dataTable);

                string            msg           = string.Empty;
                DataSet           dsReturn      = new DataSet();
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();

                if (serverFactory != null)
                {
                    dsReturn = serverFactory.CreateIEnterpriseEngine().EnterpriseSearch(dataSet);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                    if (msg != string.Empty)
                    {
                        MessageService.ShowError(msg);
                    }
                    else
                    {
                        if (dsReturn.Tables[POR_ROUTE_ENTERPRISE_VER_FIELDS.DATABASE_TABLE_NAME].Rows.Count < 1)
                        {
                            MessageService.ShowMessage
                                ("${res:FanHai.Hemera.Addins.FMM.SearchDialog.Message}", "${res:Global.SystemInfo}");
                        }

                        grdCtrlCommon.MainView   = grdViewCommon;
                        grdCtrlCommon.DataSource = dsReturn.Tables[POR_ROUTE_ENTERPRISE_VER_FIELDS.DATABASE_TABLE_NAME];
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取指定工步的下一个工步。
        /// </summary>
        /// <returns>包含下一个工步数据的数据集对象。</returns>
        /// <param name="enterpriseKey">工艺流程组KEY</param>
        /// <param name="routeKey">工艺路线KEY</param>
        /// <param name="stepKey">工步KEY</param>
        /// <returns>工艺流程组名称,主键;工艺流程名称,主键,工步名称,主键</returns>
        public DataSet GetEnterpriseNextRouteAndStep(string enterpriseKey, string routeKey, string stepKey)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                dsReturn      = serverFactory.CreateIEnterpriseEngine().GetEnterpriseNextRouteAndStep(enterpriseKey, routeKey, stepKey);
                this.ErrorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
            }
            catch (Exception ex)
            {
                this.ErrorMsg = ex.Message;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
            return(dsReturn);
        }
Esempio n. 5
0
        /// <summary>
        /// Send insert data to server
        /// </summary>
        /// <returns>bool</returns>
        public override bool Insert()
        {
            DataSet dataSet = new DataSet();
            //Add basic data
            DataTable enterpriseTable           = DataTableHelper.CreateDataTableForInsertEnterprise();
            Dictionary <string, string> dataRow = new Dictionary <string, string>()
            {
                { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ROUTE_ENTERPRISE_VER_KEY, _enterpriseKey },
                { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_NAME, _enterpriseName },
                { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_DESCRIPTION, _enterpriseDescription },
                { POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_STATUS,
                  Convert.ToInt32(_enterpriseStatus).ToString() },
                { COMMON_FIELDS.FIELD_COMMON_CREATOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME) },
                { COMMON_FIELDS.FIELD_COMMON_EDITOR, PropertyService.Get(PROPERTY_FIELDS.USER_NAME) }
            };

            FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref enterpriseTable, dataRow);
            dataSet.Tables.Add(enterpriseTable);

            if (enterpriseList.Count > 0)
            {
                DataTable relationTable = DataTableHelper.CreateDataTableForInsertEpAndRtRelation();

                foreach (Enterprises enterprises in enterpriseList)
                {
                    enterprises.EnterpriseKey = _enterpriseKey;
                    enterprises.ParseInsertAndDeleteDataToDataTable(ref relationTable);
                }

                if (relationTable.Rows.Count > 0)
                {
                    dataSet.Tables.Add(relationTable);
                }
            }

            try
            {
                int               code     = 0;
                string            msg      = string.Empty;
                DataSet           dsReturn = null;
                IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                if (null != factor)
                {
                    dsReturn = factor.CreateIEnterpriseEngine().EnterpriseInsert(dataSet);
                    msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn, ref code);
                    if (code == -1)
                    {
                        MessageService.ShowError(msg);
                        return(false);
                    }
                    else
                    {
                        this.EnterpriseVersion = msg;
                        this.ResetDirtyList();
                        foreach (Enterprises enterprises in enterpriseList)
                        {
                            enterprises.IsInitializeFinished = true;
                        }
                        MessageService.ShowMessage("${res:Global.SuccessMessage}", "${res:Global.SystemInfo}");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowError(ex);
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }

            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// control status function
        /// </summary>
        public override bool UpdateStatus()
        {
            if (IsDirty)
            {
                DataSet dataSet = new DataSet();

                if (this.DirtyList.Count > 0)
                {
                    DataTable enterpriseTable =
                        DataTableHelper.CreateDataTableForUpdateBasicData(POR_ROUTE_ENTERPRISE_VER_FIELDS.DATABASE_TABLE_NAME);

                    List <string> possibleDirtyFields = new List <string>()
                    {
                        POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_EDITOR,
                        POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_EDIT_TIME,
                        POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_EDIT_TIMEZONE,
                        POR_ROUTE_ENTERPRISE_VER_FIELDS.FIELD_ENTERPRISE_STATUS
                    };

                    string newValue = string.Empty;
                    foreach (string field in possibleDirtyFields)
                    {
                        if (this.DirtyList.ContainsKey(field))
                        {
                            Dictionary <string, string> rowData = new Dictionary <string, string>()
                            {
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _enterpriseKey },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, field },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, this.DirtyList[field].FieldOriginalValue },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, this.DirtyList[field].FieldNewValue }
                            };
                            FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref enterpriseTable, rowData);
                        }
                    }
                    if (enterpriseTable.Rows.Count > 0)
                    {
                        dataSet.Tables.Add(enterpriseTable);
                    }
                }

                try
                {
                    string            msg      = string.Empty;
                    DataSet           dsReturn = null;
                    IServerObjFactory factor   = CallRemotingService.GetRemoteObject();
                    if (null != factor)
                    {
                        dsReturn = factor.CreateIEnterpriseEngine().EnterpriseUpdate(dataSet);
                        msg      = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                        if (msg != string.Empty)
                        {
                            MessageService.ShowError(msg);
                            return(false);
                        }
                        else
                        {
                            this.ResetDirtyList();
                            MessageService.ShowMessage("${res:Global.UpdateStatusMessage}", "${res:Global.SystemInfo}");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageService.ShowError(ex);
                }
                finally
                {
                    CallRemotingService.UnregisterChannel();
                }
            }

            return(true);
        }