Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        //添加
        private void button2_Click(object sender, EventArgs e)
        {
            if (listView2.SelectedItems != null && listView2.SelectedItems.Count != 0)
            {
                BusinessEmployee be = new BusinessEmployee();
                be.BusinessId = business;
                be.EmployeeId = ((WkTUser)listView2.SelectedItems[0].Tag);
                be.PassExam = (int)BusinessEmployee.ExamState.waiting;
                beList.Add(be);

                ListViewItem item = new ListViewItem();
                item.Text = be.EmployeeId.KuName;
                item.Tag = be;
                listView1.Items.Add(item);
                count++;
            }
        }
Ejemplo n.º 3
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();
            }
        }