private void LoadList() { StringBuilder sb = new StringBuilder(); DataTable dt = null; int s_rstyle = pub.GetInt(AppPub.GetDropDownValue(cBrstyle), "-1"); if (s_rstyle > -1) { pub.StrAdd(ref sb, " rstyle=" + s_rstyle.ToString() + " ", " and "); } int s_lv = pub.GetInt(AppPub.GetDropDownValue(cBlv), "-1"); if (s_lv > -1) { pub.StrAdd(ref sb, " level=" + s_lv.ToString() + " ", " and "); } int s_zt = pub.GetInt(AppPub.GetDropDownValue(cBzt), "-1"); if (s_zt > -1) { pub.StrAdd(ref sb, " isuse=" + s_zt.ToString() + " ", " and "); } string sxm = AppPub.GetDropDownValue(cBsxm); string skey = tBskey.Text.Trim(); if (skey != "") { pub.StrAdd(ref sb, " " + sxm + " like '%" + skey + "%' ", " and "); } if (sb.Length > 0) { dt = App.DataOften.GetTable(App.MayorsPowers.MayorsPowerTable.Select(sb.ToString())); } else { dt = App.MayorsPowers.MayorsPowerTable; } vlist.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { ListViewItem itema = new ListViewItem((i + 1).ToString(), 0); string level = WebOften.GetListVal(AppList.L_MayorsLevel(), DataOften.GetVal(dt, "level", i)); itema.SubItems.Add(level); string rstyle = WebOften.GetListVal(AppList.L_MayorsRewardStyle(), DataOften.GetVal(dt, "rstyle", i)); itema.SubItems.Add(rstyle); itema.SubItems.Add(DataOften.GetVal(dt, "depict", i)); itema.SubItems.Add(DataOften.GetVal(dt, "name", i)); itema.SubItems.Add(DataOften.GetVal(dt, "sign", i)); itema.SubItems.Add(DataOften.GetVal(dt, "min", i)); itema.SubItems.Add(DataOften.GetVal(dt, "max", i)); itema.SubItems.Add(DataOften.GetVal(dt, "dw", i)); itema.SubItems.Add(DataOften.GetVal(dt, "mtype", i)); string qy = WebOften.GetListVal(AppList.L_IsUser(), DataOften.GetVal(dt, "isuse", i)); AppPub.SetSubItemsStyle(ref itema, qy, "已起用|已停用", "#69CE1F|#FF0000"); itema.SubItems.Add(DataOften.GetVal(dt, "mid", i)); vlist.Items.AddRange(new ListViewItem[] { itema }); } }
private void LoadInfo() { rBsign1.Enabled = false; rBsign2.Enabled = false; rBsign3.Enabled = false; rBdw1.Enabled = false; rBdw2.Enabled = false; DataRow[] drs = App.MayorsPowers.MayorsPowerTable.Select("mid='" + ids + "'"); if (drs.Length > 0) { dt = DataOften.GetTable(drs); } else { MessageBox.Show("信息不存在或已被删除!"); this.Close(); return; } string level = DataOften.GetVal(dt, "level"); llevel.Text = WebOften.GetListVal(AppList.L_MayorsLevel(), level); string rstyle = DataOften.GetVal(dt, "rstyle"); lstyle.Text = WebOften.GetListVal(AppList.L_MayorsRewardStyle(), rstyle); tBname.Text = DataOften.GetVal(dt, "name"); tBdepict.Text = DataOften.GetVal(dt, "depict"); tBmin.Text = DataOften.GetVal(dt, "min"); tBmax.Text = DataOften.GetVal(dt, "max"); string sign = DataOften.GetVal(dt, "sign"); if (sign == "+") { rBsign1.Checked = true; } else if (sign == "-") { rBsign2.Checked = true; } else if (sign == "=") { rBsign3.Checked = true; } string dw = DataOften.GetVal(dt, "dw"); if (dw == "%") { rBdw2.Checked = true; } else { rBdw1.Checked = true; } tBmtype.Text = DataOften.GetVal(dt, "mtype"); string sign_limit = DataOften.GetVal(dt, "sign_limit"); string dw_limit = DataOften.GetVal(dt, "dw_limit"); if (sign_limit.IndexOf("+") > -1) { rBsign1.Enabled = true; } else { rBsign1.Checked = false; } if (sign_limit.IndexOf("-") > -1) { rBsign2.Enabled = true; } else { rBsign2.Checked = false; } if (sign_limit.IndexOf("=") > -1) { rBsign3.Enabled = true; } else { rBsign3.Checked = false; } if (dw_limit == "") { rBdw1.Enabled = true; rBdw2.Enabled = false; rBdw2.Checked = false; } else if (dw_limit == "%") { rBdw1.Enabled = false; rBdw1.Checked = false; rBdw2.Enabled = true; } else if (dw_limit == ",%") { rBdw1.Enabled = true; rBdw2.Enabled = true; } }