Esempio n. 1
0
    public void PYsearch(string py, string store)
    {
        if (py.Trim() == "")
        {
            return;
        }
        switch (store.Trim())
        {
        case "deptStore":
            if (PublicCode.BugCreate(SessionBox.GetUserSession().DeptNumber))
            {
                string areadept = dc.Person.First(p => p.Personnumber == SessionBox.GetUserSession().PersonNumber).Areadeptid;
                var    dept     = from d in dc.Department
                                  where d.Deptnumber.Substring(0, 4) == SessionBox.GetUserSession().DeptNumber.Substring(0, 4) &&
                                  d.Deptnumber != areadept && d.Fatherid != areadept &&
                                  (dc.F_PINYIN(d.Deptname).ToLower().Contains(py.ToLower()) || d.Deptname.Contains(py.Trim()))
                                  select new
                {
                    deptID   = d.Deptnumber,
                    deptName = d.Deptname
                };
                deptStore.DataSource = dept.Distinct();
                deptStore.DataBind();
            }
            else
            {
                var dept = from d in dc.Department
                           where d.Deptnumber.Substring(0, 4) == SessionBox.GetUserSession().DeptNumber.Substring(0, 4) &&
                           (d.Deptnumber.Substring(7) == "00" || d.Deptlevel == "正科级") && d.Deptstatus == "1" &&
                           (dc.F_PINYIN(d.Deptname).ToLower().Contains(py.ToLower()) || d.Deptname.Contains(py.Trim()))
                           select new
                {
                    deptID   = d.Deptnumber,
                    deptName = d.Deptname
                };
                deptStore.DataSource = dept.Distinct();
                deptStore.DataBind();
            }
            break;

        case "placeStore":
            if (PublicCode.BugCreate(SessionBox.GetUserSession().DeptNumber))
            {
                decimal areaid = (from p in dc.Person
                                  from d in dc.Department
                                  from a in dc.Placeareas
                                  where p.Personnumber == SessionBox.GetUserSession().PersonNumber &&
                                  p.Areadeptid == d.Deptnumber && d.Deptname.Replace(" ", "") == a.Pareasname
                                  select a).First().Pareasid;
                var place = from pl in dc.Place
                            where pl.Maindeptid == SessionBox.GetUserSession().DeptNumber &&
                            pl.Pareasid != areaid && pl.Placestatus == 1 &&
                            (dc.F_PINYIN(pl.Placename).ToLower().Contains(py.ToLower()) || pl.Placename.Contains(py.Trim()))
                            select new
                {
                    placID   = pl.Placeid,
                    placName = pl.Placename
                };
                placeStore.DataSource = place;
                placeStore.DataBind();
            }
            else
            {
                var place = from pl in dc.Place
                            where pl.Maindeptid == SessionBox.GetUserSession().DeptNumber&& pl.Placestatus == 1 &&
                            (dc.F_PINYIN(pl.Placename).ToLower().Contains(py.ToLower()) || pl.Placename.Contains(py.Trim()))
                            select new
                {
                    placID   = pl.Placeid,
                    placName = pl.Placename
                };
                placeStore.DataSource = place;
                placeStore.DataBind();
            }
            break;

        case "yhStore":    //修改多列显示
            var hazard = from yh in dc.Getyhandhazusing
                         where yh.Deptnumber == SessionBox.GetUserSession().DeptNumber &&
                         (yh.Conpyfirst.ToLower().Contains(py.ToLower()) || yh.Yhcontent.Contains(py.Trim()) || yh.Yhnumber.ToLower().Contains(py.ToLower()))
                         select new
            {
                yhNumber  = yh.Yhid,
                yhContent = yh.Yhcontent,
                Gzrwname  = yh.Levelname,
                Gxname    = yh.Typename
            };
            yhStore.DataSource = hazard;
            yhStore.DataBind();
            break;

        case "PCpersonStore":
            if (cbbJctype.SelectedItem.Value == "2")
            {
                //局端排查人
                var person = from p in dc.Person
                             from d in dc.Department
                             where p.Areadeptid == d.Deptnumber && p.Visualfield == 3 && p.Personstatus == 1 &&
                             (dc.F_PINYIN(p.Name).ToLower().Contains(py.ToLower()) || p.Name.Contains(py.Trim()))
                             select new
                {
                    p.Personnumber,
                    p.Name,
                    d.Deptname
                };
                PCpersonStore.DataSource = person;
                PCpersonStore.DataBind();
            }
            else
            {
                var person = from pl in dc.Vgetpl
                             from p in dc.Person
                             where pl.Moduletag == "HiddenDanage_HDprocess" && pl.Operatortag == "YH_fcfk" && pl.Unitid == SessionBox.GetUserSession().DeptNumber &&
                             (dc.F_PINYIN(pl.Name).ToLower().Contains(py.ToLower()) || pl.Name.Contains(py.Trim())) &&
                             pl.Personnumber == p.Personnumber && p.Personstatus == 1
                             select new
                {
                    pl.Personnumber,
                    pl.Name
                };
                PCpersonStore.DataSource = person.Distinct();
                PCpersonStore.DataBind();
            }
            break;

        case "WorkTaskStore":
            var gzrw = dc.Worktasks.Where(
                p => p.Professionalid == decimal.Parse(cbbSbsdy.SelectedItem.Value) &&
                dc.F_PINYIN(p.Worktask).ToLower().Contains(py.ToLower())
                );
            WorkTaskStore.DataSource = gzrw;
            WorkTaskStore.DataBind();
            break;
        }
    }
Esempio n. 2
0
    public void PYsearch(string py, string store)
    {
        if (py.Trim() == "")
        {
            return;
        }
        switch (store.Trim())
        {
        case "personStore":
            if (PublicCode.BugCreate(SessionBox.GetUserSession().DeptNumber))
            {
                string areadept = dc.Person.First(p => p.Personnumber == SessionBox.GetUserSession().PersonNumber).Areadeptid;
                var    person   = from r in dc.Person
                                  from d in dc.Department
                                  where r.Deptid == d.Deptnumber && r.Maindeptid == SessionBox.GetUserSession().DeptNumber &&
                                  r.Areadeptid != areadept && r.Personstatus == 1 &&
                                  (r.Pinyin.ToLower().Contains(py.ToLower()) || r.Lightnumber.ToLower().Contains(py.ToLower()) || r.Name.Contains(py.Trim()))
                                  select new
                {
                    pernID          = r.Personid,
                    pernName        = r.Name,
                    pernLightNumber = r.Lightnumber,
                    persNnmber      = r.Personnumber,
                    DeptName        = d.Deptname
                };
                personStore.DataSource = person;
                personStore.DataBind();
            }
            else
            {
                var person = from r in dc.Person
                             from d in dc.Department
                             where r.Deptid == d.Deptnumber && r.Maindeptid == SessionBox.GetUserSession().DeptNumber&& r.Personstatus == 1 &&
                             (r.Pinyin.ToLower().Contains(py.ToLower()) || r.Lightnumber.ToLower().Contains(py.ToLower()) || r.Name.Contains(py.Trim()))
                             select new
                {
                    pernID          = r.Personid,
                    pernName        = r.Name,
                    pernLightNumber = r.Lightnumber,
                    persNnmber      = r.Personnumber,
                    DeptName        = d.Deptname
                };
                personStore.DataSource = person;
                personStore.DataBind();
            }
            break;

        case "placeStore":
            if (PublicCode.BugCreate(SessionBox.GetUserSession().DeptNumber))
            {
                decimal areaid = (from p in dc.Person
                                  from d in dc.Department
                                  from a in dc.Placeareas
                                  where p.Personnumber == SessionBox.GetUserSession().PersonNumber &&
                                  p.Areadeptid == d.Deptnumber && d.Deptname.Replace(" ", "") == a.Pareasname
                                  select a).First().Pareasid;
                var place = from pl in dc.Place
                            where pl.Maindeptid == SessionBox.GetUserSession().DeptNumber &&
                            pl.Pareasid != areaid &&
                            (dc.F_PINYIN(pl.Placename).ToLower().Contains(py.ToLower()) || pl.Placename.Contains(py.Trim()))
                            select new
                {
                    placID   = pl.Placeid,
                    placName = pl.Placename
                };
                placeStore.DataSource = place;
                placeStore.DataBind();
            }
            else
            {
                var place = from pl in dc.Place
                            where pl.Maindeptid == SessionBox.GetUserSession().DeptNumber&& pl.Placestatus == 1 &&
                            (dc.F_PINYIN(pl.Placename).ToLower().Contains(py.ToLower()) || pl.Placename.Contains(py.Trim()))
                            select new
                {
                    placID   = pl.Placeid,
                    placName = pl.Placename
                };
                placeStore.DataSource = place;
                placeStore.DataBind();
            }
            break;

        case "yhStore":
            var hazard = from yh in dc.Getswandhazusing
                         where yh.Deptnumber == SessionBox.GetUserSession().DeptNumber &&
                         (yh.Conpyfirst.ToLower().Contains(py.ToLower()) || yh.Swcontent.Contains(py.Trim()) || yh.Swnumber.ToLower().Contains(py.ToLower()))
                         select new
            {
                yhNumber  = yh.Swid,
                yhContent = yh.Swcontent,
                Gzrwname  = yh.Levelname,
                Gxname    = yh.Typename
            };
            yhStore.DataSource = hazard;
            yhStore.DataBind();
            break;

        case "PCpersonStore":
            var person1 = from pl in dc.Vgetpl
                          from p in dc.Person
                          where pl.Moduletag == "HiddenDanage_HDprocess" && pl.Operatortag == "YH_fcfk" && pl.Unitid == SessionBox.GetUserSession().DeptNumber &&
                          (dc.F_PINYIN(pl.Name).ToLower().Contains(py.ToLower()) || pl.Name.Contains(py.Trim())) &&
                          pl.Personnumber == p.Personnumber && p.Personstatus == 1
                          select new
            {
                pl.Personnumber,
                pl.Name
            };
            PCpersonStore.DataSource = person1.Distinct();
            PCpersonStore.DataBind();
            break;

        case "WorkTaskStore":
            var gzrw = dc.Worktasks.Where(
                p => p.Professionalid == decimal.Parse(cbbSbsdy.SelectedItem.Value) &&
                dc.F_PINYIN(p.Worktask).ToLower().Contains(py.ToLower())
                );
            WorkTaskStore.DataSource = gzrw;
            WorkTaskStore.DataBind();
            break;
        }
    }