Example #1
0
        public void GetDataPageMenuAll()
        {
            List <cGetDataPageMenuAll> menus = new List <cGetDataPageMenuAll>();
            //using (SqlConnection conn = new SqlConnection(cs))
            //{
            SqlCommand comm = new SqlCommand("spGetDataMenuAll", conn.OpenConn());

            comm.CommandType = CommandType.StoredProcedure;
            //conn.Open();

            SqlDataReader rdr = comm.ExecuteReader();

            while (rdr.Read())
            {
                cGetDataPageMenuAll menu = new cGetDataPageMenuAll();
                menu.mnu_type_id   = rdr["mnu_type_id"].ToString();
                menu.mnu_type_name = rdr["mnu_type_name"].ToString();
                menu.mnu_id        = rdr["mnu_id"].ToString();
                menu.mnu_page      = rdr["mnu_page"].ToString();
                menu.mnu_title     = rdr["mnu_title"].ToString();
                menu.mnu_seqno     = rdr["mnu_seqno"].ToString();

                menus.Add(menu);
            }
            //}
            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.ContentType = "application/json";
            Context.Response.Write(js.Serialize(menus));
            conn.CloseConn();
        }
Example #2
0
        public void GetDataMenuAllById(string mnuid)
        {
            string ssql = "select * from vwGetDataMenuAll WHERE 1=1 AND mnu_id = " + mnuid;
            List <cGetDataPageMenuAll> cGetDataPageMenus = new List <cGetDataPageMenuAll>();

            using (SqlConnection cons = new SqlConnection(constr))
            {
                SqlCommand comm = new SqlCommand(ssql, cons);
                comm.CommandType = CommandType.Text;
                cons.Open();

                SqlDataReader rdr = comm.ExecuteReader();
                while (rdr.Read())
                {
                    cGetDataPageMenuAll cGetDataPage = new cGetDataPageMenuAll();
                    cGetDataPage.mnu_type_id   = rdr["mnu_type_id"].ToString();
                    cGetDataPage.mnu_type_name = rdr["mnu_type_name"].ToString();
                    cGetDataPage.mnu_id        = rdr["mnu_id"].ToString();
                    cGetDataPage.mnu_page      = rdr["mnu_page"].ToString();
                    cGetDataPage.mnu_title     = rdr["mnu_title"].ToString();
                    cGetDataPage.mnu_seqno     = rdr["mnu_seqno"].ToString();

                    cGetDataPageMenus.Add(cGetDataPage);
                }

                JavaScriptSerializer js = new JavaScriptSerializer();
                Context.Response.ContentType = "application/json";
                Context.Response.Write(js.Serialize(cGetDataPageMenus));

                cons.Close();
            }
        }