public FeeTools() { ConstantApi constantApi = new ConstantApi(); var resp = constantApi.GetChargeDefines(); if (resp.Code == 1 && resp.DataCount > 0) { m_chargeDefines = JsonConvert.DeserializeObject <List <ChargeDefine> >(resp.Data?.ToString()); } }
private void btnSearch_Click(object sender, EventArgs e) { List <ChargeDefine> list = null; ControlHelper.ThreadRunExt(this, () => { var succ = true; var msg = ""; try { ResponseModel responseModel = new ResponseModel(); ConstantApi constantApi = new ConstantApi(); responseModel = constantApi.GetChargeDefines(); //Hashtable hashtable = null; //string sql = "SELECT * FROM ConstantDefine WHERE 1=1 "; //if (!string.IsNullOrEmpty(txtSeach.Text.Trim())) //{ // hashtable = new Hashtable(); // hashtable.Add("TypeName", "%" + txtSeach.Text.Trim() + "%"); // sql += " AND TypeName like @DefineType"; //} //list = AppHelper.DB.QueryList<ConstantDefine>(sql, hashtable).ToList(); if (responseModel.Code == 1) { if (responseModel.DataCount > 0) { list = JsonConvert.DeserializeObject <List <ChargeDefine> >(responseModel?.Data?.ToString()); ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { if (list != null) { CGridHelper.ClearGrid(dgv); CGridHelper.FillGrid <ChargeDefine>(dgv, list); } }); } else { succ = false; msg = "查询数据为空!"; } } else { succ = false; msg = responseModel?.Message; } } catch (Exception ex) { msg = ex.Message; } if (!succ) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在查询……", 200); }