Exemplo n.º 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("您尚未选择条目!");
            }
        }
Exemplo n.º 2
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("您尚未选择审批条目!");
            }
        }
Exemplo n.º 3
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中的数据
        }