Ejemplo n.º 1
0
        public static EntityData GetUserByStation(string stationCode)
        {
            EntityData data2;

            try
            {
                UserStrategyBuilder builder = new UserStrategyBuilder();
                builder.AddStrategy(new Strategy(UserStrategyName.StationCode, stationCode));
                string     queryString = builder.BuildMainQueryString() + builder.GetDefaultOrder();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("SystemUser", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string Value = Request.QueryString["Value"] + "";

            string UserCode = "";
            string UserName = "";
            string SortID   = "";
            string Hint     = "";
            string IsExists = "";

            if (Value != "")
            {
                //按工号查
                EntityData entity = DAL.EntityDAO.SystemManageDAO.GetSystemUserBySortID(Value);
                entity.Dispose();

                //按登录名查
                if (!entity.HasRecord())
                {
                    entity = DAL.EntityDAO.SystemManageDAO.GetSystemUserByUserID(Value);
                    entity.Dispose();
                }

                //按姓名查
                if (!entity.HasRecord())
                {
                    entity = DAL.EntityDAO.SystemManageDAO.GetSystemUserByUserName(Value);
                    entity.Dispose();
                }

                //按姓名模糊查
                if (!entity.HasRecord())
                {
                    UserStrategyBuilder sb = new UserStrategyBuilder();

                    sb.AddStrategy(new Strategy(UserStrategyName.UserName, "%" + Value + "%"));

                    string sql = sb.BuildMainQueryString();

                    sql = sql + sb.GetDefaultOrder();

                    QueryAgent qa = new QueryAgent();
                    qa.SetTopNumber(1);
                    entity = qa.FillEntityData("SystemUser", sql);
                    qa.Dispose();
                }

                if (entity.HasRecord())
                {
                    UserCode = entity.GetString("UserCode");
                    UserName = entity.GetString("UserName");
                    SortID   = entity.GetString("SortID");
                    IsExists = "1";
                }
                else
                {
                    Hint = "用户不存在 !";
                }
            }

            string sResult = "<Result>"
                             + "<UserCode>" + UserCode + "</UserCode>"
                             + "<UserName>" + UserName + "</UserName>"
                             + "<SortID>" + SortID + "</SortID>"
                             + "<Hint>" + Hint + "</Hint>"
                             + "<IsExists>" + IsExists + "</IsExists>"
                             + "</Result>";

            Response.Write(sResult);
            Response.End();
        }