ConfiguretExtensions.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using EMIS.ViewModel;
  6. using Bowin.Common.JSON;
  7. using EMIS.Entities;
  8. namespace EMIS.Web.Controls
  9. {
  10. public static class ConfiguretExtensions
  11. {
  12. public static ConfiguretView GetConfiguretermsView(QueryParamsModel pararms)
  13. {
  14. ConfiguretView configuretView = new ConfiguretView();
  15. //获取控件
  16. string QueryAttribute = pararms == null ? HttpContext.Current.Request.Form["Attribute"] : pararms.getExtraString("Attribute");
  17. Sys_ConfiguretermsInfo configureterms = QueryAttribute == "-1" || QueryAttribute == null ? null : QueryAttribute.JsonToObject<Sys_ConfiguretermsInfo>();
  18. if (configureterms != null)
  19. {
  20. string ControlName = configureterms.Value;//.Replace(".", "");
  21. if (configureterms.ControlType == "TextBox")
  22. ControlName += "_QueryTextBox";
  23. else if (configureterms.ControlType == "DropdownList")
  24. ControlName += "_QueryDropdownList";
  25. else if (configureterms.ControlType == "DictionaryDropDownList")
  26. ControlName += "_QueryDictionaryDropDownList";
  27. else if (configureterms.ControlType == "CheckBox")
  28. ControlName += "_QueryCheckBox";
  29. else if (configureterms.ControlType == "ComboGrid")
  30. ControlName += "_QueryComboGrid";
  31. else if (configureterms.ControlType == "TextBoxDate")
  32. ControlName += "_QueryTextBoxDate";
  33. configuretView.Attribute = configureterms.Value;
  34. configuretView.Condition = pararms == null ? HttpContext.Current.Request.Form["Condition"] : pararms.getExtraString("Condition");
  35. configuretView.ConditionValue = pararms == null ? (HttpContext.Current.Request.Form[ControlName] == "-1" ? "" : HttpContext.Current.Request.Form[ControlName]).Trim() : (pararms.getExtraString(ControlName) == "-1" ? "" : pararms.getExtraString(ControlName)).Trim();
  36. }
  37. return configuretView;
  38. }
  39. }
  40. }