Пример #1
0
        private void BusinessChange_Load(object sender, EventArgs e)
        {
            beList = (ArrayList)this.Tag;
            origin=(ArrayList)beList.Clone();
            user = ((BusinessEmployee)beList[0]).EmployeeId;
            dept = user.Kdid;
            business = ((BusinessEmployee)beList[0]).BusinessId;

            foreach (BusinessEmployee be in beList)
            {
                ListViewItem item = new ListViewItem();
                item.Text = be.EmployeeId.KuName;
                item.Tag = be;
                listView1.Items.Add(item);
            }

            IList udList=getUserByDept(dept);
            foreach (WkTUser ud in udList)
            {
                ListViewItem item = new ListViewItem();
                item.Text = ud.KuName;
                item.Tag = ud;
                listView2.Items.Add(item);
            }
        }
Пример #2
0
 private void BusinessRedo_Load(object sender, EventArgs e)
 {
     this.MaximizeBox = false;
     business = (Business)this.Tag;
     IList<BusinessEmployee> beList=business.BusinessEmployee;
     foreach (BusinessEmployee be in beList)
     {
         ListViewItem item = new ListViewItem();
         item.Text = be.EmployeeId.KuName;
         item.SubItems.Add(be.EmployeeId.Kdid.KdName.Trim());
         item.Tag = be;
         listView1.Items.Add(item);
     }
 }
        private void listView7_MouseClick(object sender, MouseEventArgs e)
        {
            listView3.Items.Clear();
            Business b = (Business)listView7.SelectedItems[0].Tag;
            foreach (BusinessEmployee be in b.BusinessEmployee)
            {
                ListViewItem item = new ListViewItem();
                item.Text = be.EmployeeId.KuName;
                item.SubItems.Add(be.EmployeeId.Kdid.KdName.Trim());
                item.Tag = be;
                listView3.Items.Add(item);
            }

            DateTime st = new DateTime(b.StartTime), et = new DateTime(b.EndTime);
            textBox9.Text = b.BusinessNote;
            textBox10.Text = b.BusinessDestination;
            textBox11.Text = st.ToString("yyyy年 MM月 dd日") + "----" + et.ToString("yyyy年 MM月 dd日");
            textBox13.Text = b.BusinessReason;
            textBox19.Text = b.Ku_Id.KuName;
            selectedBusiness = b;
        }
        private void listView5_MouseClick(object sender, MouseEventArgs e)
        {
            Business b = (Business)listView5.SelectedItems[0].Tag;
            IList businessEmployee = getEmpByBus(b);
            listView6.Items.Clear();
            foreach (BusinessEmployee be in businessEmployee)
            {

                ListViewItem item = new ListViewItem();
                item.Text = be.EmployeeId.KuName;
                item.SubItems.Add(be.EmployeeId.Kdid.KdName.Trim());
                switch (be.PassExam)
                {
                    case (int)BusinessEmployee.ExamState.waiting:
                        item.SubItems.Add("未审核");
                        break;
                    case (int)BusinessEmployee.ExamState.pass:
                        item.SubItems.Add("已审核");
                        break;
                }

                item.Tag = be;

                listView6.Items.Add(item);
            }
            DateTime st=new DateTime(b.StartTime), et=new DateTime(b.EndTime);
            textBox6.Text = b.BusinessReason;
            textBox7.Text = st.ToString("yyyy年 MM月 dd日") + "----" + et.ToString("yyyy年 MM月 dd日");
            textBox8.Text = b.BusinessDestination;
            textBox20.Text = b.Ku_Id.KuName;
            textBox12.Text = b.BusinessNote;
            textBox21.Text = b.Boss.KuName;

            string affairsDept = IniReadAndWrite.IniReadValue("AdministrationSection", "affairs");
            string netDept = IniReadAndWrite.IniReadValue("AdministrationSection", "net");
            string queryEmp;
            if (User.Kdid.KdName.Trim() != affairsDept)
            {
                queryEmp = "from BusinessEmployee be where be.BusinessId=" + b.Id + "and be.EmployeeId.Kdid=" + User.Kdid.Id + "and  be.PassExam=" + (int)BusinessEmployee.ExamState.waiting + " and be.State=" + (int)BusinessEmployee.stateEnum.Normal;
            }
            else
            {

                queryEmp = "from BusinessEmployee be where be.BusinessId=" + b.Id + "and (be.EmployeeId.Kdid=" + User.Kdid.Id + " or be.EmployeeId.Kdid.KdName like '%院领导%' ) and  be.PassExam=" + (int)BusinessEmployee.ExamState.waiting + " and be.State=" + (int)BusinessEmployee.stateEnum.Normal ;

            }
            EmpInBusDept = baseService.loadEntityList(queryEmp);

            if (EmpInBusDept == null||EmpInBusDept.Count==0)
            {
                button4.Enabled = false;
                button5.Enabled = false;
                button8.Enabled = false;
            }
            else
            {
                button4.Enabled = true;
                button5.Enabled = true;
                button8.Enabled = true;
            }

            selectedBusiness = b;
        }
 private void listView10_Click(object sender, EventArgs e)
 {
     listView8.Items.Clear();
     Business b = (Business)this.listView10.SelectedItems[0].Tag;
     foreach (BusinessEmployee be in b.BusinessEmployee)
     {
         ListViewItem item = new ListViewItem();
         item.Text = be.EmployeeId.KuName;
         item.SubItems.Add(be.EmployeeId.Kdid.KdName.Trim());
         switch (be.PassExam)
         {
             case (int)BusinessEmployee.ExamState.redo:
                 item.SubItems.Add("退回");
                 break;
             case (int)BusinessEmployee.ExamState.pass:
                 item.SubItems.Add("通过审批");
                 break;
         }
         item.Tag = be;
         listView8.Items.Add(item);
     }
     selectedBusiness = b;
     DateTime st = new DateTime(b.StartTime), et = new DateTime(b.EndTime);
     textBox17.Text = b.BusinessReason;
     textBox15.Text = b.BusinessDestination;
     textBox14.Text = b.BusinessNote;
     textBox16.Text = st.ToString("yyyy年 MM月 dd日") + "----" + et.ToString("yyyy年 MM月 dd日");
     textBox18.Text = b.Ku_Id.KuName;
 }
        private void initTabPage5()
        {
            listView8.Items.Clear();
            listView10.Items.Clear();
            string query = "from Business b where b.Ku_Id=" + this.User.Id + "and b.PassExam=" + (int)Business.ExamState.redo + " order by b.StartTime desc";
            IList busList = baseService.loadEntityList(query);
            int i=1;
            if (busList != null)
            {
                foreach (Business b in busList)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = i.ToString();
                    item.SubItems.Add(b.Boss.KuName);
                    item.Tag = b;
                    listView10.Items.Add(item);
                }
            }

            textBox14.Text = "";
            textBox15.Text = "";
            textBox16.Text = "";
            textBox17.Text = "";
            selectedBusiness = null;
        }
 private void initTabPage4()
 {
     listView5.Items.Clear();
     listView6.Items.Clear();
     if (roleInUser(this.User, "部门主任"))
     {
         string query = "from Business b where " + Dept.Id + "in (select be.EmployeeId.Kdid from  BusinessEmployee be where be.BusinessId=b.Id) and b.PassExam=" + (int)Business.ExamState.waiting + " order by b.StartTime desc";
         IList depList = baseService.loadEntityList(query);
         int i = 1;
         if (depList != null)
         {
             foreach (Business b in depList)
             {
                 ListViewItem item = new ListViewItem();
                 item.Text = i.ToString();
                 DateTime st = new DateTime(b.StartTime);
                 item.SubItems.Add(st.ToString("MM月 dd日"));
                 item.Tag = b;
                 listView5.Items.Add(item);
                 i++;
             }
         }
     }
     selectedBusiness = null;
     EmpInBusDept = null;
     textBox6.Text = "";
     textBox7.Text = "";
     textBox8.Text = "";
     textBox12.Text = "";
     button4.Enabled = false;
     button5.Enabled = false;
     button8.Enabled = false;
 }
        //初始化审批界面
        private void initTabPage3()
        {
            listView3.Items.Clear();
            listView7.Items.Clear();
            string query = "from Business b where b.Boss=" + User.Id + "and b.PassExam=" + (int)Business.ExamState.pass + " order by b.StartTime desc";
            IList busList = baseService.loadEntityList(query);
            int i = 1;
            if (busList != null)
            {
                foreach (Business b in busList)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = i.ToString();
                    DateTime st = new DateTime(b.StartTime);
                    item.SubItems.Add(st.ToString("MM月 dd日"));
                    item.Tag = b;
                    i++;
                    listView7.Items.Add(item);

                }
            }
            textBox9.Text = "";
            textBox10.Text = "";
            textBox11.Text = "";
            textBox13.Text = "";
            selectedBusiness = null;
        }
 ///<summary>获取某次出差的人员名单</summary>         
 private IList getEmpByBus(Business b)
 {
     string queryUser = "******" + b.Id + " and be.State=" + (int)BusinessEmployee.stateEnum.Normal;
     return baseService.loadEntityList(queryUser);
 }
Пример #10
0
 private IList getBussItself(Business b)
 {
     string query = "from Business bu where bu.BusinessDestination='" + b.BusinessDestination + "' and bu.BusinessReason='" + b.BusinessReason + "' and bu.StartTime=" + b.StartTime + " and bu.EndTime=" + b.EndTime + " and bu.Ku_Id=" + b.Ku_Id.Id + " and bu.State=" + (int)Business.stateEnum.Normal;
     return baseService.loadEntityList(query);
 }
Пример #11
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();
            }
        }
Пример #12
0
 private void button5_Click(object sender, EventArgs e)
 {
     Business b = new Business();
     if (listView2.SelectedItems != null && listView2.SelectedItems.Count != 0)
     {
         b = (Business)listView2.SelectedItems[0].Tag;
         string query1 = "update LOG_T_BUSINESS set State="+(int)Business.stateEnum.Deleted+"where Id="+b.Id;
         string query2 = "update LOG_T_BUSINESSEMPLOYEE set State=" + (int)BusinessEmployee.stateEnum.Deleted + "where BUSINESSID=" + b.Id;
         baseService.ExecuteSQL(query2);
         baseService.ExecuteSQL(query1);
         listView2.Items.Remove(listView2.SelectedItems[0]);
     }
 }