Пример #1
0
        /// <summary>
        ///请假审批-未通过按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button14_Click(object sender, EventArgs e)
        {
            if (listView4.CheckedItems.Count > 0)
            {
                while (listView4.CheckedItems.Count > 0)
                {
                    if (leaveobject == null)
                    {
                        leaveobject = new LeaveManage();
                    }

                    ListViewItem item = listView4.CheckedItems[0];
                    leaveobject = (LeaveManage)item.Tag;
                    if (role.KrOrder == 0)
                    {
                        //院长审批未通过
                        leaveobject.LeaveStage  = "3";
                        leaveobject.LeaveResult = "0";
                    }
                    else if (role.KrOrder == 1)
                    {
                        //副院长审批未通过

                        leaveobject.LeaveStage  = "2";
                        leaveobject.LeaveResult = "0";
                    }
                    else if (role.KrOrder == 2)
                    {
                        leaveobject.LeaveStage  = "1";
                        leaveobject.LeaveResult = "0";
                    }
                    try
                    {
                        baseService.SaveOrUpdateEntity(leaveobject);
                        KjqbService.Service1Client ser   = new KjqbService.Service1Client();
                        KjqbService.LeaveInService levin = new KjqbService.LeaveInService();
                        levin.LeaveId                = leaveobject.Id;
                        levin.UserId                 = leaveobject.Ku_Id.Id;
                        levin.SendUserId             = Leaveman.Id;
                        levin.ExamineOrExamineresult = 2;
                        ser.SaveInLeaveInfoInService(levin);
                    }
                    catch
                    {
                        MessageBox.Show("审批失败!");
                        return;
                    }

                    item.Checked = false;
                    //item.SubItems.Clear();
                    listView4.Items.Remove(item);
                }

                MessageBox.Show("审批成功!");
            }
            else
            {
                MessageBox.Show("您尚未选择条目!");
            }
        }
Пример #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            Business b = selectedBusiness;

            if (b != null)
            {
                foreach (BusinessEmployee be in b.BusinessEmployee)
                {
                    be.PassExam = (int)BusinessEmployee.ExamState.npass;
                }
                b.PassExam = (int)Business.ExamState.npass;
                baseService.SaveOrUpdateEntity(b);

                #region  务器通信
                try
                {
                    KjqbService.Service1Client ser = new KjqbService.Service1Client();

                    KjqbService.BusinessService bs = new KjqbService.BusinessService();
                    bs.BusinessID = b.Id;
                    bs.ReceiveID  = b.Ku_Id.Id;
                    bs.Type       = 2;
                    bs.TimeStamp  = DateTime.Now.Ticks;
                    ser.SaveInBusinessListInService(bs);
                }
                catch { }
                #endregion
            }
            initTabPage3();
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.listView1.CheckedItems.Count != 0 && this.listView1.CheckedItems != null)
            {
                BusinessEmployee be;
                foreach (ListViewItem item in this.listView1.CheckedItems)
                {
                    be = (BusinessEmployee)item.Tag;
                    string query1 = "update LOG_T_BUSINESSEMPLOYEE set PASSEXAM=" + (int)BusinessEmployee.ExamState.redo + " where Id=" + be.Id;
                    baseService.ExecuteSQL(query1);
                }
                string query2 = "update LOG_T_BUSINESS set PASSEXAM=" + (int)Business.ExamState.redo + " where Id=" + business.Id;
                baseService.ExecuteSQL(query2);

                #region  务器通信
                KjqbService.Service1Client ser = new KjqbService.Service1Client();

                KjqbService.BusinessService bs = new KjqbService.BusinessService();
                bs.BusinessID = business.Id;
                bs.ReceiveID  = business.Ku_Id.Id;
                bs.Type       = 1;
                bs.TimeStamp  = DateTime.Now.Ticks;
                ser.SaveInBusinessListInService(bs);

                #endregion
                this.DialogResult = DialogResult.OK;
                MessageBox.Show("退回成功");
            }
            else
            {
                MessageBox.Show("没有选择退回员工");
            }
        }
Пример #4
0
        private void button8_Click(object sender, EventArgs e)//撤销出差
        {
            Business b = selectedBusiness;

            b.PassExam = (int)Business.ExamState.npass;
            //IList empList = getEmpByBus(b);
            foreach (BusinessEmployee be in b.BusinessEmployee)
            {
                be.PassExam = (int)BusinessEmployee.ExamState.npass;
            }
            b.WaitingNum = -1;
            baseService.SaveOrUpdateEntity(b);

            #region  务器通信
            try
            {
                KjqbService.Service1Client ser = new KjqbService.Service1Client();

                KjqbService.BusinessService bs = new KjqbService.BusinessService();
                bs.BusinessID = b.Id;
                bs.ReceiveID  = b.Ku_Id.Id;
                bs.Type       = 2;
                bs.TimeStamp  = DateTime.Now.Ticks;
                ser.SaveInBusinessListInService(bs);
            }
            catch { }
            #endregion
            initTabPage4();
        }
Пример #5
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();
        }
Пример #6
0
        /// <summary>
        /// 审核不通过
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            DateTime tt  = new DateTime(this.dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, 1);
            string   sql = "select u from TimeArrangeForManager u where " +
                           "  u.TimeMonth = " + tt.Ticks +
                           " and u.State = " + (int)IEntity.stateEnum.Normal +
                           " and u.IsDone = 1 ";

            IList timemananer = baseService.loadEntityList(sql);

            if (timemananer != null && timemananer.Count > 0)
            {
                TimeArrangeForManager timeman = (TimeArrangeForManager)timemananer[0];
                if (timeman.ExamineState == 0)
                {
                    if (MessageBox.Show("确定要不通过吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        timeman.ExamineState = 2;
                        baseService.SaveOrUpdateEntity(timeman);

                        try
                        {
                            KjqbService.Service1Client ser = new KjqbService.Service1Client();
                            KjqbService.TimeArrangeForManagerInService tfmservice = new KjqbService.TimeArrangeForManagerInService();
                            tfmservice.ExamineOrExamineresult = 2;
                            tfmservice.SendUserId             = this.user.Id;
                            tfmservice.UserId = timeman.UserId.Id;
                            tfmservice.TimeArrangeForManagerId = timeman.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfmservice);
                        }
                        catch { }



                        this.CheckState.Text = "审核状态:审核不通过";
                    }
                }
                else
                {
                    MessageBox.Show("您已经审核过了");
                }
            }
            else
            {
                MessageBox.Show("值班尚未安排!");
            }
        }
Пример #7
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (listView2.Items.Count == 0 && listView2.Items == null)
            {
                MessageBox.Show("未作人员修改");
            }
            else
            {
                WkTUser user = new WkTUser();
                foreach (ListViewItem item in listView2.Items)
                {
                    user = (WkTUser)item.Tag;
                    BusinessEmployee be = new BusinessEmployee();
                    be.EmployeeId = user;
                    be.BusinessId = business;
                    be.PassExam   = (int)BusinessEmployee.ExamState.pass;
                    business.BusinessEmployee.Add(be);
                }

                foreach (ListViewItem item in listView3.Items)
                {
                    BusinessEmployee be = (BusinessEmployee)item.Tag;;
                    if (be.PassExam == (int)BusinessEmployee.ExamState.redo)
                    {
                        business.BusinessEmployee.Remove(be);
                    }
                }
                business.PassExam = (int)Business.ExamState.pass;
                baseService.SaveOrUpdateEntity(business);

                #region  务器通信
                KjqbService.Service1Client ser = new KjqbService.Service1Client();

                KjqbService.BusinessService bs = new KjqbService.BusinessService();
                bs.BusinessID = business.Id;
                bs.ReceiveID  = business.Boss.Id;
                bs.Type       = 0;
                bs.TimeStamp  = DateTime.Now.Ticks;
                ser.SaveInBusinessListInService(bs);

                #endregion

                MessageBox.Show("成功提交");
                this.DialogResult = DialogResult.OK;
            }
        }
Пример #8
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            if (this.comment_textBox.Text.Trim().Length > 0)
            {
                StaffLog staffLog = (StaffLog)htmlEditor1.Tag;
                Comments comment  = new Comments();
                comment.Content           = comment_textBox.Text.Trim();
                comment.CommentPersonName = this.CommentPersonName;
                comment.State             = (int)IEntity.stateEnum.Normal;
                comment.TimeStamp         = DateTime.Now.Ticks;
                staffLog.Comments.Add(comment);
                baseService.SaveOrUpdateEntity(staffLog);
                initCommentList(staffLog.Comments);
                this.comment_textBox.Text = "";


                #region 向服务中发送数据
                try
                {
                    KjqbService.Service1Client ser = new KjqbService.Service1Client();
                    if (comment.CommentPersonName != "")
                    {
                        KjqbService.CommentInService ll = new KjqbService.CommentInService();
                        ll.LogId           = staffLog.Id;
                        ll.CommentUserName = this.CommentPersonName;
                        ll.LogUserId       = staffLog.Staff.Id;
                        ll.TimeStamp       = DateTime.Now.Ticks;
                        ser.SaveInCommentListInService(ll);
                    }
                }
                catch
                {
                }
                #endregion

                this.labelMessageBox1.MessageageShow("评论成功!");
            }
            else
            {
                this.labelMessageBox1.MessageageShow("您的评论内容为空……");
            }
        }
Пример #9
0
        private void button5_Click(object sender, EventArgs e)// 审核通过
        {
            if (EmpInBusDept != null && EmpInBusDept.Count != 0)
            {
                foreach (BusinessEmployee be in EmpInBusDept)
                {
                    string query1 = "update LOG_T_BUSINESSEMPLOYEE set PASSEXAM=" + (int)BusinessEmployee.ExamState.pass + " where Id=" + be.Id;//修改员工审核状态为通过
                    baseService.ExecuteSQL(query1);
                }

                int    waitNum = selectedBusiness.WaitingNum - EmpInBusDept.Count;
                string query2  = "update LOG_T_BUSINESS set WAITINGNUM=" + waitNum + " where Id=" + selectedBusiness.Id;//修改待审核人数
                baseService.ExecuteSQL(query2);
                if (waitNum == 0)
                {
                    string query3 = "update LOG_T_BUSINESS set PASSEXAM=" + (int)Business.ExamState.pass + " where Id=" + selectedBusiness.Id;//修改出差审核状态为通过
                    baseService.ExecuteSQL(query3);

                    #region  务器通信
                    try
                    {
                        KjqbService.Service1Client ser = new KjqbService.Service1Client();

                        KjqbService.BusinessService bs = new KjqbService.BusinessService();
                        bs.BusinessID = selectedBusiness.Id;
                        bs.ReceiveID  = selectedBusiness.Boss.Id;
                        bs.Type       = 0;
                        bs.TimeStamp  = DateTime.Now.Ticks;
                        ser.SaveInBusinessListInService(bs);
                    }
                    catch { }
                    #endregion
                }
                MessageBox.Show("审核通过!");
                initTabPage4();
            }
        }
Пример #10
0
        /// <summary>
        /// 点击排班的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void panban_Click(object sender, EventArgs e)
        {
            ArrangeDuty ad = new ArrangeDuty();

            ad.ShowDialog();
            if (ad.DialogResult == DialogResult.OK)
            {
                if (TfM != null)
                {
                    OnDutyTable ot;
                    DateTime    dt  = new DateTime(((DateTime)((((LinkLabel)sender).Parent).Tag)).Ticks);
                    string      sql = "select u from OnDutyTable u where u.Time = " + dt.Ticks +
                                      " and u.State = " + (int)IEntity.stateEnum.Normal;
                    IList i = baseService.loadEntityList(sql);
                    if (i != null && i.Count > 0)
                    {
                        ot = (OnDutyTable)i[0];
                    }
                    else
                    {
                        ot = new OnDutyTable();
                    }
                    ot.TFMId     = TfM;
                    ot.Time      = dt.Ticks;
                    ot.DaiBanID  = ad.Duser;
                    ot.BaiBanID  = ad.Buser;
                    ot.YeBanID   = ad.Yuser;
                    ot.State     = (int)IEntity.stateEnum.Normal;
                    ot.TimeStamp = DateTime.Now.Ticks;
                    TfM.IsDone   = 1;

                    TfM.ExamineState     = 0;
                    this.CheckState.Text = "审核状态:未审核";

                    baseService.SaveOrUpdateEntity(TfM);

                    #region 向服务器发送消息

                    try
                    {
                        KjqbService.Service1Client ser = new KjqbService.Service1Client();
                        string ssql1 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and (u.Kdid.KdName like '%" + affairsDept + "%') ";
                        string ssql2 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and (u.Kdid.KdName like '%" + netDept + "%') ";
                        if (TfM.DutyType == 0)
                        {
                            IList users = baseService.loadEntityList(ssql1);
                            KjqbService.TimeArrangeForManagerInService tfminservice = new KjqbService.TimeArrangeForManagerInService();
                            tfminservice.ExamineOrExamineresult = 0;
                            tfminservice.UserId     = ((WkTUser)users[0]).Id;
                            tfminservice.SendUserId = this.user.Id;
                            tfminservice.TimeArrangeForManagerId = TfM.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfminservice);
                        }
                        else if (TfM.DutyType == 1)
                        {
                            IList users = baseService.loadEntityList(ssql2);
                            KjqbService.TimeArrangeForManagerInService tfminservice = new KjqbService.TimeArrangeForManagerInService();
                            tfminservice.ExamineOrExamineresult = 0;
                            tfminservice.UserId     = ((WkTUser)users[0]).Id;
                            tfminservice.SendUserId = this.user.Id;
                            tfminservice.TimeArrangeForManagerId = TfM.Id;
                            ser.SaveInTimeArrangeForManagerInService(tfminservice);
                        }
                    }
                    catch { }
                    #endregion


                    #region 行政班
                    if (TfM.DutyType == 0) //行政班
                    {
                        PrintDutyPersonName((Panel)((LinkLabel)sender).Parent, ad.Duser, ad.Buser, ad.Yuser, 0);
                        ot.Type = 0;
                    }
                    #endregion

                    #region 网络班
                    else
                    {
                        PrintDutyPersonName((Panel)((LinkLabel)sender).Parent, ad.Duser, ad.Buser, ad.Yuser, 1);
                        ot.Type = 1;
                    }

                    baseService.SaveOrUpdateEntity(ot);

                    #endregion
                }
            }
        }
Пример #11
0
        /// <summary>
        ///请假审批-通过按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button13_Click(object sender, EventArgs e)
        {
            if (listView4.CheckedItems.Count > 0)
            {
                while (listView4.CheckedItems.Count > 0)
                {
                    if (leaveobject == null)
                    {
                        leaveobject = new LeaveManage();
                    }

                    ListViewItem item = listView4.CheckedItems[0];
                    leaveobject = (LeaveManage)item.Tag;
                    if (role.KrOrder == 0)
                    {
                        //院长审批阶段
                        leaveobject.LeaveStage  = "3";
                        leaveobject.LeaveResult = "2";
                    }
                    else if (role.KrOrder == 1)
                    {
                        //副院长审批
                        if (leaveobject.LeaveType == "病假" || leaveobject.LeaveType == "事假")
                        {
                            //判断请假天数,如果小于10的话,可以直接审批通过,无需院长继续审批
                            if (((leaveobject.EndTime - leaveobject.StartTime) / 864000000000 + 1) <= 10)
                            {
                                leaveobject.LeaveStage  = "2";
                                leaveobject.LeaveResult = "2";//审批完全通过
                            }
                        }
                        else
                        {
                            leaveobject.LeaveStage  = "2";
                            leaveobject.LeaveResult = "1";
                        }
                    }
                    else if (role.KrOrder == 2)
                    {
                        //负责人审批
                        if (leaveobject.LeaveType == "病假" || leaveobject.LeaveType == "事假")
                        {
                            //判断请假天数,如果小于3的话,可以直接审批通过,无需副院长继续审批
                            if (((leaveobject.EndTime - leaveobject.StartTime) / 864000000000 + 1) <= 3)
                            {
                                leaveobject.LeaveStage  = "1";
                                leaveobject.LeaveResult = "2";//审批完全通过
                            }
                        }
                        else
                        {
                            leaveobject.LeaveStage  = "1";
                            leaveobject.LeaveResult = "1";
                        }
                    }
                    try
                    {
                        baseService.SaveOrUpdateEntity(leaveobject);
                        KjqbService.Service1Client ser   = new KjqbService.Service1Client();
                        KjqbService.LeaveInService levin = new KjqbService.LeaveInService();
                        levin.LeaveId                = leaveobject.Id;
                        levin.UserId                 = leaveobject.Ku_Id.Id;
                        levin.SendUserId             = Leaveman.Id;
                        levin.ExamineOrExamineresult = 1;
                        ser.SaveInLeaveInfoInService(levin);
                    }
                    catch
                    {
                        MessageBox.Show("审批失败!");
                        return;
                    }

                    item.Checked = false;
                    listView4.Items.Remove(item);
                }
                MessageBox.Show("审批成功!");
            }
            else
            {
                MessageBox.Show("您尚未选择审批条目!");
            }
        }
Пример #12
0
        /// <summary>
        /// 提交请假信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            //提交请假信息
            LeaveManage lev = new LeaveManage();

            KjqbService.LeaveInService levinser = new KjqbService.LeaveInService();
            KjqbService.Service1Client ser      = new KjqbService.Service1Client();
            levinser.SendUserId             = leaveman.Id;
            levinser.ExamineOrExamineresult = 0;

            //对请假信息的填写状况进行判断
            if (dateTimePicker1.Value.Date.Ticks > dateTimePicker2.Value.Date.Ticks)
            {
                MessageBox.Show("请假开始时间必须早于或等于结束时间!");
                return;
            }
            if (comboBox2.Text == null || comboBox2.Text == "")
            {
                MessageBox.Show("请选择请假类型!");
                return;
            }

            if (textBox7.Text == null || textBox7.Text == "")
            {
                MessageBox.Show("请填写请假原因!");
                return;
            }


            lev.StartTime = dateTimePicker1.Value.Date.Ticks;
            lev.EndTime   = dateTimePicker2.Value.Date.Ticks;

            string query   = "from LeaveManage leave where leave.Ku_Id=" + this.Leaveman.Id + " and ((leave.StartTime>=" + lev.StartTime + " and leave.StartTime<=" + lev.EndTime + ") or (leave.EndTime>=" + lev.StartTime + " and leave.EndTime<=" + lev.EndTime + ")) and leave.State=" + (int)LeaveManage.stateEnum.Normal;
            IList  levList = baseService.loadEntityList(query);

            if (levList != null && levList.Count != 0)
            {
                MessageBox.Show("此时间段已有请假记录");
                return;
            }


            lev.LeaveType   = comboBox2.Text.Trim(); //请假类型
            lev.LeaveReason = textBox7.Text.Trim();  //请假原因
            // role.KrOrder含义,0:院长,1:副院长,2:负责人,3:员工
            if (role.KrOrder == 3)                   //员工提交请假信息
            {
                lev.LeaveResult = "3";               //审核结果,3表示未审核的
                lev.LeaveStage  = "0";               //审批阶段,属于未审批
                string ssql1 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 2  and u.Kdid.Id = " + leaveman.Kdid.Id;
                IList  list  = baseService.loadEntityList(ssql1);
                if (list != null && list.Count > 0)
                {
                    WkTUser theuser = (WkTUser)list[0];
                    levinser.UserId = theuser.Id;
                }
                else
                {
                    levinser.UserId = 0;
                }
            }
            else if (role.KrOrder == 2)//负责人提交请假
            {
                if (comboBox2.Text.Trim() == "病假" || comboBox2.Text.Trim() == "事假")
                {
                    lev.LeaveResult = "1";
                    lev.LeaveStage  = "1";
                    Wktuser_M_Dept wmd = new Wktuser_M_Dept();
                    //wmd.DeptId.Id
                    string ssql1 = "select u from Wktuser_M_Dept u where u.DeptId.Id = " + leaveman.Kdid.Id;
                    IList  ll    = baseService.loadEntityList(ssql1);
                    if (ll != null && ll.Count > 0)
                    {
                        wmd             = (Wktuser_M_Dept)ll[0];
                        levinser.UserId = wmd.WktuserId.Id;
                    }
                    else
                    {
                        levinser.UserId = 0;
                    }
                }
                else
                {   //婚假、产假、年休假、探亲假;负责人请假后,由院长直接审批就可以
                    lev.LeaveResult = "1";
                    lev.LeaveStage  = "2";

                    string ssql1 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 0";
                    IList  list  = baseService.loadEntityList(ssql1);
                    if (list != null && list.Count > 0)
                    {
                        WkTUser theuser = (WkTUser)list[0];
                        levinser.UserId = theuser.Id;
                    }
                    else
                    {
                        levinser.UserId = 0;
                    }
                }
            }
            else if (role.KrOrder == 1 || role.KrOrder == 0)//副院长和院长提交请假,都由院长审批
            {
                //默认负责人审批通过,待副院长审批
                lev.LeaveResult = "1";
                lev.LeaveStage  = "2";
                string ssql1 = "select u from WkTUser u  left join u.UserRole role where role.KrDESC='工作小秘书角色' and role.KrOrder = 0";
                IList  list  = baseService.loadEntityList(ssql1);
                if (list != null && list.Count > 0)
                {
                    WkTUser theuser = (WkTUser)list[0];
                    levinser.UserId = theuser.Id;
                }
                else
                {
                    levinser.UserId = 0;
                }
            }

            lev.Ku_Id         = leaveman;  //请假人信息
            lev.LeaveChargeId = chargeman; //指定的负责人列表
            lev.State         = (int)IEntity.stateEnum.Normal;
            lev.TimeStamp     = DateTime.Now.Ticks;

            try
            {
                object be = baseService.saveEntity(lev);

                #region 向服务器推送消息
                levinser.LeaveId = int.Parse(be.ToString());
                ser.SaveInLeaveInfoInService(levinser);

                #endregion
            }
            catch
            {
                MessageBox.Show("保存失败!");
                return;
            }

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

            comboBox2.Text = "";
            textBox7.Clear();
            chargeman.Clear();//每次用完之后清空全局变量chargeman中的数据
        }
Пример #13
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("保存成功!");
        }
Пример #14
0
        private void button17_Click(object sender, EventArgs e)//出差发起提交
        {
            if (listView9.SelectedItems.Count == 0)
            {
                MessageBox.Show("请指定审批院领导");
            }
            else if (textBox4.Text == "" || textBox5.Text == "" || listView1.Items.Count == 0)
            {
                MessageBox.Show("请完成出差表单");
            }
            else if (dateTimePicker1.Value < DateTime.Now.Date || dateTimePicker2.Value < dateTimePicker1.Value)
            {
                MessageBox.Show("请正确选择时间");
            }
            else
            {
                Business buss = new Business();

                buss.Ku_Id = User;
                //buss.BusinessId = (WkTUser)listView1.SelectedItems[0].Tag;
                buss.StartTime           = dateTimePicker1.Value.Date.Ticks;
                buss.EndTime             = dateTimePicker2.Value.Date.Ticks;
                buss.BusinessDestination = textBox4.Text;
                buss.BusinessNote        = textBox3.Text;
                buss.BusinessReason      = textBox5.Text;
                buss.PassExam            = (int)Business.ExamState.waiting;
                buss.WaitingNum          = listView1.Items.Count;
                buss.Boss = (WkTUser)listView9.SelectedItems[0].Tag;

//                Business buss1 = (Business)(getBussItself(buss)[0]);

                buss.BusinessEmployee = new List <BusinessEmployee>();
                foreach (ListViewItem row in listView1.Items)
                {
                    BusinessEmployee be = new BusinessEmployee();
                    be.EmployeeId = (WkTUser)row.Tag;
                    be.PassExam   = (int)BusinessEmployee.ExamState.waiting;
                    be.BusinessId = buss;
                    buss.BusinessEmployee.Add(be);
                }
                Object id = baseService.saveEntity(buss);


                #region  务器通信

                try
                {
                    List <WkTDept> depList = new List <WkTDept>();
                    List <WkTUser> uList   = new List <WkTUser>();
                    foreach (BusinessEmployee be in buss.BusinessEmployee)
                    {
                        if (depList.Count == 0)
                        {
                            depList.Add(be.EmployeeId.Kdid);
                        }
                        if (!depList.Contains(be.EmployeeId.Kdid))
                        {
                            depList.Add(be.EmployeeId.Kdid);
                        }
                    }
                    foreach (WkTDept dep in depList)
                    {
                        string sql = "from WkTUser u where u.Kdid=" + dep.Id;
                        IList  ul  = baseService.loadEntityList(sql);
                        foreach (WkTUser u in ul)
                        {
                            foreach (WkTRole r in u.UserRole)
                            {
                                if (r.KrOrder == 2)
                                {
                                    uList.Add(u);
                                }
                            }
                        }
                    }

                    KjqbService.Service1Client ser = new KjqbService.Service1Client();
                    if (uList != null && uList.Count != 0)
                    {
                        foreach (WkTUser u in uList)
                        {
                            KjqbService.BusinessService bs = new KjqbService.BusinessService();
                            bs.BusinessID = Convert.ToInt32(id.ToString());
                            bs.ReceiveID  = u.Id;
                            bs.Type       = 0;
                            bs.TimeStamp  = DateTime.Now.Ticks;
                            ser.SaveInBusinessListInService(bs);
                        }
                    }
                }
                catch { }
                #endregion


                MessageBox.Show("添加成功!");
                listView9.SelectedItems.Clear();
                textBox3.Clear();
                textBox4.Clear();
                textBox5.Clear();
                listView4.Items.Clear();
                listView1.Items.Clear();
            }
        }
Пример #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region   图片并生成新html
            Regex           r  = new Regex("<IMG[\\s\\S]*?>");
            MatchCollection mc = r.Matches(htmlEditor1.BodyInnerHTML);
            ///string[] mc = CommonClass.HtmlUtility.GetElementsByTagName(htmlEditor1.BodyInnerHTML, "IMG");

            String html     = htmlEditor1.BodyInnerHTML;
            Uri    endpoint = new Uri(Securit.DeDES(IniReadAndWrite.IniReadValue("fileManage", "filePath")));
            for (int i = 0; i < mc.Count; i++)
            {
                if (mc[i].Value.Contains("src=\"http://"))
                {
                    continue;
                }
                using (WebClient myWebClient = new WebClient())
                {
                    myWebClient.UploadFileCompleted += new UploadFileCompletedEventHandler(uploadCompleted);
                    String imgHtml = mc[i].Value;

                    string inPath = HtmlUtility.GetTitleContent(imgHtml, "img", "src");  //imgHtml.Substring(startIndex, imgHtml.LastIndexOf("\"") - startIndex);

                    try
                    {
                        String newName  = user.Id + "_" + DateTime.Now.Ticks + inPath.Substring(inPath.LastIndexOf("."));
                        String tempPath = Application.StartupPath.ToString() + "\\temp\\" + newName;
                        File.Copy(inPath, tempPath, true);

                        myWebClient.UploadFileAsync(endpoint, tempPath);

                        String newString2 = imgHtml.Remove(imgHtml.IndexOf("src"), inPath.Length + 6);//.Remove(imgHtml.LastIndexOf('>'))+" src=\"" + Securit.DeDES(IniReadAndWrite.IniReadValue("fileManage", "savePath")) + newName + "\">";
                        string newString1 = newString2.Remove(newString2.LastIndexOf('>'));
                        string newString  = newString1 + " src=\"" + Securit.DeDES(IniReadAndWrite.IniReadValue("fileManage", "savePath")) + @"LogPic\" + newName + "\">";
                        //html

                        html = html.Replace(mc[i].Value, newString);
                    }
                    catch (Exception exp)
                    {
                        MessageBox.Show(exp.ToString());
                        return;
                    }
                }
            }
            #endregion
            StaffLog staffLog = null;
            if (htmlEditor1.Tag == null)
            {
                staffLog = new StaffLog();
            }
            else if (htmlEditor1.Tag != null)
            {
                staffLog = (StaffLog)htmlEditor1.Tag;
            }
            staffLog.Content      = html;
            staffLog.State        = (int)IEntity.stateEnum.Normal;
            staffLog.WriteTime    = DateTime.Now.Ticks;
            staffLog.TimeStamp    = DateTime.Now.Ticks;
            staffLog.Staff        = user;
            staffLog.SharedStaffs = sharedUser;

            try
            {
                if (staffLog.Id == 0)
                {
                    object be = baseService.saveEntity(staffLog);
                    staffLog.Id = int.Parse(be.ToString());
                }
                else if (staffLog.Id != 0)
                {
                    baseService.SaveOrUpdateEntity(staffLog);
                }

                #region 向服务中发送数据

                try
                {
                    KjqbService.Service1Client ser = new KjqbService.Service1Client();
                    if (sharedUser != null && sharedUser.Count > 0)
                    {
                        foreach (WkTUser u in sharedUser)
                        {
                            KjqbService.LogInService ll = new KjqbService.LogInService();
                            ll.LogId       = staffLog.Id;
                            ll.WriteUserId = this.user.Id;
                            ll.ShareUserId = u.Id;
                            ll.TimeStamp   = DateTime.Now.Ticks;
                            ser.SaveInLogListInService(ll);
                        }
                    }
                }
                catch
                {
                }
                #endregion
            }
            catch
            {
                MessageBox.Show("保存失败!");
                return;
            }
            MessageBox.Show("保存成功!");

            this.DialogResult = DialogResult.OK;
            this.Close();
        }