Ejemplo n.º 1
0
        public void SaveOperation(bool bNew, DataSet dataset)
        {
            DataSet dsReturn = new DataSet();
            DataSet ds       = new DataSet();

            if (bNew)
            {
                ds = dataset;
            }
            else
            {
                if (IsDirty)
                {
                    if (DirtyList.Count > 0)
                    {
                        DataTable operationTable = DataTableHelper.CreateDataTableForUpdateBasicData(RBAC_OPERATION_FIELDS.DATABASE_TABLE_NAME);

                        foreach (string Key in DirtyList.Keys)
                        {
                            Dictionary <string, string> rowData = new Dictionary <string, string>()
                            {
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _operationKey },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, Key },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, DirtyList[Key].FieldOriginalValue },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, DirtyList[Key].FieldNewValue }
                            };
                            FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref operationTable, rowData);
                        }
                        if (operationTable.Rows.Count > 0)
                        {
                            ds.Tables.Add(operationTable);
                        }
                    }
                }
            }
            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)
                {
                    if (bNew)
                    {
                        dsReturn = serverFactory.CreateRBACOperationEngine().AddOperation(ds);
                    }
                    else
                    {
                        dsReturn = serverFactory.CreateRBACOperationEngine().UpdateOperation(ds);
                    }
                    _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                }
            }
            catch (Exception ex)
            {
                _errorMsg = ex.Message;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }
Ejemplo n.º 2
0
        public void DeleteOperation()
        {
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)
                {
                    dsReturn  = serverFactory.CreateRBACOperationEngine().DeleteOperation(_operationKey);
                    _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                }
            }
            catch (Exception ex)
            {
                _errorMsg = ex.Message;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }