Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["url"] != null && Request.QueryString["OrgID"] != null)
     {
         string url = Request.QueryString["url"].ToString();
         string OrgID = Request.QueryString["OrgID"].ToString();
         if (url.Trim() != "" && OrgID.Trim() != "")
         {
             CQGJPassportEntities cqgj = new CQGJPassportEntities();
             bool worry = false;
             try
             {
                 b01 Org = (from b in cqgj.b01 from be in cqgj.b01Expansion where be.b01 == b && b.b0111 == OrgID select b).First();
                 b01Expansion OrgE = (from be in cqgj.b01Expansion where be.b01.b0111 == OrgID select be).First();
                 Session["OrgType"] = OrgE.OrgType;
                 Session["OrgID"] = Org.b0111;
                 Session["Org"] = Org;
             }
             catch
             {
                 worry = true;
             }
             if (worry)
             {
                 string strLoginUrl = ConfigurationManager.AppSettings["Orglogin"].ToString();
                 Response.Redirect(strLoginUrl);
             }
             Response.Redirect(url);
         }
     }
 }
Ejemplo n.º 2
0
 public User GetCQGJUser(int iUserID)
 {
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     List<User> Querry = (from u in CQGJ.User where u.UserID == iUserID select u).ToList();
     if (Querry.Count() > 0)
     {
         return Querry.First();
     }
     return null;
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CQGJPassportEntities cqgj = new CQGJPassportEntities();
            if (Request.QueryString["ID"] != null)
            {
                if (Request.QueryString["userID"] != null)
                {
                    int iID = int.Parse(Request.QueryString["userID"].ToString());
                    User usertemp = (from u in cqgj.User where u.UserID == iID select u).First();
                    Session["userobject"] = usertemp;
                }
                if (Request.QueryString["orgID"] != null)
                {
                    string orgID = (Request.QueryString["orgID"].ToString());
                    b01 orgtemp = (from b in cqgj.b01 where b.b0111 == orgID select b).First();
                    Session["Org"] = orgtemp;
                }
                try
                {
                    if (Session["userobject"] != null || Session["Org"] != null)
                    {
                        int iID = int.Parse(Request.QueryString["ID"].ToString());
                        User user;
                        user = new User();

                        user = (from u in cqgj.User where u.UserID == iID select u).First();
                        Response.ContentType = user.PhotoType;
                        Response.BinaryWrite((byte[])user.Photo);
                    }
                    else
                    {
                        System.Configuration.AppSettingsSection apsetting = new AppSettingsSection();
                        string str = apsetting.Settings["ssologin"].ToString();
                        Response.Redirect(str + "?url=" + System.Web.HttpUtility.UrlEncode(Request.Url.ToString()));
                    }
                }
                catch
                {
                }

            }
        }
Ejemplo n.º 4
0
        public bool AddOrg(b01 org, b01Expansion orge)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            orge.b01 = org;
            if (org.b0111 == orge.b01.b0111)
            {
                try
                {
                    CQGJ.AddTob01(org);
                    CQGJ.AddTob01Expansion(orge);

                    CQGJ.SaveChanges();
                    return true;
                }
                catch
                {

                }

            }
            return false;
        }
Ejemplo n.º 5
0
        public void GetAllOwnedOrgOnelevel(ref List<b01> OrgList, string orgCode)
        {
            try
            {
                CQGJPassportEntities CQGJ = new CQGJPassportEntities();
                List<b01> OrgListTemp = new List<b01>();
                OrgListTemp = (from b in CQGJ.b01 where (b.b0111.Length > 14 && b.b0111.Substring(0, 14) == orgCode) || b.b0111_3 == orgCode select b).ToList(); //单位级别
                for (int i = 0; i < OrgListTemp.Count; ++i)
                {
                    OrgList.Add(OrgListTemp[i]);
                }

            }
            catch
            {
            }
        }
Ejemplo n.º 6
0
        public string ValidateUserXml(string APXml)
        {
            Global glolalClass = new Global();
            string strUserNameTag = "UserName";
            string strUserPassTag = "Password";
            string strUserIDTag = "UserID";
            string strUserName = "";
            string strUserPass = "";
            string strUserID = "";
            string strApcodeTag = "Apcode";
            string strAdminTag = "Admin";
            string strAdmin = "";
            string strAPcode = "";
            string Result = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Result></Result>";
            string ResultSuccessTag = "success";
            string ResultCode = "";//0为成功,-1为不存在此用户,-2密码错误,-3失败
            try
            {
                strAPcode = glolalClass.GetSingleTagValue(APXml, strApcodeTag);
            }
            catch
            {
                ResultCode = "-3";
                return glolalClass.CreateSingleTag(Result, ResultSuccessTag, ResultCode);
            }

            System.Configuration.AppSettingsSection apsetting = new AppSettingsSection();
            string[] strApsetingName = ConfigurationManager.AppSettings.AllKeys;
            ;
            bool RightAP = false;
            for (int i = 0; i < ConfigurationManager.AppSettings.Count; i++)
            {
                string strAPsetting = ConfigurationManager.AppSettings[strApsetingName[i]].ToString();
                if (strAPsetting.Equals(strAPcode.Trim()))
                {
                    RightAP = true;
                    i = ConfigurationManager.AppSettings.Count;
                }
            }
            if (!RightAP)
            {
                ResultCode = "-3";
                return glolalClass.CreateSingleTag(Result, ResultSuccessTag, ResultCode);
            }
            else
            {
                try
                {
                    strUserName = glolalClass.GetSingleTagValue(APXml, strUserNameTag);
                    strUserPass = glolalClass.GetSingleTagValue(APXml, strUserPassTag);
                    CQGJPassportEntities CQGJE = new CQGJPassportEntities();
                    var Querry = from u in CQGJE.User
                                 where u.Username == strUserName.Trim()
                                 select u;
                    List<User> ListUser = Querry.ToList();
                    if (ListUser.Count() > 0)
                    {
                        if (ListUser.First().Password == strUserPass.Trim())
                        {
                            ResultCode = "0";
                            strUserID = ListUser.First().UserID.ToString();
                            string strXMl = glolalClass.CreateSingleTag(Result, ResultSuccessTag, ResultCode);
                            strXMl = glolalClass.CreateSingleTag(strXMl, strUserIDTag, strUserID);
                            //strXMl = glolalClass.CreateSingleTag(strXMl, strAdminTag, ListUser.First().ad);
                            return strXMl;
                        }
                        else
                        {
                            ResultCode = "-2";
                            return glolalClass.CreateSingleTag(Result, ResultSuccessTag, ResultCode);
                        }
                    }
                    else
                    {
                        ResultCode = "-1";
                        return glolalClass.CreateSingleTag(Result, ResultSuccessTag, ResultCode);
                    }
                }
                catch
                {
                    ResultCode = "-3";
                    return glolalClass.CreateSingleTag(Result, ResultSuccessTag, ResultCode);
                }

            }
        }
Ejemplo n.º 7
0
        public string GetOrgCodeOfUser(int userID, bool isAdmin)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            List<b01> org = new List<b01>();
            //try
            //{
                if (isAdmin == true)
                {
                    UsersInOrgs UO = (from uo in CQGJ.UsersInOrgs
                                      where uo.User.UserID == userID
                                      select uo).First();

                    org = (from o in CQGJ.b01
                           where o.b0111 == UO.b0111
                           select o).ToList();
                }
                else
                {
                    org = (from u in CQGJ.User
                           from uo in CQGJ.UsersInOrgs
                           from b in CQGJ.b01
                           where u.UserID == userID
                           where uo.User == u
                           where uo.b0111 == b.b0111
                           select b).ToList();
                }
                if (org.Count() > 0)
                {
                    return org.First().b0111;
                }
            //}
            //catch
            //{ }
            return "";
        }
Ejemplo n.º 8
0
        public string ValidateOrg(string orgname, string password)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            b01 Querry = new b01();
            string strResult = "";
            try
            {
                Querry = (from b in CQGJ.b01 where (b.b0101 == orgname || b.b0104 == orgname) select b).First();
                strResult = Querry.b0111;
            }
            catch
            {
                strResult = "";
            }
            if (strResult.Equals(""))
            {
                return strResult;
            }
            else
            {
                b01Expansion OrgOtherInfo = new b01Expansion();
                try
                {
                    OrgOtherInfo = (from i in CQGJ.b01Expansion where i.b01.b0111 == strResult && i.Password == password select i).First();
                }
                catch
                {
                    strResult = "";

                }
            }
            return strResult;
        }
Ejemplo n.º 9
0
 public User ValidateUser(string username, string password)
 {
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     User Querry = new User();
     try
     {
         Querry = (from u in CQGJ.User where u.Username == username && u.Password == password select u).First();
     }
     catch
     {
         Querry = null;
     }
     return Querry;
 }
Ejemplo n.º 10
0
        public b01Expansion GetOrgEx(string OrgExID)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            try
            {
                int iOrgExID = int.Parse(OrgExID);
                b01Expansion orgEx = (from c in CQGJ.b01Expansion
                                      where c.ID == iOrgExID && c.OrgType == 3
                                      select c).First();
                return orgEx;
            }
            catch
            {

            }
            return null;
        }
Ejemplo n.º 11
0
 public b01 GetOrg(string orgCode)
 {
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     try
     {
         b01 org = (from b in CQGJ.b01 where b.b0111 == orgCode select b).First();
         return org;
     }
     catch
     {
     }
     return null;
 }
Ejemplo n.º 12
0
        public void CreateAllOwnedOrgHtml(ref string OrgHtml, string orgCode, string urlPath)
        {
            try
            {
                CQGJPassportEntities CQGJ = new CQGJPassportEntities();
                List<b01> OrgListTemp = new List<b01>();
                List<Area> AreaList = new List<Area>();
                b01 Org = new b01();
                Area area = new Area();

                if (orgCode == "")
                {
                    //重庆市直属单位
                    OrgListTemp = (from b in CQGJ.b01
                                   where b.b0111.Length == 14
                                   where (b.b0111_3 == null || b.b0111_3 == "")
                                   where b.b0117 == "50000000"
                                   select b).ToList();
                    //重庆市各辖区
                    AreaList = (from a in CQGJ.Area
                                where a.AreaType == 2
                                select a).ToList();

                    //Org = (from b in CQGJ.b01
                    //       where b.b0111 == "50000000100016"
                    //       select b).First();
                }
                else if (orgCode.Length == 8)
                {
                    //构造某一辖区下一级单位
                    OrgListTemp = (from b in CQGJ.b01
                                   where b.b0117 == orgCode
                                   where b.b0111.Length == 14
                                   where (b.b0111_3 == null || b.b0111_3 == "")
                                   select b).ToList();
                    //Org = (from b in CQGJ.b01
                    //       where b.b0111 == "50010100100001"
                    //       select b).First();
                    area = (from a in CQGJ.Area
                            where a.AreaCode == orgCode
                            select a).FirstOrDefault();
                }
                else
                {

                    OrgListTemp = (from b in CQGJ.b01
                                   where (b.b0111.Length == 16 && b.b0111.Substring(0, 14) == orgCode) || (b.b0111_3 == orgCode)
                                   select b).ToList();
                    Org = (from b in CQGJ.b01
                           where b.b0111 == orgCode
                           select b).First();
                }

                if (OrgListTemp.Count == 0)
                {
                    OrgHtml += "<li><span class='file'><a target='passportmainFrame' href='/admin/" + urlPath + "/" + Org.b0111 + "' >"
                            + Org.b0104 + "</a></span></li>";
                    return;
                }
                else
                {
                    //普通单位
                    if (orgCode.Length == 14)
                    {
                        string htmlTemp = "";
                        OrgHtml += "<li><span class='folder'><a target='passportmainFrame' href='/admin/" + urlPath + "/" + Org.b0111 + "' >"
                                + Org.b0104 + "</a></span>";
                        if (OrgHtml != "")
                        {
                            //iCount ++;
                            //OrgHtml += "<ul id='folder2" + iCount.ToString() + ">";
                            OrgHtml += "<ul>";
                            htmlTemp = "</ul>";
                        }
                        for (int i = 0; i < OrgListTemp.Count; ++i)
                        {
                            CreateAllOwnedOrgHtml(ref OrgHtml, OrgListTemp[i].b0111, urlPath);
                        }
                        OrgHtml += htmlTemp;
                        OrgHtml += "</li>";
                    }
                    //市辖区
                    else if (orgCode.Length == 8)
                    {
                        string htmlTemp = "";
                        OrgHtml += "<li><span class='folder'>" + area.AreaName + "</span>";
                        if (OrgHtml != "")
                        {
                            OrgHtml += "<ul>";
                            htmlTemp = "</ul>";
                        }
                        for (int i = 0; i < OrgListTemp.Count; ++i)
                        {
                            CreateAllOwnedOrgHtml(ref OrgHtml, OrgListTemp[i].b0111, urlPath);
                        }
                        OrgHtml += htmlTemp;
                        OrgHtml += "</li>";
                    }
                    //重庆市
                    else if (orgCode.Length == 0)
                    {
                        for (int i = 0; i < OrgListTemp.Count; ++i)
                        {
                            CreateAllOwnedOrgHtml(ref OrgHtml, OrgListTemp[i].b0111, urlPath);
                        }
                    }
                }

                //生成各辖区节点代码
                if (AreaList.Count != 0)
                {
                    string htmlTemp = "";

                    OrgHtml += "<li><span class='folder'>市辖区</a></span>";
                    if (OrgHtml != "")
                    {
                        //iCount ++;
                        //OrgHtml += "<ul id='folder2" + iCount.ToString() + ">";
                        OrgHtml += "<ul>";
                        htmlTemp = "</ul>";
                    }
                    for (int i = 0; i < AreaList.Count; ++i)
                    {
                        CreateAllOwnedOrgHtml(ref OrgHtml, AreaList[i].AreaCode, urlPath);
                    }
                    OrgHtml += htmlTemp;
                    OrgHtml += "</li>";
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 取得用户的单位列表
        /// </summary>
        /// <param name="orgList">用户单位列表</param>
        /// <param name="UserID">用户ID</param>
        public void GetUserOrg(ref List<b01> orgList, int UserID)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            List<UsersInOrgs> UserOrgListTemp = (from uo in CQGJ.UsersInOrgs where uo.User.UserID == UserID select uo).ToList();
            for (int i = 0; i < UserOrgListTemp.Count; ++i)
            {
                string strOrgID = UserOrgListTemp[i].b0111;

                b01 org = (from o in CQGJ.b01 where o.b0111 == strOrgID select o).First();
                orgList.Add(org);
            }
            if (UserOrgListTemp.Count == 0)
            {
                return;
            }
        }
Ejemplo n.º 14
0
 public List<SchoolRecord> GetSchoolRecordByUserID(int userID)
 {
     if (userID != 0)
     {
         CQGJPassportEntities CQGJ = new CQGJPassportEntities();
         List<SchoolRecord> tempList = (from c in CQGJ.SchoolRecord
                                        where c.User.UserID == userID && c.Sign == 1
                                        select c).ToList();
         return tempList;
     }
     else
     {
         return null;
     }
 }
Ejemplo n.º 15
0
 public void GetOrgUser(ref List<User> UserList, string orgCode)
 {
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     List<UsersInOrgs> UserOrgListTemp = (from uo in CQGJ.UsersInOrgs where uo.b0111 == orgCode select uo).ToList();
     for (int i = 0; i < UserOrgListTemp.Count; ++i)
     {
         int userID = 0;
         try
         {
             userID = int.Parse(UserOrgListTemp[i].UserReference.EntityKey.EntityKeyValues.First().Value.ToString());
         }
         catch
         {
         }
         User user = (from u in CQGJ.User where u.UserID == userID select u).First();
         UserList.Add(user);
     }
     if (UserOrgListTemp.Count == 0)
     {
         return;
     }
 }
Ejemplo n.º 16
0
 public List<b01> GetSchoolOrglist()
 {
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     try
     {
         List<b01> org = (from b in CQGJ.b01 from be in CQGJ.b01Expansion where b == be.b01 && be.OrgType == 3 select b).ToList();
         return org;
     }
     catch
     {
     }
     return null;
 }
Ejemplo n.º 17
0
 public List<User> GetOwnedOrgUserList(string orgCode, bool ContentOrg)
 {
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     List<b01> orgList = new List<b01>();
     List<User> userList = new List<User>();
     Global globa = new Global();
     globa.GetAllOwnedOrg(ref orgList, orgCode);
     if (ContentOrg)
     {
         try
         {
             b01 org = (from b in CQGJ.b01 where b.b0111 == orgCode select b).First();
             orgList.Add(org);
         }
         catch
         {
             return null;
         }
     }
     for (int i = 0; i < orgList.Count; i++)
     {
         globa.GetOrgUser(ref userList, orgList[i].b0111);
     }
     return userList;
 }
Ejemplo n.º 18
0
        public string GetOrgType(string orgcode)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            b01Expansion OrgOtherInfo = new b01Expansion();
            string strResult = "";
            try
            {
                OrgOtherInfo = (from i in CQGJ.b01Expansion where i.b01.b0111 == orgcode select i).First();
                strResult = OrgOtherInfo.OrgType.ToString();
            }
            catch
            {
                strResult = "";

            }
            return strResult;
        }
Ejemplo n.º 19
0
        public List<b01> GetOrgListByType(int iType)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            try
            {
                string type = iType.ToString();
                List<b01> org = (from c in CQGJ.b01
                                 where c.b01224 == type
                                 select c).ToList();
                return org;
            }
            catch
            {

            }
            return null;
        }
Ejemplo n.º 20
0
        public b01Expansion GetOrgExStr(string OrgCode)
        {
            CQGJPassportEntities CQGJ = new CQGJPassportEntities();
            try
            {
                b01Expansion orgEx = (from c in CQGJ.b01Expansion
                                      where c.b01.b0111 == OrgCode && c.OrgType == 3
                                      select c).First();
                return orgEx;
            }
            catch
            {

            }
            return null;
        }
Ejemplo n.º 21
0
        public void GetUpOrg(ref List<b01> OrgList, string orgCode)
        {
            try
            {
                CQGJPassportEntities CQGJ = new CQGJPassportEntities();
                List<b01> OrgListTemp = new List<b01>();
                b01 Org = (from o in CQGJ.b01 where o.b0111 == orgCode select o).First();
                OrgListTemp = (from b in CQGJ.b01 where (b.b0111.Length == 14 && b.b0111 == orgCode.Substring(0, 14) && b.b0111 != orgCode) || (Org.b0111_3 == b.b0111) select b).ToList(); //单位级别
                for (int i = 0; i < OrgListTemp.Count; ++i)
                {
                    OrgList.Add(OrgListTemp[i]);
                    GetUpOrg(ref OrgList, OrgListTemp[i].b0111);
                }
                if (OrgListTemp.Count == 0)
                {
                    return;
                }

            }
            catch
            {
            }
        }
Ejemplo n.º 22
0
        public List<User> GetUserListOwnRole()
        {
            CQGJPassportEntities CQGJPassport = new CQGJPassportEntities();
            List<int> usersID = (from u in CQGJPassport.UsersInRoles select (int)u.User.UserID).Distinct().ToList();
            List<User> users = new List<User>();

            foreach (int id in usersID)
            {
                User user = new User();

                user = GetCQGJUser(id);

                users.Add(user);
            }

            return users;
        }
Ejemplo n.º 23
0
 public b01 GetUpOrgOnelevel(string orgCode)
 {
     try
     {
         CQGJPassportEntities CQGJ = new CQGJPassportEntities();
         List<b01> OrgListTemp = new List<b01>();
         b01 Org = (from o in CQGJ.b01 where o.b0111 == orgCode select o).First();
         OrgListTemp = (from b in CQGJ.b01 where (b.b0111.Length == 14 && b.b0111 == orgCode.Substring(0, 14) && b.b0111 != orgCode) || (Org.b0111_3 == b.b0111) select b).ToList(); //单位级别
         if (OrgListTemp.Count > 0)
         {
             return OrgListTemp.First();
         }
     }
     catch
     {
     }
     return null;
 }
Ejemplo n.º 24
0
        public bool SavaUserChange(User user)
        {
            try
            {
                int userID = user.UserID;
                CQGJPassportEntities CQGJ = new CQGJPassportEntities();
                User localUser = (from c in CQGJ.User
                                  where c.UserID == userID
                                  select c).First();

                localUser.Username = user.Username;
                localUser.Gender = user.Gender;
                localUser.Nation = user.Nation;
                localUser.Birthday = user.Birthday;
                localUser.Politics = user.Politics;
                localUser.IDCard = user.IDCard;
                localUser.WorkTel = user.WorkTel;
                localUser.Cellphone = user.Cellphone;
                localUser.Position = user.Position;
                localUser.JoinWorkDate = user.JoinWorkDate;
                localUser.Remark = user.Remark;
                localUser.Status = user.Status;
                localUser.Class = user.Class;
                localUser.RelationsCode = user.RelationsCode;
                localUser.RelationsName = user.RelationsName;
                localUser.Photo = user.Photo;
                localUser.PhotoType = user.PhotoType;
                CQGJ.SaveChanges();
                return true;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 25
0
 public bool IsUpOrg(b01 b, string orgCode)
 {
     try
     {
         CQGJPassportEntities CQGJ = new CQGJPassportEntities();
         b01 Org = (from o in CQGJ.b01 where o.b0111 == orgCode select o).First();
         if ((b.b0111.Length == 14 && b.b0111 == orgCode.Substring(0, 14)) || (Org.b0111_3 == b.b0111))
         {
             return true;
         }
     }
     catch
     {
         return false;
     }
     return false;
 }
Ejemplo n.º 26
0
 public bool SaveOrgChange(b01 Org, b01Expansion OrgEx)
 {
     OrgEx.b01 = Org;
     CQGJPassportEntities CQGJ = new CQGJPassportEntities();
     b01 newOrg = (from c in CQGJ.b01
                   where c.b0111 == Org.b0111
                   select c).First();
     b01Expansion newOrgEx = (from d in CQGJ.b01Expansion
                              where d.ID == OrgEx.ID
                              select d).First();
     newOrg.b0101 = Org.b0101;
     newOrgEx.Mail = OrgEx.Mail;
     newOrgEx.Mobile = OrgEx.Mobile;
     newOrgEx.Tel = OrgEx.Tel;
     if (newOrgEx.b01==newOrg)
     {
         int i= CQGJ.SaveChanges();
         return true;
     }
     return false;
 }
Ejemplo n.º 27
0
 public bool SavePswChange(int userID, string Password)
 {
     if (userID != 0 && Password != "")
     {
         try
         {
             CQGJPassportEntities cqgj = new CQGJPassportEntities();
             User user = (from c in cqgj.User
                          where c.UserID == userID
                          select c).First();
             user.Password = CQGJ.Core.Security.MD5Encrypt(Password);
             cqgj.SaveChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
     return false;
 }
Ejemplo n.º 28
0
 public List<EduLevel> GetEduLevelByUserID(int userID)
 {
     if (userID != 0)
     {
         CQGJPassportEntities CQGJ = new CQGJPassportEntities();
         List<EduLevel> tempList = (from c in CQGJ.User
                                    from e in CQGJ.EduLevel
                                    where c.UserID == userID && e.Sign==1
                                    select e).ToList();
         return tempList;
     }
     else
     {
         return null;
     }
 }