CPMSystem/BLL/SectionOpt.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace CompanyPersonnelManagementSystem
{
    /// <summary>
    /// 管理部门业务
    /// </summary>
    class SectionOpt
    {
        DataOpt dataopt = new DataOpt();

        /// <summary>
        /// 添加部门
        /// </summary>
        /// <param name="sec">新部门</param>
        /// <returns>添加是否成功</returns>
        public bool AddSection(Section sec)
        {
            string sql = "select count(*) from Sections where SectionID='" + sec.SectionID + "' or SectionName='" + sec.SectionName + "'";
            if (dataopt.QueryTableRows(sql))
            {
                dataopt.Add(sec);
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="sec">部门</param>
        /// <returns>删除是否成功</returns>
        public bool DelectSection(Section sec)
        {
            string sqlsection = "select count(*) from Sections where SectionID='" + sec.SectionID + "'";
            string sqlstaff = "select count(*) from Staffs where SectionID='" + sec.SectionID + "'";
            if (!dataopt.QueryTableRows(sqlsection))
            {
                if (dataopt.QueryTableRows(sqlstaff))
                {
                    dataopt.Delete(sec);
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
后面还有 80 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。