Beispiel #1
0
        public ActionResult Index(LeaveManage mails)
        {
            MailMessage mailMessage = new MailMessage();
            MailAddress fromMail    = new MailAddress("*****@*****.**");
            var         Empmails    = db.Employees.Select(c => c.OfficialEmail).ToString();

            //mails.EmployeesMail = Empmails;
            //foreach (var empmail in Empmails.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
            //{
            //    mails.EmployeesMail = empmail;
            //mailMessage.To.Add(new MailAddress("*****@*****.**"));
            //}
            //mails = Empmails
            mails.EmployeesMail = "*****@*****.**";
            mailMessage.To.Add(new MailAddress(mails.EmployeesMail));
            mailMessage.From       = fromMail;
            mailMessage.Subject    = "Leave Plan";
            mailMessage.IsBodyHtml = true;
            mailMessage.Body       = mails.MessageBody;
            //"Hello, \n\n Dear Staff, Please be informed that you are expected to send your leave plan across to the HOD \n\nBest Regards.";
            //mailMessage.CC.Add("*****@*****.**");
            //mailMessage.Bcc.Add("*****@*****.**");
            SmtpClient smtpClient = new SmtpClient();

            smtpClient.Host      = "mail.oohwantech.com";
            smtpClient.EnableSsl = false;
            NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "Me@digit01");

            smtpClient.UseDefaultCredentials = true;
            smtpClient.Credentials           = NetworkCred;
            smtpClient.Port = 25;
            smtpClient.Send(mailMessage);
            Response.Write("Message Sent");
            return(View(mails));
        }
Beispiel #2
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("您尚未选择条目!");
            }
        }
Beispiel #3
0
        /// <summary>
        /// 修改提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button8_Click(object sender, EventArgs e)
        {
            //请假修改提交;首先修改界面上listview2中选中数据显示信息,然后再将更改的数据保存到数据库中
            if (this.listView2.SelectedItems == null)
            {
                return;
            }
            ListViewItem item = this.listView2.SelectedItems[0];//请假查看-listview2中的数据被选中

            if (item == null)
            {
                return;
            }
            LeaveManage levchange = new LeaveManage();

            levchange = (LeaveManage)item.Tag;

            item.SubItems[6].Text = label21.Text;   //负责人
            item.SubItems[3].Text = comboBox3.Text; //请假类别
            item.SubItems[8].Text = textBox2.Text;  //请假原因


            if (dateTimePicker5.Value.Date.Ticks > dateTimePicker6.Value.Date.Ticks)
            {
                MessageBox.Show("请假开始时间必须早于或等于结束时间!");
                return;
            }
            if (comboBox3.Text == null || comboBox3.Text == "")
            {
                MessageBox.Show("请选择请假类型!");
                return;
            }
            levchange.StartTime   = dateTimePicker5.Value.Date.Ticks;
            levchange.EndTime     = dateTimePicker6.Value.Date.Ticks;
            levchange.LeaveType   = comboBox3.Text.Trim(); //请假类型
            levchange.LeaveReason = textBox2.Text.Trim();  //请假原因


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

            try
            {
                baseService.SaveOrUpdateEntity(levchange);
            }
            catch
            {
                MessageBox.Show("保存失败!");
                return;
            }

            MessageBox.Show("保存成功!");
        }
Beispiel #4
0
        private void listView2_MouseClick(object sender, MouseEventArgs e)
        {
            groupBox3.Visible = true;
            if (this.listView2.SelectedItems == null)
            {
                return;
            }
            ListViewItem item = this.listView2.SelectedItems[0];//请假查看-listview2中的数据被选中

            if (item == null)
            {
                return;
            }
            LeaveManage u = (LeaveManage)item.Tag;

            if (u.LeaveResult.Trim() == "3" || (u.LeaveResult.Trim() == "1" && (u.LeaveStage.Trim() == "1" || u.LeaveStage.Trim() == "2")))
            {
                if (u.Ku_Id.Id == this.leaveman.Id)
                {
                    this.dateTimePicker5.Enabled = true;
                    this.dateTimePicker6.Enabled = true;
                    this.comboBox3.Enabled       = true;
                    this.textBox2.Enabled        = true;
                    linkLabel1.Visible           = true;
                    button8.Visible = true;
                    button9.Visible = true;
                }
            }
            else
            {
                this.dateTimePicker5.Enabled = false;
                this.dateTimePicker6.Enabled = false;
                this.comboBox3.Enabled       = false;
                this.textBox2.Enabled        = false;
                linkLabel1.Visible           = false;
                button8.Visible = false;
                button9.Visible = false;
            }


            label21.Text   = item.SubItems[6].Text;            //负责人
            comboBox3.Text = item.SubItems[3].Text;            //请假类别
            textBox2.Text  = item.SubItems[8].Text;            //请假原因

            dateTimePicker5.Value = new DateTime(u.StartTime); //开始时间
            dateTimePicker6.Value = new DateTime(u.EndTime);   //结束时间
        }
Beispiel #5
0
        public ActionResult Index()
        {
            var model = new LeaveManage();

            return(View(model));
        }
Beispiel #6
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("您尚未选择审批条目!");
            }
        }
Beispiel #7
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中的数据
        }
Beispiel #8
0
        private void NewMessageWindow_Load(object sender, EventArgs e)
        {
            if (this.formLocation != null)
            {
                this.Location = formLocation;
            }

            if (loglist != null && loglist.Count > 0)
            {
                loglist.Reverse();
                foreach (KjqbService.LogInService ll in Loglist)
                {
                    StaffLog ss = new StaffLog();
                    ss = (StaffLog)baseService.loadEntity(ss, ll.LogId);

                    LinkLabel l1 = new LinkLabel();
                    l1.Text         = ss.Staff.KuName + "分享给您的日志";
                    l1.Width        = this.flowLayoutPanel1.Width - 10;
                    l1.Height       = 30;
                    l1.Top          = 10;
                    l1.Tag          = ll;
                    l1.Click       += l1_Click;
                    l1.Parent       = flowLayoutPanel1;
                    l1.DoubleClick += l1_DoubleClick;
                }
            }

            if (schedulelist != null && schedulelist.Count > 0)
            {
                schedulelist.Reverse();
                foreach (KjqbService.ScheduleInService ll in schedulelist)
                {
                    StaffSchedule ss = new StaffSchedule();
                    //string sql = "select u from StaffLog u where u.Id = " + ll.LogId;
                    ss = (StaffSchedule)baseService.loadEntity(ss, ll.ScheduleId);


                    LinkLabel l1 = new LinkLabel();
                    l1.Width        = this.flowLayoutPanel1.Width - 10;
                    l1.Height       = 30;
                    l1.Top          = 10;
                    l1.Tag          = ll;
                    l1.Click       += l1_Click;
                    l1.Parent       = flowLayoutPanel1;
                    l1.DoubleClick += l1_DoubleClick;
                    if (ss.Staff.Id == ss.ArrangeMan.Id)
                    {
                        l1.Text = ss.Staff.KuName + "分享给您的日程";
                    }
                    else if (ss.Staff.Id != ss.ArrangeMan.Id)
                    {
                        l1.Text = ss.ArrangeMan.KuName + "给您安排的日程";
                    }
                }
            }

            if (commentList != null && commentList.Count > 0)
            {
                commentList.Reverse();
                foreach (KjqbService.CommentInService ll in commentList)
                {
                    StaffLog ss = new StaffLog();
                    //string sql = "select u from StaffLog u where u.Id = " + ll.LogId;
                    ss = (StaffLog)baseService.loadEntity(ss, ll.LogId);


                    LinkLabel l1 = new LinkLabel();
                    l1.Text         = ll.CommentUserName + "评论了您的日志";
                    l1.Width        = this.flowLayoutPanel1.Width - 10;
                    l1.Height       = 30;
                    l1.Top          = 10;
                    l1.Tag          = ll;
                    l1.Click       += l1_Click;
                    l1.DoubleClick += l1_DoubleClick;
                    l1.Parent       = flowLayoutPanel1;
                }
            }

            if (tfmlist != null && tfmlist.Count > 0)
            {
                tfmlist.Reverse();
                foreach (KjqbService.TimeArrangeForManagerInService tfm in tfmlist)
                {
                    TimeArrangeForManager tt = new TimeArrangeForManager();
                    tt = (TimeArrangeForManager)baseService.loadEntity(tt, tfm.TimeArrangeForManagerId);


                    LinkLabel l1 = new LinkLabel();
                    l1.Width        = this.flowLayoutPanel1.Width - 10;
                    l1.Height       = 30;
                    l1.Top          = 10;
                    l1.Tag          = tfm;
                    l1.Click       += l1_Click;
                    l1.DoubleClick += l1_DoubleClick;
                    l1.Parent       = flowLayoutPanel1;
                    DateTime dt = new DateTime(tt.TimeMonth);
                    if (tfm.ExamineOrExamineresult == 0)
                    {
                        l1.Text = dt.ToString("yyyy年MM月") + " " + "排班待您审核";
                    }
                    if (tfm.ExamineOrExamineresult == 1)
                    {
                        l1.Text = dt.ToString("yyyy年MM月") + " " + "排班审核通过";
                    }
                    if (tfm.ExamineOrExamineresult == 2)
                    {
                        l1.Text = dt.ToString("yyyy年MM月") + " " + "排班审核未通过";
                    }
                    if (tfm.ExamineOrExamineresult == 3)
                    {
                        l1.Text = "请您安排" + dt.ToString("yyyy年MM月") + "的值班";
                    }
                }
            }

            if (levlist != null && levlist.Count > 0)
            {
                levlist.Reverse();
                foreach (KjqbService.LeaveInService tfm in levlist)
                {
                    LeaveManage tt = new LeaveManage();
                    tt = (LeaveManage)baseService.loadEntity(tt, tfm.LeaveId);

                    LinkLabel l1 = new LinkLabel();
                    l1.Width        = this.flowLayoutPanel1.Width - 10;
                    l1.Height       = 30;
                    l1.Top          = 10;
                    l1.Tag          = tfm;
                    l1.Click       += l1_Click;
                    l1.DoubleClick += l1_DoubleClick;
                    l1.Parent       = flowLayoutPanel1;

                    if (tfm.ExamineOrExamineresult == 0)
                    {
                        l1.Text = tt.Ku_Id.KuName + "请假申请待您审核";
                    }
                    DateTime dt1 = new DateTime(tt.StartTime);
                    DateTime dt2 = new DateTime(tt.EndTime);

                    if (tfm.ExamineOrExamineresult == 1)
                    {
                        l1.Text = "您提交的" + tt.LeaveType + "申请审核通过";
                    }
                    if (tfm.ExamineOrExamineresult == 2)
                    {
                        l1.Text = "您提交的" + tt.LeaveType + "申请审核未通过";
                    }
                }
            }
            if (buslist != null && buslist.Count > 0)
            {
                buslist.Reverse();
                foreach (KjqbService.BusinessService tfm in buslist)
                {
                    // tt = new LeaveManage();
                    //tt = (LeaveManage)baseService.loadEntity(tt, tfm.LeaveId);

                    LinkLabel l1 = new LinkLabel();
                    l1.Width        = this.flowLayoutPanel1.Width - 10;
                    l1.Height       = 30;
                    l1.Top          = 10;
                    l1.Tag          = tfm;
                    l1.Click       += l1_Click;
                    l1.DoubleClick += l1_DoubleClick;
                    l1.Parent       = flowLayoutPanel1;

                    if (tfm.Type == 0)
                    {
                        l1.Text = "您有一条出差信息待审批";
                    }
                    else if (tfm.Type == 1)
                    {
                        l1.Text = "您的出差申请被退回";
                    }
                    else if (tfm.Type == 2)
                    {
                        l1.Text = "您的出差申请被撤销";
                    }
                    else if (tfm.Type == 3)
                    {
                        l1.Text = "您的出差申请审核通过";
                    }
                }
            }
        }