Beispiel #1
0
        public void DeleteResource()
        {
            DataSet dsReturn = new DataSet();

            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)
                {
                    dsReturn  = serverFactory.CreateIResourceEngine().DeleteResource(_resourceKey);
                    _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                }
            }
            catch (Exception ex)
            {
                _errorMsg = ex.Message;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }
Beispiel #2
0
        public void SaveResource(bool bNew, DataSet dataSet)
        {
            DataSet dsReturn = new DataSet();
            DataSet ds       = new DataSet();

            if (bNew)
            {
                ds = dataSet;
            }
            else
            {
                if (IsDirty)
                {
                    if (this.DirtyList.Count > 0)
                    {
                        if (DirtyList.ContainsKey(RBAC_RESOURCE_FIELDS.FIELD_RESOURCE_CODE))
                        {
                            DirtyItem dItem = new DirtyItem();
                            dItem.FieldOriginalValue = "";
                            dItem.FieldNewValue      = _resourceGroupKey;
                            DirtyList.Add(RBAC_RESOURCE_FIELDS.FIELD_RESOURCE_GROUP_KEY, dItem);
                        }
                        DataTable resourceTable = DataTableHelper.CreateDataTableForUpdateBasicData(RBAC_RESOURCE_FIELDS.DATABASE_TABLE_NAME);

                        foreach (string Key in DirtyList.Keys)
                        {
                            Dictionary <string, string> rowData = new Dictionary <string, string>()
                            {
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _resourceKey },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, Key },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, this.DirtyList[Key].FieldOriginalValue },
                                { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, this.DirtyList[Key].FieldNewValue }
                            };
                            FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref resourceTable, rowData);
                        }
                        if (resourceTable.Rows.Count > 0)
                        {
                            ds.Tables.Add(resourceTable);
                        }
                    }
                }
            }
            try
            {
                IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject();
                if (null != serverFactory)
                {
                    if (bNew)
                    {
                        dsReturn = serverFactory.CreateIResourceEngine().AddResource(ds);
                    }
                    else
                    {
                        dsReturn = serverFactory.CreateIResourceEngine().UpdateResource(ds);
                    }
                    _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn);
                }
            }
            catch (Exception ex)
            {
                _errorMsg = ex.Message;
            }
            finally
            {
                CallRemotingService.UnregisterChannel();
            }
        }