public HttpResponseMessage DeviceDel([FromBody] ProjectAjax projectajax)
        {
            Db     db  = new Db();
            string sql = @"";

            var      ds  = db.QueryT(sql);
            Response res = new Response();

            res.code = 0;
            res.msg  = "";
            res.data = null;

            var resJsonStr = JsonConvert.SerializeObject(res);
            HttpResponseMessage resJson = new HttpResponseMessage
            {
                Content = new StringContent(resJsonStr, Encoding.GetEncoding("UTF-8"), "application/json")
            };

            return(resJson);
        }
示例#2
0
        public HttpResponseMessage ProjectSelect([FromBody] ProjectAjax projectajax)
        {
            Db       db  = new Db();
            Response res = new Response();
            Dictionary <string, object> data = new Dictionary <string, object>();

            //查询系统select
            string sql1 = @"
                SELECT
                A.SYSTEM_ID AS SYSTEM_ID,
                B.NAME AS SYSTEM_NAME
                FROM
                GDMS_USER_SYSTEM A
                LEFT JOIN GDMS_SYSTEM B ON A.SYSTEM_ID = B.ID
                WHERE A.USER_ID = '" + projectajax.userId + "'";
            var    ds1  = db.QueryT(sql1);
            Dictionary <string, string> dict1 = new Dictionary <string, string>();

            foreach (DataRow col in ds1.Rows)
            {
                dict1.Add(col["SYSTEM_ID"].ToString(), col["SYSTEM_NAME"].ToString());
            }
            data.Add("system", dict1);

            res.code = 0;
            res.msg  = "";
            res.data = data;

            var resJsonStr = JsonConvert.SerializeObject(res);
            HttpResponseMessage resJson = new HttpResponseMessage
            {
                Content = new StringContent(resJsonStr, Encoding.GetEncoding("UTF-8"), "application/json")
            };

            return(resJson);
        }
示例#3
0
        public HttpResponseMessage ProjectList([FromBody] ProjectAjax projectajax)
        {
            Db db = new Db();

            string where = "";
            if (projectajax.systemId != null)
            {
                where = where + " AND A.SYSTEM_ID = '" + projectajax.systemId + "'";
            }
            if (projectajax.keyword != null && projectajax.keyword.Length != 0)
            {
                where = where + "AND ( UPPER(A.DETAIL) LIKE '%" + projectajax.keyword.ToUpper() + "%' or UPPER(A.NAME) LIKE '%" + projectajax.keyword.ToUpper() + "%')";
            }
            string sqlnp = @"
                SELECT
                A.ID AS PROJECT_ID,
                A.NAME AS PROJECT_NAME,
                A.DETAIL,
                A.YEAR,
                A.USER_ID,
                A.EDIT_DATE,
                B.ID AS SYSTEM_ID,
                B.NAME AS SYSTEM_NAME
                FROM
                GDMS_PROJECT A
                LEFT JOIN GDMS_SYSTEM B ON A.SYSTEM_ID = B.ID
                WHERE A.SYSTEM_ID IN (SELECT SYSTEM_ID FROM GDMS_USER_SYSTEM WHERE USER_ID = '" + projectajax.userId + "') " + where;

            int       limit1 = (projectajax.page - 1) * projectajax.limit + 1;
            int       limit2 = projectajax.page * projectajax.limit;
            string    sql    = "SELECT * FROM(SELECT p1.*,ROWNUM rn FROM(" + sqlnp + ")p1)WHERE rn BETWEEN " + limit1 + " AND " + limit2;
            var       ds     = db.QueryT(sql);
            Response  res    = new Response();
            ArrayList data   = new ArrayList();

            foreach (DataRow col in ds.Rows)
            {
                Dictionary <string, string> dict = new Dictionary <string, string>
                {
                    { "PROJECT_ID", col["PROJECT_ID"].ToString() },
                    { "PROJECT_NAME", col["PROJECT_NAME"].ToString() },
                    { "DETAIL", col["DETAIL"].ToString() },
                    { "YEAR", col["YEAR"].ToString() },
                    { "USER_ID", col["USER_ID"].ToString() },
                    { "EDIT_DATE", col["EDIT_DATE"].ToString() },
                    { "SYSTEM_ID", col["SYSTEM_ID"].ToString() },
                    { "SYSTEM_NAME", col["SYSTEM_NAME"].ToString() },
                };

                data.Add(dict);
            }

            string sql2 = @"
                SELECT
                COUNT(*) AS COUNT
                FROM
                GDMS_PROJECT A
                LEFT JOIN GDMS_SYSTEM B ON A.SYSTEM_ID = B.ID
                WHERE A.SYSTEM_ID IN (SELECT SYSTEM_ID FROM GDMS_USER_SYSTEM WHERE USER_ID = '" + projectajax.userId + "') " + where;
            var    ds2  = db.QueryT(sql2);

            foreach (DataRow col in ds2.Rows)
            {
                res.count = col["count"].ToString();
            }

            res.code = 0;
            res.msg  = "";
            res.data = data;

            var resJsonStr = JsonConvert.SerializeObject(res);
            HttpResponseMessage resJson = new HttpResponseMessage
            {
                Content = new StringContent(resJsonStr, Encoding.GetEncoding("UTF-8"), "application/json")
            };

            return(resJson);
        }