Ejemplo n.º 1
0
 private void CreateAdvanceSearch()
 {
     DataRow[] drs = dtDetail.Select("bIsShow=1");
     if (drs.Length > 0)
     {
         frmSearchForm frm = new frmSearchForm();
         frm.Text = "高级查询";
         foreach (DataRow dr in drs)
         {
             string sColumnType = dr["sColumnType"].ToString();
             switch (sColumnType)
             {
                 case "C":
                     {
                         frm.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sColumnCaption"].ToString() : dr["sColumnEngCaption"].ToString(),
                                                     dr["sColumnFieldName"].ToString(), FiledType.C, dr["sReturnValue"].ToString(), dr["sReturnValue"].ToString());
                         break;
                     }
                 case "D":
                     {
                         frm.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sColumnCaption"].ToString() : dr["sColumnEngCaption"].ToString(),
                                                     dr["sColumnFieldName"].ToString(), FiledType.D);
                         break;
                     }
                 case "S":
                 case "L":
                 case "N":
                     {
                         frm.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sColumnCaption"].ToString() : dr["sColumnEngCaption"].ToString(),
                                                     dr["sColumnFieldName"].ToString(), FiledType.S);
                         break;
                     }
             }
         }
         if (frm.ShowDialog() == DialogResult.OK)
         {
             InitGridData(frm.SearchSQL);
         }
     }
 }
Ejemplo n.º 2
0
 public virtual void CreateSearchFilter()
 {
     DataRow[] drs = DynamicMasterTableData.Select("bQuery=1");
     if (drs.Length > 0)
     {
         frmSearchForm frmSearch = new frmSearchForm();
         foreach (DataRow dr in drs)
         {
             string sControlType = dr["sControlType"].ToString();
             switch (sControlType)
             {
                 case "txt":
                 case "mtxt":
                     {
                         frmSearch.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sCaption"].ToString() : dr["sEngCaption"].ToString(),
                                                 dr["sFieldName"].ToString(), FiledType.S);
                         break;
                     }
                 case "cbx":
                     {
                         frmSearch.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sCaption"].ToString() : dr["sEngCaption"].ToString(),
                                                 dr["sFieldName"].ToString(), FiledType.C, dr["sLookupNo"].ToString());
                         break;
                     }
                 case "lkp":
                     {
                         frmSearch.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sCaption"].ToString() : dr["sEngCaption"].ToString(),
                                                 dr["sFieldName"].ToString(), FiledType.L, dr["sLookupNo"].ToString());
                         break;
                     }
                 case "det":
                     {
                         frmSearch.AddSearchItem(LangCenter.Instance.IsDefaultLanguage ? dr["sCaption"].ToString() : dr["sEngCaption"].ToString(),
                                                 dr["sFieldName"].ToString(), FiledType.D);
                         break;
                     }
             }
         }
         if (frmSearch.ShowDialog() == DialogResult.OK)
         {
             MasterFilterSQL = " AND " + frmSearch.SearchSQL;
         }
     }
 }