private void Search() { List <SearchField> searchFieldList = new List <SearchField>(); if (Request.QueryString["condition"] != null) { searchFieldList = ModelAdvanceSearch.Utility.ConvertStringToSearchFieldList(Request.QueryString["condition"], ContractFieldPara.GetAllContractSearchField()); ; } string s; try { Account account = Session[SessionKeys.LOGININFO] as Account; List <Contract> resultList = InstanceFactory.CreateAdvanceSearchFacade().AdvanceSearchContractFacade(searchFieldList, account); s = JsonConvert.SerializeObject(ContractStringValue.Turn(resultList)); s = s.Replace("null", "\"\""); Session["AdvanceSearchContractColShow"] = Request.QueryString["colshow"]; Session["AdvanceSearchContractCondition"] = Request.QueryString["condition"]; Session["AdvanceSearchContractResult"] = resultList; } catch (Exception ex) { List <SEPPerformance.Error> error = new List <SEPPerformance.Error>(); error.Add(new SEPPerformance.Error("doorcardErrorMessage", ex.Message)); s = JsonConvert.SerializeObject(error); } Response.Write(s); Response.End(); }
private void BindSearchFieldInfo(string q) { string result = String.Empty; List <SearchField> allSearchFields = ContractFieldPara.GetAllContractSearchField(); foreach (SearchField item in allSearchFields) { bool isCompareSuccess = false; foreach (string abbreviation in item.FieldParaBase.Abbreviations) { if (abbreviation.StartsWith(q)) { isCompareSuccess = true; break; } } if (isCompareSuccess) { result += string.IsNullOrEmpty(result) ? item.FieldParaBase.FieldName : "\n" + item.FieldParaBase.FieldName; } } Response.Write(result); }
public void InitSearchConditionView(bool isPostBack) { if (!isPostBack) { List <SearchField> SearchFieldList = _IContractAdvanceSearchListView.SearchFieldSourceCookie; if (SearchFieldList.Count == 0) { SearchFieldList = ContractFieldPara.InitialConditionList(); } SearchFieldList.Add(SearchField.InitField_Null()); _IContractAdvanceSearchListView.SearchFieldConditionSource = SearchFieldList; _IContractAdvanceSearchListView.SearchFieldHiddenValue = ContractFieldPara.GetAllContractSearchField(); List <SearchField> colshowlist = new List <SearchField>(); if (!string.IsNullOrEmpty(_IContractAdvanceSearchListView.SearchFieldColShowCookie)) { string[] colshowcookies = _IContractAdvanceSearchListView.SearchFieldColShowCookie.Split('|'); foreach (string colindex in colshowcookies) { int temp; if (!string.IsNullOrEmpty(colindex) && int.TryParse(colindex, out temp)) { colshowlist.Add(ContractFieldPara.GetAllContractSearchField()[temp]); } } _IContractAdvanceSearchListView.InitCheckedBoxCol = colshowlist; } if (colshowlist.Count == 0) { _IContractAdvanceSearchListView.InitCheckedBoxCol = ContractFieldPara.InitialColList(); } _IContractAdvanceSearchListView.SearchFieldCheckBoxCol = ContractFieldPara.GetAllContractSearchField(); } }
protected override void DoOrCompare() { for (int i = 0; i < _ContractList.Count; i++) { bool isNeedOne = false; bool isExistOr = false; foreach (SearchField item in _SearchFieldList) { if (item.ConditionField.EnumCollectedType != EnumCollectedType.Or) { continue; } isExistOr = true; isNeedOne = ContractFieldPara.IsNeedCondition(item, _ContractList[i]); if (isNeedOne) { break; } } if (isExistOr && !isNeedOne) { _ContractList.RemoveAt(i); i--; } } }
private void Init_PartSearchFieldList() { _ContractBasicInfoSearchFieldList = ContractFieldPara.GetPartSearchFieldList(_SearchFieldList, ContractFieldPara.ContractBasicInfoPart); _EmployeeBasicInfoSearchFieldList = ContractFieldPara.GetPartSearchFieldList(_SearchFieldList, ContractFieldPara.EmployeeBasicInfoPart); _VacationSearchFieldList = ContractFieldPara.GetPartSearchFieldList(_SearchFieldList, ContractFieldPara.VacationPart); _AdjustSearchFieldList = ContractFieldPara.GetPartSearchFieldList(_SearchFieldList, ContractFieldPara.AdjustPart); }
private static SearchField GetSearchFieldObjectEvent(string fieldName) { SearchField retSearchField = SearchField.GetFieldParaByFieldName(ContractFieldPara.GetAllContractSearchField(), fieldName); if (retSearchField == null) { return(SearchField.InitField_Null()); } return(retSearchField); }
private void ExportToExcel(_Worksheet excelSheet) { List <Contract> resultList = new List <Contract>(); if (Session["AdvanceSearchContractResult"] != null) { resultList = Session["AdvanceSearchContractResult"] as List <Contract>; } //二维数组定义是多一个标题行。 int rowcount = resultList.Count; List <SearchField> contractFieldParaList = ContractFieldPara.GetAllContractSearchField(); int colcount = contractFieldParaList.Count; object[,] dataArray = new object[rowcount + 1, colcount]; string[] colshows = Request.QueryString["colshow"] != null ? Request.QueryString["colshow"].Split('|') : null; int colIndex = 0; for (int j = 0; j < contractFieldParaList.Count; j++) { if (colshows != null) { foreach (string s in colshows) { if (s == j.ToString()) { dataArray[0, colIndex] = contractFieldParaList[j].FieldParaBase.FieldName; for (int i = 1; i < rowcount + 1; i++) { dataArray[i, colIndex] = "'" + ContractFieldPara.GetSearchFieldValue(resultList[i - 1], contractFieldParaList[j]); } colIndex++; break; } } } } excelSheet.get_Range("A1", excelSheet.Cells[rowcount + 1, colcount]).Value2 = dataArray; }
protected override void DoAndCompare() { for (int i = 0; i < _ContractList.Count; i++) { foreach (SearchField item in _SearchFieldList) { if (item.ConditionField.EnumCollectedType != EnumCollectedType.And) { continue; } bool isNeed = ContractFieldPara.IsNeedCondition(item, _ContractList[i]); if (!isNeed) { _ContractList.RemoveAt(i); i--; break; } } } }