Example #1
0
 public DataTable GetList(UserQueryModel model)
 {
     DataTable dt = null;
     if (model != null)
     {
         String sql = "SELECT U.ID, U.LOGINNAME, U.NAME, U.PHONE, U.STATUS,CASE U.STATUS WHEN 1 THEN '有效' ELSE '无效' END AS STA, S.NAME AS SNAME,U.PASSWORD,U.STOREID FROM BPSYS_USER U INNER JOIN BPSYS_STORE S ON U.STOREID = S.ID";
         sql += " WHERE 1=1";
         //where u.[Name] like '%%' or u.Phone ='' or s.[Name] like '%%'
         if (!String.IsNullOrEmpty(model.Name))
         {
             sql += String.Format(" AND U.NAME LIKE '%{0}%'", model.Name);
         }
         if (!String.IsNullOrEmpty(model.Phone))
         {
             sql += String.Format(" AND U.PHONE ='{0}'", model.Phone);
         }
         if (model.Store != null && model.Store != Guid.Empty)
         {
             sql += String.Format(" AND S.ID='{0}'", model.Store.ToString());
         }
         using (DataBaseProcess process=new DataBaseProcess())
         {
             dt = process.Query(sql);
         }
     }
     return dt;
 }
Example #2
0
 private void LoadData()
 {
     UserQueryModel model=new UserQueryModel();
     model.Name = textBoxQName.Text.TrimStart().TrimEnd();
     model.Phone = textBoxQPhone.Text.TrimStart().TrimEnd();
     if (comboBoxQStore.SelectedValue != null)
     {
         model.Store = Guid.Parse(comboBoxQStore.SelectedValue.ToString());
     }
     DataTable dt= _action.GetList(model);
     Bind(dt);
 }