Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //日程编写
            StaffSchedule staffSchedule = new StaffSchedule();

            staffSchedule.IfRemind = checkBox1.Checked ? (int)StaffSchedule.IfRemindEnum.Renmind : (int)StaffSchedule.IfRemindEnum.NotRemind;
            //会议时间
            staffSchedule.ScheduleTime = this.dateTimePicker2.Value.Ticks;        //scheduleDate.Date.Ticks + dateTimePicker1.Value.TimeOfDay.Ticks;
            //提醒时间
            staffSchedule.RemindTime          = this.dateTimePicker1.Value.Ticks; //scheduleDate.Date.Ticks + dateTimePicker2.Value.TimeOfDay.Ticks;
            staffSchedule.Staff               = this.user;
            staffSchedule.StaffScheduleStaffs = sharedUser;
            staffSchedule.Subject             = comboBox1.Text.Trim();
            staffSchedule.TimeStamp           = DateTime.Now.Ticks;
            staffSchedule.State               = (int)IEntity.stateEnum.Normal;
            staffSchedule.Content             = textBox1.Text.Trim();
            staffSchedule.ArrangeMan          = user;
            try
            {
                object be = baseService.saveEntity(staffSchedule);

                if (staffSchedule.StaffScheduleStaffs != null && staffSchedule.StaffScheduleStaffs.Count > 0)
                {
                    try
                    {
                        KjqbService.Service1Client ser = new KjqbService.Service1Client();
                        foreach (WkTUser u in sharedUser)
                        {
                            KjqbService.ScheduleInService ll = new KjqbService.ScheduleInService();
                            ll.ScheduleId  = int.Parse(be.ToString());
                            ll.WriteUserId = this.user.Id;
                            ll.ShareUserId = u.Id;
                            ll.TimeStamp   = DateTime.Now.Ticks;
                            ser.SaveInScheduleListInService(ll);
                        }
                    }
                    catch { }
                }
            }
            catch
            {
                MessageBox.Show("保存失败!");
                return;
            }
            MessageBox.Show("保存成功!");
            this.Invoke(parentChangeDelegate, null);
            parentChangeDelegate();
            this.Close();
        }
Exemplo n.º 2
0
        void l1_Click(object sender, EventArgs e)
        {
            LinkLabel l1 = (LinkLabel)sender;

            if (l1.Tag.GetType() == typeof(KjqbService.LogInService))
            {
                KjqbService.LogInService ll = (KjqbService.LogInService)l1.Tag;
                StaffLog ss = new StaffLog();
                ss = (StaffLog)baseService.loadEntity(ss, ll.LogId);
                if (ss.State == 0)
                {
                    writeLog wl = new writeLog();
                    wl.User              = ss.Staff;
                    wl.LogDate           = new DateTime(ss.WriteTime);
                    wl.IsComment         = true;
                    wl.CommentPersonName = this.User.KuName;
                    wl.ShowDialog();
                }
                else
                {
                    MessageBox.Show("该篇日志作者已经删除");
                }
            }
            else if (l1.Tag.GetType() == typeof(KjqbService.CommentInService))
            {
                KjqbService.CommentInService ll = (KjqbService.CommentInService)l1.Tag;
                StaffLog ss = new StaffLog();
                ss = (StaffLog)baseService.loadEntity(ss, ll.LogId);
                if (ss.State == 0)
                {
                    writeLog wl = new writeLog();
                    wl.User              = ss.Staff;
                    wl.LogDate           = new DateTime(ss.WriteTime);
                    wl.IsComment         = true;
                    wl.CommentPersonName = this.User.KuName;
                    wl.ShowDialog();
                }
                else
                {
                    MessageBox.Show("该篇日志作者已经删除");
                }
            }
            else if (l1.Tag.GetType() == typeof(KjqbService.ScheduleInService))
            {
                KjqbService.ScheduleInService ll = (KjqbService.ScheduleInService)l1.Tag;
                StaffSchedule ss = new StaffSchedule();
                ss = (StaffSchedule)baseService.loadEntity(ss, ll.ScheduleId);
                DateTime dt = new DateTime(ss.ScheduleTime);
                MessageBox.Show(dt.ToString("yyyy-MM-dd HH:mm:ss") + " :" + ss.Content);
            }
            else if (l1.Tag.GetType() == typeof(KjqbService.LeaveInService))
            {
                //KjqbService.LeaveInService ll = (KjqbService.LeaveInService)l1.Tag;
                //LeaveManage tt = new LeaveManage();
                //tt = (LeaveManage)baseService.loadEntity(tt, ll.LeaveId);

                if (leaveWindow == null || leaveWindow.IsDisposed)
                {
                    leaveWindow          = new Leave();
                    leaveWindow.Leaveman = this.user;
                    leaveWindow.Role     = role;
                }
                if (!leaveWindow.Created)
                {
                    leaveWindow.Show();
                }
                else
                {
                    leaveWindow.WindowState = FormWindowState.Normal;
                    leaveWindow.Focus();
                }
            }
            else if (l1.Tag.GetType() == typeof(KjqbService.BusinessService))
            {
                if (businessManagement == null || businessManagement.IsDisposed)
                {
                    businessManagement = new BusinessManagement();
                }
                if (!businessManagement.Created)
                {
                    businessManagement.User = this.User;
                    businessManagement.Role = this.Role;
                    businessManagement.Show();
                }
                else
                {
                    businessManagement.WindowState = FormWindowState.Normal;
                    businessManagement.Focus();
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 员工安排日程确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            this.button3.Cursor = Cursors.WaitCursor;
            TreeNode t = treeView1.Nodes[0];

            foreach (TreeNode t1 in t.Nodes)
            {
                foreach (TreeNode t2 in t1.Nodes)
                {
                    if (t2.Checked == true)
                    {
                        WkTUser u = (WkTUser)t2.Tag;


                        //日程编写
                        StaffSchedule staffSchedule = new StaffSchedule();
                        staffSchedule.IfRemind = checkBox2.Checked ? (int)StaffSchedule.IfRemindEnum.Renmind : (int)StaffSchedule.IfRemindEnum.NotRemind;
                        //会议时间
                        staffSchedule.ScheduleTime = dateTimePicker3.Value.Ticks; //scheduleDate.Date.Ticks + dateTimePicker1.Value.TimeOfDay.Ticks;
                        //提醒时间
                        staffSchedule.RemindTime = dateTimePicker4.Value.Ticks;   //scheduleDate.Date.Ticks + dateTimePicker2.Value.TimeOfDay.Ticks;
                        staffSchedule.Staff      = u;
                        //staffSchedule.StaffScheduleStaffs = sharedUser;
                        staffSchedule.Subject    = textBox3.Text.Trim();
                        staffSchedule.TimeStamp  = DateTime.Now.Ticks;
                        staffSchedule.State      = (int)IEntity.stateEnum.Normal;
                        staffSchedule.Content    = textBox2.Text.Trim();
                        staffSchedule.ArrangeMan = user;
                        try
                        {
                            object be = baseService.saveEntity(staffSchedule);

                            if (staffSchedule.ArrangeMan != null)
                            {
                                try
                                {
                                    KjqbService.Service1Client ser = new KjqbService.Service1Client();

                                    KjqbService.ScheduleInService ll = new KjqbService.ScheduleInService();
                                    ll.ScheduleId  = int.Parse(be.ToString());
                                    ll.WriteUserId = staffSchedule.ArrangeMan.Id;
                                    ll.ShareUserId = staffSchedule.Staff.Id;
                                    ll.TimeStamp   = DateTime.Now.Ticks;
                                    ser.SaveInScheduleListInService(ll);
                                }
                                catch { }
                            }
                        }
                        catch
                        {
                            MessageBox.Show("保存失败!");
                            return;
                        }
                    }
                }
            }

            this.button3.Cursor = Cursors.Hand;

            MessageBox.Show("保存成功!");
        }