示例#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();
        }
示例#2
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("保存成功!");
        }