コード例 #1
0
ファイル: ActionAndStaff.cs プロジェクト: Lierba2014/erp-2
        public void insert(AtionAndStaffTable record)
        {
            if (record.actionID == 0)
            {
                return;
            }

            string insert = "INSERT INTO [dbo].[BASE_ACTION_STAFF]([ACTION_ID],[STAFF_ID]) VALUES(";

            insert += Convert.ToString(record.actionID) + ",";
            insert += Convert.ToString(record.staffID) + "";
            insert += ")";

            try
            {
                DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert);

                load();
            }
            catch (Exception error)
            {
                MessageBoxExtend.messageWarning(error.Message);
                return;
            }
        }
コード例 #2
0
ファイル: ActionAndStaff.cs プロジェクト: Lierba2014/erp-2
        private void load()
        {
            string sql = "SELECT [ACTION_ID],[STAFF_ID] FROM [dbo].[BASE_ACTION_STAFF]";

            m_actionAndStaffList.Clear();

            using (DataTable dataTable = DatabaseAccessFactoryInstance.Instance.QueryDataTable(FormMain.DB_NAME, sql))
            {
                foreach (DataRow row in dataTable.Rows)
                {
                    AtionAndStaffTable record = new AtionAndStaffTable();

                    record.actionID = DbDataConvert.ToInt32(row["ACTION_ID"]);
                    record.staffID  = DbDataConvert.ToInt32(row["STAFF_ID"]);

                    m_actionAndStaffList.Add(m_actionAndStaffList.Count, record);
                }
            }
        }
コード例 #3
0
ファイル: ActionAndStaff.cs プロジェクト: Lierba2014/erp-2
        // 判断某个用户是否拥有某个操作权限
        public bool isAccess(int staffID, int actionID)
        {
            bool isRet = false;

            if (m_actionAndStaffList.Count == 0)
            {
                load();
            }

            foreach (KeyValuePair <int, AtionAndStaffTable> index in m_actionAndStaffList)
            {
                AtionAndStaffTable record = new AtionAndStaffTable();
                record = index.Value;

                if (record.staffID == staffID && record.actionID == actionID)
                {
                    isRet = true;
                    break;
                }
            }

            return(isRet);
        }