Beispiel #1
0
        public ActionResult OrgUserAddList(string id)
        {
            CQGJUserViewData viewData = new CQGJUserViewData();
            Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
            List<User> userlist = new List<User>();
            viewData.UsersInOrgs = new List<UsersInOrgs>();
            if (id != null && !id.Equals(""))
            {
                global.GetNotInOrgUser(ref userlist, id);

                viewData.Users = userlist;

                viewData.Org = (from b in CQGJ.b01
                                where b.b0111 == id
                                select b).First();
                viewData.HtmlPage2 = id;
                if (Response.Cookies["OrgID"] == null)
                {
                    Response.Cookies.Add(new HttpCookie("OrgID"));
                }

                Response.Cookies["OrgID"].Value = id;
                viewData.HtmlPage = "<a href='/admin/orginfo/" + id + "'>" + viewData.Org.b0104 + "</a>";
                return View("UserNoutInOrg", viewData);
            }
            else
            {
                // 错误页面
            }
            return View();
        }
Beispiel #2
0
 /// <summary>
 /// 显示某一单位信息
 /// </summary>
 /// <param name="id"></param>
 public ActionResult OrgInfo(string id)
 {
     var Querry = from Org in CQGJ.b01 where Org.b0111 == id select Org;
     CQGJUserViewData viewData = new CQGJUserViewData();
     viewData.Orgs = Querry.ToList();
     if (viewData.Orgs.Count > 0)
     {
         viewData.Org = viewData.Orgs[0];
         Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
         b01 Temp = global.GetUpOrgOnelevel(id);
         string str = "";
         if (Temp != null)
         {
             str = Temp.b0111;
         }
         else
         {
             str = "";
         }
         viewData.HtmlPage = str;
     }
     else
     {
         return RedirectToAction("index");
     }
     return View("Org", viewData);
 }
Beispiel #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="OrgID">部门的标示</param>
        public ActionResult OrgList(string id)
        {
            CQGJUserViewData viewData = new CQGJUserViewData();
            Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
            if (id != null && !id.Equals(""))
            {
                viewData.Orgs = (from b in CQGJ.b01
                                 where (b.b0111.Length > 14 && b.b0111.Substring(0, 14) == id) || b.b0111_3 == id  //单位列表
                                 select b).ToList();
                List<b01> UpOrgList = new List<b01>();
                global.GetUpOrg(ref UpOrgList, id);
                b01 bTemp = (from o in CQGJ.b01 where o.b0111 == id select o).First();

                if (UpOrgList.Count > 0)
                {
                    for (int i = UpOrgList.Count; i > 0; --i)
                    {
                        viewData.HtmlPage += " >> <a href='/admin/orglist/" + UpOrgList[i - 1].b0111 + "'>" + UpOrgList[i - 1].b0104 + "</a>";
                    }
                }
                else
                {
                    viewData.HtmlPage = "";
                }
                viewData.HtmlPage += " >> " + bTemp.b0104;

            }
            else
            {
                viewData.Orgs = (from b in CQGJ.b01
                                 where b.b0111.Length == 14 && (b.b0111_3.Equals("") || b.b0111_3 == null)
                                 select b).ToList();
                viewData.HtmlPage = "";
            }

            for (int j = 0; j < viewData.Orgs.Count; ++j)
            {
                string OrgCode = viewData.Orgs[j].b0111;
                string UsersInOrgNub = "0";
                try
                {
                    UsersInOrgNub = (from uo in CQGJ.UsersInOrgs where uo.b0111 == OrgCode select uo).Count().ToString();
                }
                catch
                {

                }
                string TempHtml = "<a href='/admin/OrgUserList/" + OrgCode + "'>" + UsersInOrgNub + "</a>";
                viewData.AdditionalInfo.Add(TempHtml);

            }
            return View("OrgList", viewData);
        }
Beispiel #4
0
        public ActionResult OrgDel(string id)
        {
            var Querry = from Org in CQGJ.b01 where Org.b0111 == id select Org;
            CQGJUserViewData viewData = new CQGJUserViewData();
            viewData.Orgs = Querry.ToList();
            if (viewData.Orgs.Count > 0)
            {

                b01 Org = viewData.Orgs[0];
                try
                {
                    string strOrgID = Org.b0111;
                    List<b01Expansion> OrgListE = (from oe in CQGJ.b01Expansion where oe.b01.b0111 == strOrgID select oe).ToList();
                    for (int k = 0; k < OrgListE.Count; ++k)
                    {
                        CQGJ.DeleteObject(OrgListE[k]);
                        CQGJ.SaveChanges(true);
                    }
                }
                catch { }

                CQGJ.DeleteObject(Org);
                List<UsersInOrgs> OrguserList = (from ou in CQGJ.UsersInOrgs where ou.b0111 == id select ou).ToList();
                foreach (UsersInOrgs Orguser in OrguserList)
                {
                    CQGJ.DeleteObject(Orguser);
                }

                CQGJ.SaveChanges(true);

                Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
                b01 Temp = global.GetUpOrgOnelevel(id);

                string str = "";
                if (Temp != null)
                {
                    str = "/" + Temp.b0111;
                }
                else
                {
                    str = "";
                }

                viewData.ActionSuccess = false;
                viewData.IfmLoad = true;
                viewData.HtmlPage = "单位:" + Org.b0104 + "删除成功!";
                viewData.JavaScriptPage = "/admin/OrgIndex";
                return View("MessagePage", viewData);
            }
            else
            {
                //错误
            }
            return View();
        }
Beispiel #5
0
        /// <summary>
        /// 用户单位列表
        /// </summary>
        /// <param name="id">用户ID</param>
        public ActionResult UserOrgList(string id)
        {
            CQGJUserViewData viewData = new CQGJUserViewData();
            Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
            List<b01> Orglist = new List<b01>();
            viewData.UsersInOrgs = new List<UsersInOrgs>();
            if (id != null && !id.Equals(""))
            {
                int iID = 0;
                try
                {
                    iID = int.Parse(id);
                    global.GetUserOrg(ref Orglist, iID);

                    viewData.Orgs = Orglist;

                    viewData.UsersInOrgs = (from uo in CQGJ.UsersInOrgs
                                            where uo.User.UserID == iID
                                            select uo).ToList();
                    viewData.User = (from u in CQGJ.User
                                     where u.UserID == iID
                                     select u).First();
                    return View("UserOrg", viewData);
                }
                catch
                {
                    //错误
                }

            }
            else
            {
                // 错误页面
            }
            return View();
        }
Beispiel #6
0
        /// <summary>
        /// 用户可加入单位列表
        /// </summary>
        /// <param name="id">用户ID</param>
        public ActionResult UserNotOrg(string id)
        {
            CQGJUserViewData viewData = new CQGJUserViewData();
            int iID = 0;
            try
            {
                iID = int.Parse(id);
                viewData.User = (from u in CQGJ.User where u.UserID == iID select u).First();
            }
            catch
            {
                //错误页面
            }

            Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
            List<b01> Orglist = new List<b01>();
            global.GetUserNotInOrg(ref Orglist, iID);
            viewData.Orgs = Orglist;

            for (int j = 0; j < viewData.Orgs.Count; ++j)
            {
                string OrgCode = viewData.Orgs[j].b0111;
                string UsersInOrgNub = "0";
                try
                {
                    UsersInOrgNub = (from uo in CQGJ.UsersInOrgs where uo.b0111 == OrgCode select uo).Count().ToString();
                }
                catch
                {

                }
                string TempHtml = UsersInOrgNub;
                viewData.AdditionalInfo.Add(TempHtml);
            }

            return View("OrgNotUser", viewData);
        }
Beispiel #7
0
        /// <summary>
        /// 取得用户列表 现在版本仅为最初版本OrgID不用
        /// </summary>
        /// <param name="id">部门的标示</param>
        public ActionResult UserList(string id)
        {
            CQGJUserViewData viewData = new CQGJUserViewData();
            Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
            List<User> userlist = new List<User>();
            if (id != null && !id.Equals(""))
            {
                global.GetOrgUser(ref userlist, id);

                viewData.Users = userlist;
                if (Response.Cookies["OrgID"] == null)
                {
                    Response.Cookies.Add(new HttpCookie("OrgID"));
                }
                b01 OrgTemp = global.GetUpOrgOnelevel(id);
                string strOrgId = "";
                if (OrgTemp == null)
                {
                    strOrgId = "";
                }
                else
                {
                    strOrgId = OrgTemp.b0111;
                }
                viewData.Org = (from b in CQGJ.b01
                                where b.b0111 == id
                                select b).First();

                viewData.HtmlPage = "<a href='/admin/orglist/" + strOrgId + "'>" + viewData.Org.b0104 + "</a>";
                Response.Cookies["OrgID"].Value = id;
            }
            else
            {
                viewData.HtmlPage = "";
                viewData.Users = (from u in CQGJ.User select u).ToList();
            }

            return View("UserList", viewData);
        }
Beispiel #8
0
        /// <summary>
        /// 根据单位代码显示用户列表(包括下级单位)
        /// </summary>
        /// <param name="id"></param>
        public ActionResult TreeUserList(string id)
        {
            CQGJUserViewData viewData = new CQGJUserViewData();
            Bussiness.Global global = new CQGJ.Passport.Bussiness.Global();
            List<User> userlist = new List<User>();
            viewData.UsersInOrgs = new List<UsersInOrgs>();

            global.GetOrgUser(ref userlist, id);

            foreach (User u in userlist)
            {
                UsersInOrgs uio = (from uo in CQGJ.UsersInOrgs where uo.b0111 == id && uo.User.UserID == u.UserID select uo).First();
                viewData.UsersInOrgs.Add(uio);
            }
            viewData.Users = userlist;

            viewData.Org = (from b in CQGJ.b01
                            where b.b0111 == id
                            select b).First();
            viewData.HtmlPage2 = id;
            if (Response.Cookies["OrgID"] == null)
            {
                Response.Cookies.Add(new HttpCookie("OrgID"));
            }

            Response.Cookies["OrgID"].Value = id;
            viewData.HtmlPage = "<a href='/admin/orginfo/" + id + "'>" + viewData.Org.b0104 + "</a>";
            return View(viewData);
        }