Esempio n. 1
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("没有选择退回员工");
            }
        }
Esempio n. 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();
        }
Esempio n. 3
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();
        }
Esempio n. 4
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;
            }
        }
Esempio n. 5
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();
            }
        }
Esempio n. 6
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();
            }
        }