當前位置: 首頁>>代碼示例>>C#>>正文


C# Model.BaseInfo類代碼示例

本文整理匯總了C#中WeiXin.Tools.Model.BaseInfo的典型用法代碼示例。如果您正苦於以下問題:C# BaseInfo類的具體用法?C# BaseInfo怎麽用?C# BaseInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BaseInfo類屬於WeiXin.Tools.Model命名空間,在下文中一共展示了BaseInfo類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BtnCreate_Click

 /// <summary>
 ///  創建自定義菜單
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-16 10:51:11
 private void BtnCreate_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     string accessToken = _baseInfo.AccessToken;
     if (string.IsNullOrEmpty(accessToken))
     {
         MessageBox.Show("請先獲取Access_Token!");
     }
     else
     {
         if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
         {
             if (string.IsNullOrEmpty(MenuCreate.Text))
             {
                 MessageBox.Show("不能創建空菜單!");
                 return;
             }
             ShowPrgCreate();
             CreateMenu(accessToken);
             HidePrgCreate();
             return;
         }
         MessageBox.Show("Access_Token已經過期,請重新獲取!");
     }
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:31,代碼來源:1418438915$startform.cs

示例2: BtnAccessToken_Click

 /// <summary>
 ///  獲取access_token
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 10:09:03
 private void BtnAccessToken_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     //判access_token是否過期
     if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
     {
         MessageBox.Show("該access_token沒有過期,不需要重新獲取!");
         return;
     }
     ShowProgress();
     TxtAccessToken.Text = "";
     RequestAccessToken();
     HideProgress();
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:20,代碼來源:1418438884$startform.cs

示例3: UpdateBaseInfo

 /// <summary>
 ///  更新
 /// </summary>
 /// <param name="info">實體類</param>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-20 09:51:11
 public static bool UpdateBaseInfo(BaseInfo info)
 {
     StringBuilder sb = new StringBuilder();
     if (info.Url != null)
     {
         sb.AppendFormat("Url='{0}',", info.Url);
     }
     if (info.Token != null)
     {
         sb.AppendFormat("Token='{0}',", info.Token);
     }
     if (info.Appid != null)
     {
         sb.AppendFormat("Appid='{0}',", info.Appid);
     }
     if (info.Appsecret != null)
     {
         sb.AppendFormat("Appsecret='{0}',", info.Appsecret);
     }
     if (info.AccessToken != null)
     {
         sb.AppendFormat("AccessToken='{0}',", info.AccessToken);
     }
     if (info.StartDateTime != null)
     {
         sb.AppendFormat("StartDateTime='{0}',", info.StartDateTime);
     }
     if (info.EndDateTime != null)
     {
         sb.AppendFormat("EndDateTime='{0}',", info.EndDateTime);
     }
     if (info.TimeSpace != null)
     {
         sb.AppendFormat("TimeSpace='{0}',", info.TimeSpace);
     }
     string content = sb.ToString().Trim(',');
     string sql = string.Format("Update Base_Info Set {0} where Id={1}", content, info.Id);
     int i = SqLiteHelper.ExecuteSql(sql);
     return i == 1;
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:47,代碼來源:1414052864$BaseInfoDao.cs

示例4: RequestAccessToken

 /// <summary>
 ///  重新獲取access_token
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 15:01:17
 private void RequestAccessToken()
 {
     _baseInfo = GetBaseInfo();
     string url = string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", _baseInfo.Appid, _baseInfo.Appsecret);
     string json = PublicFun.RequestGetData(url);
     AccessTokens tokens = json.ResolveJson();
     if (tokens.access_token != null)
     {
         //獲取成功,寫入信息
         TxtAccessToken.Text = tokens.access_token;
         BaseInfo info = new BaseInfo();
         DateTime start = DateTime.Now;
         DateTime end = start.AddSeconds(Convert.ToDouble(_baseInfo.TimeSpace));
         info.Id = _baseInfo.Id;
         info.StartDateTime = start.ToString("yyyy-MM-dd HH:mm:ss");
         info.EndDateTime = end.ToString("yyyy-MM-dd HH:mm:ss");
         info.AccessToken = TxtAccessToken.Text;
         BaseInfoDao.UpdateBaseInfo(info);
         //更新緩存
         _cacheBaseInfo.Remove(PublicFileds.BaseInfo);
         _cacheBaseInfo.Insert(PublicFileds.BaseInfo, BaseInfoDao.SelectBaseInfo(info.Id));
     }
     else
     {
         MessageBox.Show("獲取失敗!!!");
     }
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:33,代碼來源:1418433245$startform.cs

示例5: GetBaseInfo

 /// <summary>
 ///  獲取緩存實體類
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-20 12:36:39
 private BaseInfo GetBaseInfo()
 {
     _baseInfo = (BaseInfo)_cacheBaseInfo.Get(PublicFileds.BaseInfo);
     if (_baseInfo.Id > 0)
     {
         _baseInfo = BaseInfoDao.SelectBaseInfo(PublicFileds.UserName);
     }
     return _baseInfo;
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:15,代碼來源:1418433245$startform.cs

示例6: BtnUpload_Click

 /// <summary>
 ///  上傳多媒體文件到服務器
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-18 11:07:34
 private void BtnUpload_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     if (string.IsNullOrEmpty(TxtUploadUrl.Text))
     {
         MessageBox.Show("請先選擇需要上傳的多媒體文件!");
         return;
     }
     if (PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
     {
         MessageBox.Show("Access_Token已經過期,請重新獲取!");
         return;
     }
     ShowPrgUpload();
     DoUpAndDown upAndDown = DoUploadFile;
     upAndDown.BeginInvoke(_baseInfo.AccessToken, AsyncCallbackUpload, upAndDown);
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:23,代碼來源:1418433245$startform.cs

示例7: BtnSelect_Click

 /// <summary>
 ///  查詢自定義菜單
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-16 10:16:33
 private void BtnSelect_Click(object sender, EventArgs e)
 {
     //獲取數據
     _baseInfo = GetBaseInfo();
     string accessToken = _baseInfo.AccessToken;
     if (string.IsNullOrEmpty(accessToken))
     {
         MessageBox.Show("請先獲取Access_Token!");
     }
     else
     {
         if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
         {
             ShowPrgSelect();
             DoSelectCustomMenu selectCustomMenu = SelectMenu;
             selectCustomMenu.BeginInvoke(accessToken, AsyncCallbackSelect, selectCustomMenu);
             return;
         }
         MessageBox.Show("Access_Token已經過期,請重新獲取!");
     }
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:27,代碼來源:1418433245$startform.cs

示例8: BtnSave_Click

 /// <summary>
 ///  保存配置
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 09:45:11
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TxtUrl.Text) || string.IsNullOrEmpty(TxtToken.Text) ||
         string.IsNullOrEmpty(TxtAppId.Text) || string.IsNullOrEmpty(TxtAppSecret.Text))
     {
         MessageBox.Show("配置不能為空!!!");
     }
     else
     {
         _baseInfo = new BaseInfo();
         _baseInfo.Id = GetBaseInfo().Id;
         _baseInfo.Url = TxtUrl.Text;
         _baseInfo.Token = TxtToken.Text;
         _baseInfo.Appid = TxtAppId.Text;
         _baseInfo.Appsecret = TxtAppSecret.Text;
         if (BaseInfoDao.UpdateBaseInfo(_baseInfo))
         {
             MessageBox.Show("保存成功!");
             //更新緩存
             _cacheBaseInfo.Remove(PublicFileds.BaseInfo);
             _cacheBaseInfo.Insert(PublicFileds.BaseInfo, BaseInfoDao.SelectBaseInfo(_baseInfo.Id));
             return;
         }
         MessageBox.Show("保存失敗!");
     }
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:32,代碼來源:1418433245$startform.cs

示例9: BtnCreate_Click

 /// <summary>
 ///  創建自定義菜單
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-16 10:51:11
 private void BtnCreate_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     string accessToken = _baseInfo.AccessToken;
     if (string.IsNullOrEmpty(accessToken))
     {
         MessageBox.Show("請先獲取Access_Token!");
     }
     else
     {
         if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
         {
             if (string.IsNullOrEmpty(MenuCreate.Text))
             {
                 MessageBox.Show("不能創建空菜單!");
                 return;
             }
             ShowPrgCreate();
             DoCreateCustomMenu createCustomMenu = CreateMenu;
             createCustomMenu.BeginInvoke(accessToken, AsyncCallbackCreate, createCustomMenu);
             return;
         }
         MessageBox.Show("Access_Token已經過期,請重新獲取!");
     }
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:31,代碼來源:1418433245$startform.cs

示例10: BtnAccessToken_Click

 /// <summary>
 ///  獲取access_token
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 10:09:03
 private void BtnAccessToken_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     //判access_token是否過期
     if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
     {
         MessageBox.Show("該access_token沒有過期,不需要重新獲取!");
         return;
     }
     ShowProgress();
     TxtAccessToken.Text = "";
     DoRequestAccessToken invote = RequestAccessToken;
     invote.BeginInvoke(new Action(() => HidePrgCreate()),invote);
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:20,代碼來源:1418433245$startform.cs

示例11: BtnAccessToken_Click

 /// <summary>
 ///  獲取access_token
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 10:09:03
 private void BtnAccessToken_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     //判access_token是否過期
     if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
     {
         MessageBox.Show("該access_token沒有過期,不需要重新獲取!");
         return;
     }
     SetDelege();
     /*Thread t=new Thread(new ThreadStart(SetDelege));
     t.IsBackground = true;
     t.Start();*/
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:20,代碼來源:1418436585$startform.cs

示例12: BtnAccessToken_Click

 /// <summary>
 ///  獲取access_token
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 10:09:03
 private void BtnAccessToken_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     //判access_token是否過期
     if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
     {
         MessageBox.Show("該access_token沒有過期,不需要重新獲取!");
         return;
     }
     ShowProgress();
     DoRequestAccessToken invote = RequestAccessToken;
     invote.BeginInvoke(AsyncCallback, invote);
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:19,代碼來源:1414053582$StartForm.cs

示例13: BtnSelect_Click

 /// <summary>
 ///  查詢自定義菜單
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-16 10:16:33
 private void BtnSelect_Click(object sender, EventArgs e)
 {
     //獲取數據
     _baseInfo = GetBaseInfo();
     string accessToken = _baseInfo.AccessToken;
     if (string.IsNullOrEmpty(accessToken))
     {
         MessageBox.Show("請先獲取Access_Token!");
     }
     else
     {
         if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
         {
             ShowPrgSelect();
             SelectMenu(accessToken);
             HidePrgSelect();
             return;
         }
         MessageBox.Show("Access_Token已經過期,請重新獲取!");
     }
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:27,代碼來源:1418438698$startform.cs

示例14: BtnAccessToken_Click

 /// <summary>
 ///  獲取access_token
 /// </summary>
 /// Author  : 俞立鋼
 /// Company : 紹興標點電子技術有限公司
 /// Created : 2014-10-15 10:09:03
 private void BtnAccessToken_Click(object sender, EventArgs e)
 {
     _baseInfo = GetBaseInfo();
     //判access_token是否過期
     if (!PublicFun.JudgeAccessToken(_baseInfo.StartDateTime, _baseInfo.EndDateTime))
     {
         MessageBox.Show("該access_token沒有過期,不需要重新獲取!");
         return;
     }
     ThreadPool.QueueUserWorkItem(h =>
     {
         ShowProgress();
         TxtAccessToken.Text = "";
         RequestAccessToken();
     });
     //SetDelege();
     /*Thread t=new Thread(new ThreadStart(SetDelege));
     t.IsBackground = true;
     t.Start();*/
 }
開發者ID:MetSystem,項目名稱:WeiXin,代碼行數:26,代碼來源:1418436643$startform.cs


注:本文中的WeiXin.Tools.Model.BaseInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。