Beispiel #1
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="delegates"></param>
        /// <returns></returns>
        public Status deleteMultipe(List <int> delegates)
        {
            if (delegates == null || delegates.Count == 0)
            {
                return(Status.SUCCESS);
            }

            //用于出错后恢复数据
            var    backup = new List <DelegateVO>();
            Status status = Status.SUCCESS;

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();
            AgendaDAO   agendaDao   = Factory.getInstance <AgendaDAO>();

            foreach (int delegateID in delegates)
            {
                DelegateVO delegateVo = delegateDao.getOne <DelegateVO>(delegateID);
                if (delegateVo == null)
                {
                    status = Status.NONFOUND;
                }

                //初始化会议操作
                meeting_initOperator(delegateVo.meetingID);
                //判断会议是否开启,如果不是”未开启“,直接退出
                if (!meeting_isNotOpen())
                {
                    status = Status.MEETING_OPENING;
                    break;
                }

                Dictionary <string, object> wherelist = new Dictionary <string, object>();
                //检查是否为主讲人,且是否存在主讲的议程,如果存在,直接返回
                wherelist.Clear();
                wherelist.Add("meetingID", delegateVo.meetingID);
                wherelist.Add("personID", delegateVo.personID);
                var tempAgenda = agendaDao.getAll <AgendaVO>(wherelist);
                if (tempAgenda != null && tempAgenda.Count > 0)
                {
                    status = Status.DELEGATE_USED;
                    break;
                }

                backup.Add(delegateVo);
                if (delegateDao.delete(delegateID) < 0)//删除失败就 恢复数据,返回
                {
                    status = Status.FAILURE;
                    break;
                }
            }
            if (status != Status.SUCCESS)
            {
                foreach (var delegateVo in backup)
                {
                    delegateDao.insert <DelegateVO>(delegateVo);
                }
            }
            return(status);
        }
Beispiel #2
0
        public static void DelegateToPreviousHead(long deptId)
        {
            long previousHead = DepartmentDAO.GetPreviousHead(deptId);
            long currentHead  = DepartmentDAO.GetCurrentHeadById(deptId);

            DelegateDAO.DeleteDelegate(deptId, currentHead);
            EmployeeDAO.ChangeEmployeeRoles(deptId);
            DepartmentDAO.UpdateDepartmentHead(deptId, previousHead);
        }
Beispiel #3
0
        /// <summary>
        /// 删除会议时使用
        /// </summary>
        /// <param name="meetingID"></param>
        /// <returns></returns>
        public Status deleteAll(int meetingID)
        {
            Dictionary <string, object> wherelist = new Dictionary <string, object>();
            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();

            wherelist.Add("meetingID", meetingID);
            delegateDao.delete(wherelist);
            return(Status.SUCCESS);
        }
Beispiel #4
0
        //为参会人员提供用户列表//排除已有参会人员
        public Status getNewForDelegate(int meetingID, out List <UserForDelegate> users)
        {
            users = new List <UserForDelegate>();

            PersonDAO   personDao   = Factory.getInstance <PersonDAO>();
            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();

            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            wherelist.Clear();
            wherelist.Add("meetingID", meetingID);
            var delegateVolist = delegateDao.getAll <DelegateVO>(wherelist);

            wherelist.Clear();
            wherelist.Add("personState", 0);
            //获取未冻结的用户信息
            List <PersonVO> personVolist = personDao.getAll <PersonVO>(wherelist);

            if (personVolist == null || personVolist.Count == 0)
            {
                return(Status.NONFOUND);
            }

            foreach (PersonVO vo in personVolist)
            {
                DelegateVO delegateVoTemp = null;

                if (delegateVolist != null)
                {
                    foreach (var delegateVo in delegateVolist)
                    {
                        if (delegateVo.personID == vo.personID)
                        {
                            delegateVoTemp = delegateVo;
                            break;
                        }
                    }
                }

                if (delegateVoTemp == null)
                {
                    users.Add(
                        new UserForDelegate
                    {
                        userID   = vo.personID,
                        userName = vo.personName
                    });
                }
            }

            return(Status.SUCCESS);
        }
Beispiel #5
0
        public static bool CheckDelegatedByDept(long deptId)
        {
            int count = DelegateDAO.CountDelegate(deptId);

            if (count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 创建参会人员
        /// </summary>
        /// <param name="createDelegate"></param>
        /// <returns></returns>
        public Status create(CreateDelegate createDelegate)
        {
            //初始化会议操作
            meeting_initOperator(createDelegate.meetingID);

            bool isUpdate = false;

            //判断会议是否开启,如果正在开启,更新“参会人员更新状态”,数据设置”更新“状态
            if (meeting_isOpening())
            {
                meeting_updateDelegate();
                isUpdate = true;
            }
            else if (meeting_isOpended())//如果会议已结束,直接退出
            {
                return(Status.FAILURE);
            }

            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            //验证同名参会人员是否存在
            wherelist.Clear();
            wherelist.Add("meetingID", createDelegate.meetingID);
            wherelist.Add("deviceID", createDelegate.deviceID);
            wherelist.Add("personID", createDelegate.userID);
            if (!unique <DelegateDAO, DelegateVO>(wherelist))
            {
                return(Status.NAME_EXIST);
            }

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();

            int delegateID = DelegateDAO.getID();

            if (delegateDao.insert <DelegateVO>(
                    new DelegateVO
            {
                delegateID = delegateID,
                personID = createDelegate.userID,
                deviceID = createDelegate.deviceID,
                meetingID = createDelegate.meetingID,
                personMeetingRole = createDelegate.userMeetingRole,
                isSignIn = false,
                isUpdate = isUpdate     //判断是否属于会议中新加入的信息
            }) < 0)
            {
                return(Status.FAILURE);
            }

            return(Status.SUCCESS);
        }
Beispiel #7
0
        public static bool AfterDate(long deptId)
        {
            DateTime now = System.DateTime.Now;

            Models.Delegate d = DelegateDAO.GetDelegateByDept(deptId);
            if (now >= d.ToDate)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #8
0
        public Status getSpeakerForAgenda(int meetingID, out List <SpeakerForAgenda> speakers)
        {
            speakers = new List <SpeakerForAgenda>();
            //获取会议中的全部主讲人和主持人
            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            wherelist.Add("meetingID", meetingID);
            //wherelist.Add("personMeetingRole", 2);//主讲人

            DelegateDAO       delegateDao    = Factory.getInstance <DelegateDAO>();
            List <DelegateVO> delegateVolist = delegateDao.getAll <DelegateVO>(wherelist);

            delegateVolist.RemoveAll(x =>
            {
                if (x.personMeetingRole == 1 || x.personMeetingRole == 2)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            });
            if (delegateVolist == null)
            {
                return(Status.NONFOUND);
            }

            PersonDAO personDao = Factory.getInstance <PersonDAO>();

            //将信息插入返回值
            foreach (DelegateVO delegateVo in delegateVolist)
            {
                //获取主讲人信息
                PersonVO personVo = personDao.getOne <PersonVO>(delegateVo.personID);
                if (personVo == null)
                {
                    continue;
                }

                speakers.Add(
                    new SpeakerForAgenda
                {
                    userID   = personVo.personID,
                    userName = personVo.personName
                });
            }

            return(Status.SUCCESS);
        }
Beispiel #9
0
        /// <summary>
        /// 获取指定会议的参会人员
        /// </summary>
        /// <param name="meetingID"></param>
        /// <param name="delegates"></param>
        /// <returns></returns>
        public Status getAll(int meetingID, out List <DelegateInfo> delegates)
        {
            delegates = new List <DelegateInfo>();

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();

            DeviceDAO deviceDao = Factory.getInstance <DeviceDAO>();

            PersonDAO personDao = Factory.getInstance <PersonDAO>();

            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            wherelist.Add("meetingID", meetingID);
            List <DelegateVO> delegateVos = delegateDao.getAll <DelegateVO>(wherelist);

            if (delegateVos == null)
            {
                return(Status.NONFOUND);
            }
            foreach (DelegateVO delegateVo in delegateVos)
            {
                //获取设备信息
                DeviceVO deviceVo = deviceDao.getOne <DeviceVO>(delegateVo.deviceID);
                //获取用户信息
                PersonVO personVo = personDao.getOne <PersonVO>(delegateVo.personID);

                if (deviceVo == null || personVo == null)
                {
                    return(Status.FAILURE);
                }

                delegates.Add(
                    new DelegateInfo
                {
                    delegateID      = delegateVo.delegateID,
                    userDepartment  = personVo.personDepartment,
                    meetingID       = meetingID,
                    userName        = personVo.personName,
                    userJob         = personVo.personJob,
                    userMeetingRole = delegateVo.personMeetingRole,
                    deviceID        = deviceVo.deviceID,
                    deviceIndex     = deviceVo.deviceIndex
                });
            }

            return(Status.SUCCESS);
        }
Beispiel #10
0
        public Dictionary <string, object> GetDelegateInfoOfDepartment()
        {
            Dictionary <string, object> resDict = new Dictionary <string, object>();

            Employee user = AuthUtil.GetCurrentLoggedUser();

            if (user == null)
            {
                resDict.Add("auth", false);
                return(resDict);
            }

            resDict.Add("auth", true);
            Models.Delegate del = DelegateDAO.GetDelegateInfoByDeptId((int)user.DeptId);

            resDict.Add("delegated", (del != null));
            resDict.Add("userInfo", del);

            return(resDict);
        }
Beispiel #11
0
 public static void AddNewDelegate(Models.Delegate d, long currentHead)
 {
     DelegateDAO.InsertNewDelegate(d);
     EmployeeDAO.UpdateEmployeeHead(d.Employee.EmpId, currentHead);
     DepartmentDAO.UpdateDepartmentHead(d.Department.DeptId, d.Employee.EmpId);
 }
Beispiel #12
0
        public Status getAllForDelegate(DateTime start, DateTime end, out List <DeviceForDelegate> list)
        {
            list = new List <DeviceForDelegate>();

            MeetingDAO  meetingDao  = Factory.getInstance <MeetingDAO>();
            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();
            DeviceDAO   deviceDao   = Factory.getInstance <DeviceDAO>();
            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            List <MeetingVO> meetingVolist = meetingDao.getAll <MeetingVO>();

            int dx;

            if (ConfigurationManager.AppSettings["DeviceOccupyTimeInterval"] == null)
            {
                dx = 30;
            }
            else
            {
                dx = Int32.Parse(ConfigurationManager.AppSettings["DeviceOccupyTimeInterval"]);
                if (dx < 1)
                {
                    dx = 30;
                }
            }

            var tempMeetings = meetingVolist
                               .Where( //包括与本次会议在几乎同一时间开启或结束的会议
                m => (Math.Abs((m.meetingToStartTime - start).TotalMinutes) < dx ||
                      Math.Abs((m.meetingToStartTime - end).TotalMinutes) < dx ||
                      Math.Abs((m.meetingStartedTime - start).TotalMinutes) < dx ||
                      Math.Abs((m.meetingStartedTime - end).TotalMinutes) < dx)
                )     //包括已开或正在开启的会议
                               .Where(m => m.meetingStatus == 1 || m.meetingStatus == 2);

            wherelist.Clear();
            //只允许未冻结的设备作为参会设备
            wherelist.Add("deviceState", 0);
            var deviceVolist = deviceDao.getAll <DeviceVO>(wherelist);

            if (tempMeetings != null && deviceVolist != null)
            {
                var meetinglist = tempMeetings.ToList();
                foreach (var meetingvo in meetinglist)
                {
                    wherelist.Clear();
                    wherelist.Add("meetingID", meetingvo.meetingID);
                    var delegateVolist = delegateDao.getAll <DelegateVO>(wherelist);

                    if (delegateVolist != null)
                    {
                        foreach (var delegateVo in delegateVolist)
                        {
                            for (int i = 0; i < deviceVolist.Count; i++)
                            {
                                if (deviceVolist[i].deviceID == delegateVo.deviceID)
                                {
                                    //去除已使用的设备
                                    deviceVolist.RemoveAt(i);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            if (deviceVolist != null)
            {
                foreach (var devicevo in deviceVolist)
                {
                    list.Add(new DeviceForDelegate
                    {
                        deviceID    = devicevo.deviceID,
                        deviceIndex = devicevo.deviceIndex
                    });
                }
            }

            return(Status.SUCCESS);
        }
Beispiel #13
0
        /// <summary>
        /// 更新参会人员信息
        /// </summary>
        /// <param name="updateDelegate"></param>
        /// <returns></returns>
        public Status update(UpdateDelegate updateDelegate)
        {
            //初始化会议操作
            meeting_initOperator(updateDelegate.meetingID);
            //验证当前用户的更新当前会议权限

            //判断会议是否开启,如果正在开启,直接退出
            if (meeting_isOpening())
            {
                return(Status.MEETING_OPENING);
            }
            else if (meeting_isOpended())//如果会议已结束,直接退出
            {
                return(Status.FAILURE);
            }

            //更新参会人员信息
            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();
            AgendaDAO   agendaDao   = Factory.getInstance <AgendaDAO>();
            DelegateVO  delegateVo  = delegateDao.getOne <DelegateVO>(updateDelegate.delegateID);

            if (delegateVo == null)
            {
                return(Status.NONFOUND);
            }

            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            //检查是否存在主讲的议程,如果存在,直接返回
            wherelist.Clear();
            wherelist.Add("meetingID", delegateVo.meetingID);
            wherelist.Add("personID", delegateVo.personID);
            var tempAgenda = agendaDao.getAll <DelegateVO>(wherelist);

            if (tempAgenda != null && tempAgenda.Count > 0)
            {
                return(Status.DELEGATE_USED);
            }

            //此处限制某一设备在一个会议中,如果已经分配,则无法改变其分配情况,
            //但现在,需要交换同一个会议中的两台已分配的设备,故删去此限制
            //if(delegateVo.deviceID!=updateDelegate.deviceID)//设备改变
            //{
            //    wherelist.Clear();
            //    wherelist.Add("meetingID", updateDelegate.meetingID);
            //    wherelist.Add("deviceID", updateDelegate.deviceID);
            //    if (!unique<DelegateDAO, DelegateVO>(wherelist))
            //    {
            //        return Status.DEVICE_OCCUPY;
            //    }
            //}


            Dictionary <string, object> setlist = new Dictionary <string, object>();

            setlist.Add("deviceID", updateDelegate.deviceID);
            setlist.Add("personMeetingRole", updateDelegate.userMeetingRole);

            if (delegateDao.update(setlist, updateDelegate.delegateID) < 0)
            {
                return(Status.FAILURE);
            }

            return(Status.SUCCESS);
        }
Beispiel #14
0
        /// <summary>
        /// 同时创建多个参会人员
        /// </summary>
        /// <returns></returns>
        public Status createMultiple(List <DeviceForDelegate> devices, int meetingID, CreateDelegateForMeeting delegates)
        {
            if (delegates == null)
            {
                return(Status.SUCCESS);
            }
            List <int> delegateIDs = new List <int>();

            int tempDelegateID             = 0;
            DeviceForDelegate tempDevice   = null;
            DelegateVO        tempDelegate = null;

            Status status = Status.SUCCESS;

            int delegateNum = 1;

            if (delegates.speakerIDs != null)
            {
                if (delegates.speakerIDs.Contains(delegates.hostID))
                {
                    delegates.speakerIDs.Remove(delegates.hostID);
                }
                delegateNum += delegates.speakerIDs.Count;
            }
            if (delegates.otherIDs != null)
            {
                if (delegates.otherIDs.Contains(delegates.hostID))
                {
                    delegates.otherIDs.Remove(delegates.hostID);
                }
                delegateNum += delegates.otherIDs.Count;
            }

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();
            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            do
            {
                //如果设备数量不足则失败
                if (devices == null || devices.Count < delegateNum)
                {
                    status = Status.DEVICE_LACK;
                    break;
                }

                //添加主持人
                tempDelegateID = DelegateDAO.getID();
                tempDevice     = devices[0];
                devices.Remove(tempDevice);

                //验证同名参会人员是否存在
                wherelist.Clear();
                wherelist.Add("meetingID", meetingID);
                wherelist.Add("personID", delegates.hostID);
                if (!unique <DelegateDAO, DelegateVO>(wherelist))
                {
                    return(Status.NAME_EXIST);
                }

                tempDelegate = new DelegateVO
                {
                    delegateID        = tempDelegateID,
                    deviceID          = tempDevice.deviceID,
                    meetingID         = meetingID,
                    personID          = delegates.hostID,
                    isSignIn          = false,
                    isUpdate          = false,
                    personMeetingRole = 1
                };
                if (delegateDao.insert <DelegateVO>(tempDelegate) < 0)
                {
                    status = Status.DATABASE_OPERATOR_ERROR;
                    break;
                }
                else
                {
                    delegateIDs.Add(tempDelegateID);
                }

                //添加主讲人
                if (delegates.speakerIDs != null)
                {
                    foreach (var speakerID in delegates.speakerIDs)
                    {
                        tempDelegateID = DelegateDAO.getID();
                        tempDevice     = devices[0];
                        devices.Remove(tempDevice);

                        //验证同名参会人员是否存在
                        wherelist.Clear();
                        wherelist.Add("meetingID", meetingID);
                        wherelist.Add("personID", speakerID);
                        if (!unique <DelegateDAO, DelegateVO>(wherelist))
                        {
                            continue;
                        }

                        tempDelegate = new DelegateVO
                        {
                            delegateID        = tempDelegateID,
                            deviceID          = tempDevice.deviceID,
                            meetingID         = meetingID,
                            personID          = speakerID,
                            isSignIn          = false,
                            isUpdate          = false,
                            personMeetingRole = 2
                        };
                        if (delegateDao.insert <DelegateVO>(tempDelegate) < 0)
                        {
                            status = Status.DATABASE_OPERATOR_ERROR;
                            break;
                        }
                        else
                        {
                            delegateIDs.Add(tempDelegateID);
                        }
                    }
                }

                //添加参会人员
                if (delegates.otherIDs != null)
                {
                    foreach (var otherID in delegates.otherIDs)
                    {
                        tempDelegateID = DelegateDAO.getID();
                        tempDevice     = devices[0];
                        devices.Remove(tempDevice);

                        //验证同名参会人员是否存在
                        wherelist.Clear();
                        wherelist.Add("meetingID", meetingID);
                        wherelist.Add("personID", otherID);
                        if (!unique <DelegateDAO, DelegateVO>(wherelist))
                        {
                            continue;
                        }

                        tempDelegate = new DelegateVO
                        {
                            delegateID        = tempDelegateID,
                            deviceID          = tempDevice.deviceID,
                            meetingID         = meetingID,
                            personID          = otherID,
                            isSignIn          = false,
                            isUpdate          = false,
                            personMeetingRole = 0
                        };
                        if (delegateDao.insert <DelegateVO>(tempDelegate) < 0)
                        {
                            status = Status.DATABASE_OPERATOR_ERROR;
                            break;
                        }
                        else
                        {
                            delegateIDs.Add(tempDelegateID);
                        }
                    }
                }
            } while (false);

            if (status != Status.SUCCESS)
            {
                //删除之前添加的参会人员
                foreach (var delegateID in delegateIDs)
                {
                    delegateDao.delete(delegateID);
                }
            }

            return(status);
        }
Beispiel #15
0
        /// <summary>
        /// 须其他程序调用,不能在本程序调用
        /// 添加测试数据
        /// </summary>
        public static void init()
        {
            Log.DebugInfo("测试数据初始化...");

            PersonDAO          personDao          = Factory.getInstance <PersonDAO>();
            RoleDAO            roleDao            = Factory.getInstance <RoleDAO>();
            Person_RoleDAO     person_roleDao     = Factory.getInstance <Person_RoleDAO>();
            PermissionDAO      permissionDao      = Factory.getInstance <PermissionDAO>();
            Role_PermissionDAO role_permissionDao = Factory.getInstance <Role_PermissionDAO>();

            DeviceDAO       deviceDao       = Factory.getInstance <DeviceDAO>();
            MeetingPlaceDAO meetingPlaceDao = Factory.getInstance <MeetingPlaceDAO>();

            MeetingDAO meetingDao = Factory.getInstance <MeetingDAO>();

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();

            AgendaDAO agendaDao = Factory.getInstance <AgendaDAO>();

            FileDAO fileDao = Factory.getInstance <FileDAO>();

            VoteDAO voteDao = Factory.getInstance <VoteDAO>();

            VoteOptionDAO voteOptionDao = Factory.getInstance <VoteOptionDAO>();

            VoteOptionPersonResultDAO voteOptionPersonResultDao = Factory.getInstance <VoteOptionPersonResultDAO>();

            //============================

            voteOptionPersonResultDao.deleteAll_test("voteOptionPersonResult");
            voteOptionDao.deleteAll_test("voteOption");
            voteDao.deleteAll_test("vote");
            fileDao.deleteAll_test("file");
            agendaDao.deleteAll_test("agenda");
            delegateDao.deleteAll_test("delegate");
            meetingDao.deleteAll_test("meeting");

            deviceDao.deleteAll_test("device");
            meetingPlaceDao.deleteAll_test("meetingPlace");

            person_roleDao.deleteAll();
            personDao.deleteAll();

            #region 会议测试数据
            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            Dictionary <string, DeviceVO> devices = new Dictionary <String, DeviceVO>();
            int      deviceNum = 4;
            int[]    deviceIDs = new int[deviceNum];
            string[] IMEIs     = new string[deviceNum];
            for (int i = 0; i < deviceNum; i++)
            {
                deviceIDs[i] = DeviceDAO.getID();
            }
            IMEIs[0] = "862823023300520";
            IMEIs[1] = "862823023301916";
            IMEIs[2] = "359365002515686";
            IMEIs[3] = "862823023300546";

            for (int i = 0; i < deviceNum; i++)
            {
                devices.Add(IMEIs[i],
                            new DeviceVO
                {
                    deviceID    = deviceIDs[i],
                    IMEI        = IMEIs[i],
                    deviceIndex = i + 1,
                    deviceState = 0
                });
            }

            Console.WriteLine("添加设备");

            for (int i = 0; i < devices.Count; i++)
            {
                wherelist.Clear();
                wherelist.Add("IMEI", IMEIs[i]);
                DeviceVO tempVo = deviceDao.getOne <DeviceVO>(wherelist);
                if (tempVo != null)
                {
                    devices[IMEIs[i]] = tempVo;
                    deviceIDs[i]      = tempVo.deviceID;
                    continue;
                }
                Console.WriteLine(deviceDao.insert <DeviceVO>(devices[IMEIs[i]]));
            }



            Dictionary <String, MeetingPlaceVO> meetingPlaces = new Dictionary <string, MeetingPlaceVO>();

            int   meetingPlaceNum = 2;
            int[] meetingPlaceIDs = new int[meetingPlaceNum];

            string[] meetingPlaceNames = new string[meetingPlaceNum];
            for (int i = 0; i < meetingPlaceNum; i++)
            {
                meetingPlaceIDs[i] = MeetingPlaceDAO.getID();
            }
            meetingPlaceNames[0] = "学术会议室";
            meetingPlaceNames[1] = "决策室";

            for (int i = 0; i < meetingPlaceNum; i++)
            {
                meetingPlaces.Add(meetingPlaceNames[i],
                                  new MeetingPlaceVO
                {
                    meetingPlaceID       = meetingPlaceIDs[i],
                    meetingPlaceName     = meetingPlaceNames[i],
                    meetingPlaceCapacity = 200,
                    meetingPlaceState    = 0,
                    seatType             = 0
                });
            }

            //////////////////////////////////
            Console.WriteLine("添加会场及对应的会场类型");
            for (int i = 0; i < meetingPlaceNum; i++)
            {
                Console.WriteLine(meetingPlaceDao.insert <MeetingPlaceVO>(meetingPlaces[meetingPlaceNames[i]]));
            }


            int[]    personIDs   = new int[deviceNum];
            string[] personNames = new string[deviceNum];
            Dictionary <string, PersonVO> persons = new Dictionary <string, PersonVO>();
            for (int i = 0; i < deviceNum; i++)
            {
                personIDs[i] = PersonDAO.getID();
            }
            personNames[0] = "张丰";
            personNames[1] = "李志强";
            personNames[2] = "欧阳致远";
            personNames[3] = "杨棠";

            int personIndex = 0;
            persons.Add(personNames[personIndex],
                        new PersonVO
            {
                personID          = personIDs[personIndex],
                personName        = personNames[personIndex],
                personDepartment  = "董事",
                personJob         = "董事长",
                personDescription = "测试",
                personPassword    = "******",
                personState       = 0,
                personLevel       = 1
            });
            personIndex++;
            persons.Add(personNames[personIndex],
                        new PersonVO
            {
                personID          = personIDs[personIndex],
                personName        = personNames[personIndex],
                personDepartment  = "电子商务部",
                personJob         = "股东",
                personDescription = "测试",
                personPassword    = "******",
                personState       = 0,
                personLevel       = 3
            });
            personIndex++;
            persons.Add(personNames[personIndex],
                        new PersonVO
            {
                personID          = personIDs[personIndex],
                personName        = personNames[personIndex],
                personDepartment  = "财务部",
                personJob         = "股东",
                personDescription = "测试",
                personPassword    = "******",
                personState       = 0,
                personLevel       = 4
            });
            personIndex++;
            persons.Add(personNames[personIndex],
                        new PersonVO
            {
                personID          = personIDs[personIndex],
                personName        = personNames[personIndex],
                personDepartment  = "研发一部",
                personJob         = "股东",
                personDescription = "测试",
                personPassword    = "******",
                personState       = 0,
                personLevel       = 2
            });
            personIndex++;

            //////////////////////////////////////
            Console.WriteLine("添加用户");
            for (int i = 0; i < deviceNum; i++)
            {
                wherelist.Clear();
                wherelist.Add("personName", personNames[i]);
                PersonVO tempVo = personDao.getOne <PersonVO>(wherelist);
                if (tempVo != null)
                {
                    persons[personNames[i]] = tempVo;
                    personIDs[i]            = tempVo.personID;
                    continue;
                }
                Console.WriteLine(personDao.insert <PersonVO>(persons[personNames[i]]));
            }

            int[] person_roleIDs = new int[deviceNum];
            for (int i = 0; i < deviceNum; i++)
            {
                person_roleIDs[i] = Person_RoleDAO.getID();
            }

            List <Person_RoleVO> person_roles = new List <Person_RoleVO>();
            //默认为无权限角色:"成员"角色,roleID=3
            for (int i = 0; i < deviceNum; i++)
            {
                if (i == 3)
                {
                    person_roles.Add(new Person_RoleVO {
                        person_roleID = person_roleIDs[i], roleID = 2, personID = personIDs[i]
                    });
                }
                else
                {
                    person_roles.Add(new Person_RoleVO {
                        person_roleID = person_roleIDs[i], roleID = 3, personID = personIDs[i]
                    });
                }
            }
            Console.WriteLine("添加用户角色关联");
            for (int i = 0; i < deviceNum; i++)
            {
                wherelist.Clear();
                wherelist.Add("personID", personIDs[i]);
                Person_RoleVO tempVo = person_roleDao.getOne <Person_RoleVO>(wherelist);
                if (tempVo != null)
                {
                    continue;
                }
                Console.WriteLine(person_roleDao.insert <Person_RoleVO>(person_roles[i]));
            }

            ///////////////////////////////////////
            Console.WriteLine("添加会议");

            int       meetingID = MeetingDAO.getID();
            MeetingVO meeting   = new MeetingVO();
            meeting.meetingID          = meetingID;
            meeting.meetingPlaceID     = meetingPlaceIDs[0];
            meeting.meetingName        = "二零一六年年度股东大会暨股东扩大会议";
            meeting.meetingSummary     = "";
            meeting.meetingStatus      = 1;
            meeting.meetingStartedTime = (new DateTime(DateTime.Now.AddDays(6).Ticks));
            meeting.meetingToStartTime = (new DateTime(DateTime.Now.AddDays(5).Ticks));
            meeting.meetingDuration    = 150;
            meeting.personID           = 1;

            do
            {
                wherelist.Clear();
                wherelist.Add("meetingName", meeting.meetingName);
                MeetingVO tempVo = meetingDao.getOne <MeetingVO>(wherelist);
                if (tempVo != null)
                {
                    meetingID = tempVo.meetingID;
                    break;
                }
                Console.WriteLine(meetingDao.insert <MeetingVO>(meeting));
            } while (false);

            ////////////////////////////////////////////
            Console.WriteLine("添加参会人员");
            List <DelegateVO> delegates   = new List <DelegateVO>();
            int[]             delegateIDs = new int[deviceNum];

            for (int i = 0; i < deviceNum; i++)
            {
                delegateIDs[i] = DelegateDAO.getID();
            }
            int delegateIndex = 0;
            delegates.Add(
                new DelegateVO
            {
                delegateID        = delegateIDs[delegateIndex],
                deviceID          = deviceIDs[delegateIndex],
                personID          = personIDs[delegateIndex],
                meetingID         = meetingID,
                personMeetingRole = 1,
                isSignIn          = false
            });
            delegateIndex++;
            delegates.Add(
                new DelegateVO
            {
                delegateID        = delegateIDs[delegateIndex],
                deviceID          = deviceIDs[delegateIndex],
                personID          = personIDs[delegateIndex],
                meetingID         = meetingID,
                personMeetingRole = 0,
                isSignIn          = false
            });
            delegateIndex++;
            delegates.Add(
                new DelegateVO
            {
                delegateID        = delegateIDs[delegateIndex],
                deviceID          = deviceIDs[delegateIndex],
                personID          = personIDs[delegateIndex],
                meetingID         = meetingID,
                personMeetingRole = 0,
                isSignIn          = false
            });
            delegateIndex++;
            delegates.Add(
                new DelegateVO
            {
                delegateID        = delegateIDs[delegateIndex],
                deviceID          = deviceIDs[delegateIndex],
                personID          = personIDs[delegateIndex],
                meetingID         = meetingID,
                personMeetingRole = 2,
                isSignIn          = false
            });
            delegateIndex++;
            foreach (DelegateVO vo in delegates)
            {
                Console.WriteLine(delegateDao.insert <DelegateVO>(vo));
            }

            //////////////////////////////////////////
            Console.WriteLine("添加议程");
            int agendaNum = 3;
            Dictionary <int, AgendaVO> agendas = new Dictionary <int, AgendaVO>();
            int[] agendaIDs = new int[agendaNum];
            for (int i = 0; i < agendaNum; i++)
            {
                agendaIDs[i] = AgendaDAO.getID();
            }

            int agendaIndex = 0;
            agendas.Add(agendaIDs[agendaIndex],
                        new AgendaVO
            {
                agendaID       = agendaIDs[agendaIndex],
                agendaIndex    = agendaIndex + 1,
                agendaName     = "普通决议案",
                agendaDuration = 50,
                meetingID      = meetingID,
                personID       = personIDs[3],//主讲人
                isUpdate       = false
            });
            agendaIndex++;
            agendas.Add(agendaIDs[agendaIndex],
                        new AgendaVO
            {
                agendaID       = agendaIDs[agendaIndex],
                agendaIndex    = agendaIndex + 1,
                agendaName     = "具体项目负责人汇报",
                agendaDuration = 50,
                meetingID      = meetingID,
                personID       = personIDs[0],
                isUpdate       = false
            });
            agendaIndex++;
            agendas.Add(agendaIDs[agendaIndex],
                        new AgendaVO
            {
                agendaID       = agendaIDs[agendaIndex],
                agendaIndex    = agendaIndex + 1,
                agendaName     = "特别决议案",
                agendaDuration = 50,
                meetingID      = meetingID,
                personID       = personIDs[0],
                isUpdate       = false
            });
            agendaIndex++;
            for (int i = 0; i < agendaNum; i++)
            {
                Console.WriteLine(agendaDao.insert <AgendaVO>(agendas[agendaIDs[i]]));
            }

            //////////////////////////////////////////
            Console.WriteLine("添加附件");

            //////////////////////////////////////////


            List <VoteVO>       votes        = new List <VoteVO>();
            List <VoteOptionVO> vote1Options = new List <VoteOptionVO>();
            List <VoteOptionVO> vote2Options = new List <VoteOptionVO>();

            int   voteNum = 2;
            int[] voteIDs = new int[voteNum];
            for (int i = 0; i < voteNum; i++)
            {
                voteIDs[i] = VoteDAO.getID();
            }

            int   voteOptionNum  = 4;
            int[] vote1OptionIDs = new int[voteOptionNum];
            int[] vote2OptionIDs = new int[voteOptionNum];
            for (int i = 0; i < 4; i++)
            {
                vote1OptionIDs[i] = VoteOptionDAO.getID();
                vote2OptionIDs[i] = VoteOptionDAO.getID();
            }

            Console.WriteLine("添加表决");
            //表决
            int voteStatus = 0;
            votes.Add(
                new VoteVO
            {
                agendaID        = agendaIDs[2],
                voteID          = voteIDs[0],
                voteName        = "选举董事会成员、监事会成员",
                voteDescription = "选举本公司第二届董事会成员、第二届监事会成员",
                voteIndex       = 1,
                voteStatus      = voteStatus,
                voteType        = 2 //双选
            });

            votes.Add(
                new VoteVO
            {
                agendaID        = agendaIDs[2],
                voteID          = voteIDs[1],
                voteName        = "提请人选的决议",
                voteDescription = "提请公司董事会关于董事长人选的决议",
                voteIndex       = 1,
                voteStatus      = voteStatus,
                voteType        = 1
            });
            vote1Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[0],
                voteOptionID    = vote1OptionIDs[0],
                voteOptionIndex = 0,
                voteOptionName  = "张丰"
            });
            vote1Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[0],
                voteOptionID    = vote1OptionIDs[1],
                voteOptionIndex = 0,
                voteOptionName  = "欧阳致远"
            });
            vote1Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[0],
                voteOptionID    = vote1OptionIDs[2],
                voteOptionIndex = 0,
                voteOptionName  = "杨棠"
            });
            vote1Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[0],
                voteOptionID    = vote1OptionIDs[3],
                voteOptionIndex = 0,
                voteOptionName  = "李志强"
            });

            vote2Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[1],
                voteOptionID    = vote2OptionIDs[0],
                voteOptionIndex = 0,
                voteOptionName  = "张丰"
            });
            vote2Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[1],
                voteOptionID    = vote2OptionIDs[1],
                voteOptionIndex = 0,
                voteOptionName  = "李志强"
            });
            vote2Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[1],
                voteOptionID    = vote2OptionIDs[2],
                voteOptionIndex = 0,
                voteOptionName  = "欧阳致远"
            });
            vote2Options.Add(
                new VoteOptionVO
            {
                voteID          = voteIDs[1],
                voteOptionID    = vote2OptionIDs[3],
                voteOptionIndex = 0,
                voteOptionName  = "杨棠"
            });

            foreach (VoteVO vo in votes)
            {
                Console.WriteLine(voteDao.insert <VoteVO>(vo));
            }

            foreach (VoteOptionVO vo in vote1Options)
            {
                Console.WriteLine(voteOptionDao.insert <VoteOptionVO>(vo));
            }

            foreach (VoteOptionVO vo in vote2Options)
            {
                Console.WriteLine(voteOptionDao.insert <VoteOptionVO>(vo));
            }

            #endregion

            Log.DebugInfo("测试数据初始化结束");
        }
Beispiel #16
0
        /// <summary>
        /// 此函数必须单独运行,同时停止其他持有数据库的程序的运行,
        /// 防止其他程序对数据库主键产生冲突。
        /// 初始化过程,表中主键ID为人为直接制定
        /// </summary>
        static void reset()
        {
            //==================

            #region  除所有数据
            Queue <String> tableNames = new Queue <string>();
            tableNames.Enqueue("person_role");
            tableNames.Enqueue("role_permission");
            tableNames.Enqueue("role");
            tableNames.Enqueue("permission");
            tableNames.Enqueue("voteOptionPersonResult");
            tableNames.Enqueue("voteOption");
            tableNames.Enqueue("vote");
            tableNames.Enqueue("file");
            tableNames.Enqueue("agenda");
            tableNames.Enqueue("delegate");
            tableNames.Enqueue("meeting");
            tableNames.Enqueue("meetingPlace");
            tableNames.Enqueue("person");
            tableNames.Enqueue("device");
            tableNames.Enqueue("person");
            while (tableNames.Count != 0)
            {
                //删除数据库数据,不使用DAO
                string commandText = "delete from " + tableNames.Dequeue() + ";";
                DBFactory.GetInstance().ExecuteNonQuery(commandText, null);
            }
            #endregion
            /////////////////////////////////////////////////////////////////////////

            #region 初始化数据库表操作对象
            PersonDAO          personDao          = Factory.getInstance <PersonDAO>();
            RoleDAO            roleDao            = Factory.getInstance <RoleDAO>();
            Person_RoleDAO     person_roleDao     = Factory.getInstance <Person_RoleDAO>();
            PermissionDAO      permissionDao      = Factory.getInstance <PermissionDAO>();
            Role_PermissionDAO role_permissionDao = Factory.getInstance <Role_PermissionDAO>();

            DeviceDAO       deviceDao       = Factory.getInstance <DeviceDAO>();
            MeetingPlaceDAO meetingPlaceDao = Factory.getInstance <MeetingPlaceDAO>();

            MeetingDAO meetingDao = Factory.getInstance <MeetingDAO>();

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();

            AgendaDAO agendaDao = Factory.getInstance <AgendaDAO>();

            FileDAO fileDao = Factory.getInstance <FileDAO>();

            VoteDAO voteDao = Factory.getInstance <VoteDAO>();

            VoteOptionDAO voteOptionDao = Factory.getInstance <VoteOptionDAO>();

            VoteOptionPersonResultDAO voteOptionPersonResultDao = Factory.getInstance <VoteOptionPersonResultDAO>();

            #endregion

            #region webServer 系统初始化数据

            #region 添加超级管理员用户
            Console.WriteLine("添加超级管理员用户");

            PersonVO admin   = new PersonVO();
            int      adminID = 1;//超级管理员用户ID固定为1

            admin.personID          = adminID;
            admin.personName        = "超级管理员";
            admin.personDepartment  = "##";
            admin.personJob         = "##";
            admin.personDescription = "***";
            admin.personPassword    = "******";
            admin.personState       = 1;
            admin.isAdmin           = true;

            Console.WriteLine(personDao.insert <PersonVO>(admin));
            #endregion

            #region 角色、权限

            #region 添加系统基本角色 1-超级管理员,2-会议组织者,3-成员
            Console.WriteLine("添加系统基本角色");
            //系统角色,超级管理员角色ID=1,会议组织者=2,成员=3
            int[] roleIDs = new int[3];
            roleIDs[0] = 1;
            roleIDs[1] = 2;
            roleIDs[2] = 3;

            List <RoleVO> roles = new List <RoleVO>();
            roles.Add(new RoleVO {
                roleID = roleIDs[0], roleName = "超级管理员", isIntegrant = true
            });
            roles.Add(new RoleVO {
                roleID = roleIDs[1], roleName = "会议组织者", isIntegrant = true
            });
            roles.Add(new RoleVO {
                roleID = roleIDs[2], roleName = "成员", isIntegrant = true
            });

            foreach (RoleVO vo in roles)
            {
                Console.WriteLine(roleDao.insert <RoleVO>(vo));
            }
            #endregion

            #region 添加权限(超级管理员角色)
            Console.WriteLine("添加权限(超级管理员角色)");

            List <PermissionVO> permissions_admin = new List <PermissionVO>();

            #region 超级管理员角色的权限列表
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "进入管理员首页",
                permissionDescription = "Account-Admin"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "查看会场",
                permissionDescription = "MeetingPlace-GetMeetingPlaces"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加会场",
                permissionDescription = "MeetingPlace-CreateMeetingPlace"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新前获取会场",
                permissionDescription = "MeetingPlace-GetMeetingPlaceForUpdate"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新会场",
                permissionDescription = "MeetingPlace-UpdateMeetingPlace"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新会场状态",
                permissionDescription = "MeetingPlace-UpdateMeetingPlaceAvailable"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "查看设备",
                permissionDescription = "Device-GetDevices"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加设备",
                permissionDescription = "Device-CreateDevice"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新前获取设备",
                permissionDescription = "Device-GetDeviceForUpdate"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新设备",
                permissionDescription = "Device-UpdateDevice"
            });

            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新设备状态",
                permissionDescription = "Device-UpdateDeviceAvailable"
            });

            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "查看用户",
                permissionDescription = "User-GetUsers"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加用户",
                permissionDescription = "User-CreateUser"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新前获取用户",
                permissionDescription = "User-GetUserForUpdate"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新用户",
                permissionDescription = "User-UpdateUser"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "更新用户状态",
                permissionDescription = "User-UpdateUserAvailable"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "导入用户信息",
                permissionDescription = "User-Upload"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "查看权限",
                permissionDescription = "Role-GetPermissions"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "查看角色",
                permissionDescription = "Role-GetRoles"
            });
            //
            permissions_admin.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "创建角色",
                permissionDescription = "Role-CreateRole"
            });



            foreach (PermissionVO vo in permissions_admin)
            {
                Console.WriteLine(permissionDao.insert <PermissionVO>(vo));
            }

            #endregion

            #region 建立超级管理员角色与权限关联
            Console.WriteLine("建立超级管理员角色与权限关联");

            //管理员角色、权限
            List <Role_PermissionVO> role_permissions_admin = new System.Collections.Generic.List <Role_PermissionVO>();
            foreach (PermissionVO permissionVo in permissions_admin)
            {
                role_permissions_admin.Add(
                    new Role_PermissionVO
                {
                    role_permissionID = Role_PermissionDAO.getID(),
                    roleID            = roleIDs[0],
                    permissionID      = permissionVo.permissionID
                });
            }

            foreach (Role_PermissionVO vo in role_permissions_admin)
            {
                Console.WriteLine(role_permissionDao.insert <Role_PermissionVO>(vo));
            }
            #endregion
            #endregion

            #region 添加权限(组织者角色)
            Console.WriteLine("建立权限(组织者角色)");

            List <PermissionVO> permissions_org = new List <PermissionVO>();

            #region 组织者角色的权限列表
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "进入组织者首页",
                permissionDescription = "Account-Organizor"
            });
            #region 会议
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "展示会议",
                permissionDescription = "Meeting-Show_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加会议",
                permissionDescription = "Meeting-Add_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "编辑会议",
                permissionDescription = "Meeting-Edit_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "删除会议",
                permissionDescription = "Meeting-Delete_organizor"
            });
            #endregion
            ///=================================================
            #region 参会人员
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "参会人员首页",
                permissionDescription = "Delegate-Index_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "编辑参会人员",
                permissionDescription = "Delegate-Edit_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加参会人员",
                permissionDescription = "Delegate-Add_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "删除参会人员",
                permissionDescription = "Delegate-Delete_organizor"
            });
            #endregion
            //===========================================
            #region 议程
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "议程首页",
                permissionDescription = "Agenda-Index_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加议程",
                permissionDescription = "Agenda-Add_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "编辑议程",
                permissionDescription = "Agenda-Edit_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "删除议程",
                permissionDescription = "Agenda-Delete_organizor"
            });
            #endregion
            //===========================================
            #region 附件
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "附件首页",
                permissionDescription = "Document-Index_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "上传附件",
                permissionDescription = "Document-Add_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "转换附件",
                permissionDescription = "Document-StartConvert"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "下载附件",
                permissionDescription = "Document-Download"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "删除附件",
                permissionDescription = "Document-Delete_organizor"
            });
            #endregion
            //================================================
            #region 表决
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "表决首页",
                permissionDescription = "Vote-Index_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "添加表决",
                permissionDescription = "Vote-Add_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "编辑表决",
                permissionDescription = "Vote-Edit_organizor"
            });
            //
            permissions_org.Add(
                new PermissionVO
            {
                permissionID          = PermissionDAO.getID(),
                permissionName        = "删除表决",
                permissionDescription = "Vote-Delete_organizor"
            });
            #endregion
            foreach (PermissionVO vo in permissions_org)
            {
                Console.WriteLine(permissionDao.insert <PermissionVO>(vo));
            }

            #endregion
            //==============================================

            #region 组织者角色与权限关联
            Console.WriteLine("建立组织者角色与权限关联");

            //组织者角色、权限
            List <Role_PermissionVO> role_permissions_org = new System.Collections.Generic.List <Role_PermissionVO>();
            foreach (PermissionVO permissionVo in permissions_org)
            {
                role_permissions_org.Add(
                    new Role_PermissionVO
                {
                    role_permissionID = Role_PermissionDAO.getID(),
                    roleID            = roleIDs[1],
                    permissionID      = permissionVo.permissionID
                });
            }

            foreach (Role_PermissionVO vo in role_permissions_org)
            {
                Console.WriteLine(role_permissionDao.insert <Role_PermissionVO>(vo));
            }
            #endregion
            #endregion

            #region 超级管理员用户与超级管理员角色关联
            Console.WriteLine("建立超级管理员用户与超级管理员角色关联");

            int           person_roleID = Person_RoleDAO.getID();
            Person_RoleVO adminPR       = new Person_RoleVO
            {
                person_roleID = person_roleID,
                personID      = adminID,
                roleID        = roleIDs[0]
            };

            Console.WriteLine(person_roleDao.insert <Person_RoleVO>(adminPR));
            #endregion
            #endregion

            #endregion
        }