Exemple #1
0
        private void BindData()
        {
            signature = QYAPI.HttpUtility.EncryptToSHA1("jsapi_ticket=" + jsticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + Request.Url.ToString());

            string url = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token=" + QYAPI.API_Token.AccessToken + "&department_id=3&fetch_child=0&status=1";
            string result = QYAPI.HttpUtility.GetData(url);

            StringReader sr = new StringReader(result);
            JsonSerializer serializer = new JsonSerializer();
            UserList ulist = (UserList)serializer.Deserialize(new JsonTextReader(sr), typeof(UserList));

            this.sel_S.Items.Clear();
            if (ulist.errcode == "0")
            {
                this.sel_S.Items.Add(new ListItem("请选择", ""));
                foreach (User u in ulist.userlist)
                {
                    this.sel_S.Items.Add(new ListItem(u.name, u.userid));
                }
            }

            DataBaseHelper dbHelper = new DataBaseHelper(ConfigurationManager.ConnectionStrings["DB"].ToString());
            DataTable dtMarkType = dbHelper.ExecuteDataTable("select * from T_MarkType");
            this.sel_Program.Items.Clear();
            this.sel_Program.Items.Add(new ListItem("请选择", ""));
            foreach (DataRow dr in dtMarkType.Rows) {
                this.sel_Program.Items.Add(new ListItem(dr["TypeName"].ToString(), dr["TypeID"].ToString()));
            }
            dbHelper.Dispose();
        }
 public string GetMarkByType(string ID)
 {
     DataBaseHelper dbHelper = new DataBaseHelper(ConfigurationManager.ConnectionStrings["DB"].ToString());
     DataTable dt = dbHelper.ExecuteDataTable("select * from T_Marks where TypeID = " + ID);
     string strValue = string.Empty;
     foreach (DataRow dr in dt.Rows)
     {
         strValue += dr["ID"].ToString() + "," + dr["Name"].ToString() + "|";
     }
     return strValue.TrimEnd('|');
 }