Example #1
0
        public void AddResourceGroup(bool bNew, DataSet dataset)
        {
            DataSet dsReturn = new DataSet();
            DataSet ds       = new DataSet();

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

                        foreach (string Key in DirtyList.Keys)
                        {
                            Dictionary <string, string> rowData = new Dictionary <string, string>()
                            {
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _GroupKey },
                                { 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 resourceGroupTable, rowData);
                        }
                        if (resourceGroupTable.Rows.Count > 0)
                        {
                            ds.Tables.Add(resourceGroupTable);
                        }
                    }
                }
            }
            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)
                {
                    if (bNew)
                    {
                        dsReturn = serverFactory.CreateIResourceGroupEngine().AddResourceGroup(ds);
                    }
                    else
                    {
                        dsReturn = serverFactory.CreateIResourceGroupEngine().UpdateResourceGroup(ds);
                    }
                    _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                }
            }
            catch (Exception ex)
            {
                _errorMsg = ex.Message;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }
Example #2
0
        public void DeleteResourceGroup()
        {
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)
                {
                    dsReturn  = serverFactory.CreateIResourceGroupEngine().DeleteResourceGroup(_GroupKey);
                    _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                }
            }
            catch (Exception ex)
            {
                _errorMsg = ex.Message;
            }
        }