示例#1
0
        public bool UpdateUserPermissions(string name, bool receivingForm, bool shippingForm, bool customersForm, bool itmesForm, bool productionForm, bool costingReports, bool productionReports, bool advancedTabs, bool financialTabs)
        {
            SPG.SecurityDataTable permissions = Adapter.GetSecuritySettingsByUserName(name);

            if (permissions.Count() == 0)
            {
                //It is a new Product
                return(InsertUserPermissions(name, receivingForm, shippingForm, customersForm, itmesForm, productionForm, costingReports, productionReports, advancedTabs, financialTabs));
            }

            SPG.SecurityRow userPermissions = permissions[0];

            object[] originalRecord = userPermissions.ItemArray;

            userPermissions.ReceivingForm    = receivingForm;
            userPermissions.ShippingForm     = shippingForm;
            userPermissions.CustomersForm    = customersForm;
            userPermissions.ItemsForm        = itmesForm;
            userPermissions.ProductionForm   = productionForm;
            userPermissions.CostingReport    = costingReports;
            userPermissions.ProductionReport = productionReports;
            userPermissions.AdvancedTabs     = advancedTabs;
            userPermissions.FinancialTabs    = financialTabs;

            if (!(originalRecord == null))
            {
                UpdateAuditTrail(userPermissions, originalRecord);
            }

            int rowsAffected = Adapter.Update(userPermissions);

            return(rowsAffected == 1);
        }
示例#2
0
        public bool DeleteUserPermissions(string name)
        {
            SPG.SecurityDataTable permissions = Adapter.GetSecuritySettingsByUserName(name);
            int rowsAffected = 0;

            if (permissions.Count() == 1)
            {
                SPG.SecurityRow userPermissions = (SPG.SecurityRow)permissions.Rows[0];
                rowsAffected = Adapter.Delete(name, userPermissions.ts);
            }

            //Return true if precisely one row was deleted, otherwise return false.
            return(rowsAffected == 1);
        }