Ejemplo n.º 1
0
        public MainPage()
        {
            this.InitializeComponent();
            sched1.Settings.FirstVisibleTime = System.TimeSpan.FromHours(8);

            // add test appointments
            C1.C1Schedule.Appointment app = sched1.DataStorage.AppointmentStorage.Appointments.Add();
            app.Start    = DateTime.Today.AddHours(14);
            app.Duration = TimeSpan.FromMinutes(60);
            app.Label    = sched1.DataStorage.LabelStorage.Labels[3];
            app.Subject  = "Test Appointment";

            app             = sched1.DataStorage.AppointmentStorage.Appointments.Add();
            app.Start       = DateTime.Today.AddDays(2);
            app.AllDayEvent = true;
            app.Label       = sched1.DataStorage.LabelStorage.Labels[9];
            app.BusyStatus  = sched1.DataStorage.StatusStorage.Statuses[C1.C1Schedule.StatusTypeEnum.Free];
            app.Subject     = "Holiday";
        }
Ejemplo n.º 2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            #region 界面
            // 在界面显示用户信息
            UserBLL       userInfo = new UserBLL();
            EmployeeModel emInfo   = userInfo.GetEmInfo(this.employee.EmId);
            string        strHello = "欢迎," + emInfo.EmName[0] + (emInfo.EmSex == "男" ? "先生" : "小姐");
            this.lbHello.Text = strHello;

            // 根据登陆用户的权限显示相应的空间
            if (employee.EmPermission == "OU")//普通用户
            {
                this.tsmiCheckTask.Visible     = false;
                this.tsmiApply.Visible         = true;
                this.tsmiManage.Visible        = false;
                this.tsmiVer.Visible           = false;
                this.tsmiUpdateMateria.Visible = true;
                //this.c1scNextCon.Visible = true;

                UserBLL sort = new UserBLL();
                list = sort.GetUserConference(employee);
                //  ConferenceModel con = new ConferenceModel();

                try
                {
                    ConferenceModel con = GetConSort(list);
                    string          bdr = sort.GetBoardroomInfo(con.ConPlace.ToString())[0].BdrName;
                    if (con.ConStatus == '1')
                    {
                        this.lbNextCon.Text =
                            String.Format("会议名称:{0};\n会议地点:{1};\n会议开始时间:{2};\n会议结束时间:{3};\n",
                                          con.ConName, bdr, con.ConStartTime.ToShortTimeString(),
                                          con.ConEndTime.ToShortTimeString());
                    }
                    else
                    {
                        this.lbNextCon.Text = "接下来并没有会议!";
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                    this.lbNextCon.Text = ex.Message;
                }
            }
            else if (employee.EmPermission == "TA")//议题审核人
            {
                this.tsmiCheckTask.Visible     = false;
                this.tsmiApply.Visible         = true;
                this.tsmiManage.Visible        = true;
                this.tsmiConManage.Visible     = false;
                this.tsmiTopicManage.Visible   = true;
                this.tsmiBdrRoomManage.Visible = false;
                this.tsmiResouceManage.Visible = false;
                this.tsmiVer.Visible           = false;
                this.tsmiConVer.Visible        = false;
                this.tsmiUpdateMateria.Visible = true;
                //this.c1scNextCon.Visible = true;
                UserBLL sort = new UserBLL();
                list = sort.GetUserConference(employee);
                try
                {
                    ConferenceModel con = GetConSort(list);
                    string          bdr = sort.GetBoardroomInfo(con.ConPlace.ToString())[0].BdrName;
                    if (con.ConStatus == '1')
                    {
                        this.lbNextCon.Text =
                            String.Format("会议名称:{0};\n会议地点:{1};\n会议开始时间:{2};\n会议结束时间:{3};\n",
                                          con.ConName, bdr, con.ConStartTime.ToShortTimeString(),
                                          con.ConEndTime.ToShortTimeString());
                    }
                    else
                    {
                        this.lbNextCon.Text = "接下来并没有会议!";
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                    this.lbNextCon.Text = ex.Message;
                }
            }
            else if (employee.EmPermission == "CA")//会议管理员
            {
                this.lbHello.Text = "欢迎,管理员";

                this.tsmiTopicManage.Visible   = false;
                this.tsmiCheckTask.Visible     = false;
                this.tsmiManage.Visible        = true;
                this.tsmiConManage.Visible     = true;
                this.tsmiBdrRoomManage.Visible = true;
                this.tsmiResouceManage.Visible = false;
                this.tsmiApply.Visible         = true;
                this.tsmiVer.Visible           = true;
                this.tsmiConVer.Visible        = true;
                this.tsmiUpdateMateria.Visible = true;
                //this.c1scNextCon.Visible = true;
                UserBLL sort = new UserBLL();
                list = sort.GetUserConference(employee);
                try
                {
                    ConferenceModel con = GetConSort(list);
                    string          bdr = sort.GetBoardroomInfo(con.ConPlace.ToString())[0].BdrName;
                    if (con.ConStatus == '1')
                    {
                        this.lbNextCon.Text =
                            String.Format("会议名称:{0};\n会议地点:{1};\n会议开始时间:{2};\n会议结束时间:{3};\n",
                                          con.ConName, bdr, con.ConStartTime.ToShortTimeString(),
                                          con.ConEndTime.ToShortTimeString());
                    }
                    else
                    {
                        this.lbNextCon.Text = "接下来并没有会议!";
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                    this.lbNextCon.Text = ex.Message;
                }
            }
            else if (employee.EmPermission == "CE")//会务执行人
            {
                //this.tsmiManage.Visible = true;
                this.tsmiManage.Visible        = true;
                this.tsmiResouceManage.Visible = true;
                this.tsmiTopicManage.Visible   = false;
                this.tsmiConManage.Visible     = false;
                this.tsmiBdrRoomManage.Visible = false;
                this.tsmiCheckTask.Visible     = true;

                this.tsmiApply.Visible         = true;
                this.tsmiVer.Visible           = false;
                this.tsmiUpdateMateria.Visible = true;
                this.label1.Visible            = false;
                //this.c1scNextCon.Visible = true;
            }
            #endregion

            List <ConferenceModel> ConferenceList = new List <ConferenceModel>();
            UserBLL user = new UserBLL();
            ConferenceList = user.GetConferenceInfo("");
            try
            {
                int n = 0;
                foreach (ConferenceModel con in ConferenceList)
                {
                    if (con.ConStatus == '1')
                    {
                        C1.C1Schedule.Appointment app = new C1.C1Schedule.Appointment();
                        app.Subject = con.ConName;
                        string bdrname = user.GetBoardroomInfo(con.ConPlace.ToString())[0].BdrName;
                        app.Location = bdrname;
                        app.Start    = con.ConStartTime;
                        app.End      = con.ConEndTime;
                        this.c1sView.DataStorage.AppointmentStorage.Appointments.Add(app);
                        BoardroomModel bdr = new BoardroomModel();
                        bdr.BdrId   = con.ConPlace;
                        bdr.BdrName = bdrname;
                        try
                        {
                            this.c1sView.DataStorage.OwnerStorage.Mappings.TextMapping.MappingName  = "BdrName";
                            this.c1sView.DataStorage.OwnerStorage.Mappings.IndexMapping.MappingName = "BdrId";
                            bool iscontains = false;
                            foreach (object m in this.c1sView.DataStorage.OwnerStorage.Contacts)
                            {
                                if (m.ToString() == bdr.BdrName)
                                {
                                    iscontains = true;
                                }
                            }
                            if (iscontains == false)
                            {
                                this.c1sView.DataStorage.OwnerStorage.Add(bdr);
                                app.Owner = this.c1sView.DataStorage.OwnerStorage.Contacts[n];
                                n++;
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }