/// <summary> /// Load search result to grid /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CTS030_Search(CTS030_Search cond) { List <dtSearchDraftContractResult> list = new List <dtSearchDraftContractResult>(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { ValidatorUtil.BuildErrorMessage(res, this, new object[] { cond }); //AtLeast1FieldNotNullOrEmptyAttribute if (res.IsError) { return(Json(res)); } CTS030_ScreenParameter CTS030Param = GetScreenObject <CTS030_ScreenParameter>(); if (CTS030Param == null) { CTS030Param = new CTS030_ScreenParameter(); } dsCTS030Data data = CTS030Param.data; if (data == null) { //Save search condition value dsCTS030Data dsData = new dsCTS030Data(); dsData.doSearchCondition = cond; //Set default to some search condition CommonUtil c = new CommonUtil(); cond.QuotationCode = c.ConvertQuotationTargetCode(cond.QuotationCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.ApproveContractStatus = ApprovalStatus.C_APPROVE_STATUS_WAITFORAPPROVE; //Query for draft contract IDraftContractHandler hand = ServiceContainer.GetService <IDraftContractHandler>() as IDraftContractHandler; list = hand.SearchDraftContractList(cond); //Save search result list dsData.dtSearchResult = list; //Save condition and result into session CTS030Param.data = dsData; UpdateScreenObject(CTS030Param); } else { list = data.dtSearchResult; } } catch (Exception ex) { res.AddErrorMessage(ex); } res.ResultData = CommonUtil.ConvertToXml <dtSearchDraftContractResult>(list, "Contract\\CTS030", CommonUtil.GRID_EMPTY_TYPE.SEARCH); return(Json(res)); }
public ActionResult CTS030(string caller) { try { CTS030_ScreenParameter CTS030Param = GetScreenObject <CTS030_ScreenParameter>(); if (CTS030Param == null) { CTS030Param = new CTS030_ScreenParameter(); } #region Clear data if not return from child page if (CTS030Param.CallerScreenID != ScreenID.C_SCREEN_ID_FN99 && //CTS010 CTS030Param.CallerScreenID != ScreenID.C_SCREEN_ID_FQ99) //CTS020 { CTS030Param.data = null; } #endregion dsCTS030Data data = CTS030Param.data; if (data != null) { //Convert result to current language CommonUtil.MappingObjectLanguage <dtSearchDraftContractResult>(data.dtSearchResult); //Clear isAuditBtnClick flag to clear session after come back from child page CTS030Param.isAuditBtnClick = false; CommonUtil c = new CommonUtil(); if (CommonUtil.IsNullOrEmpty(data.doSearchCondition.QuotationCode) == false) { ViewBag.QuotationCode = c.ConvertContractCode(data.doSearchCondition.QuotationCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } ViewBag.Alphabet = data.doSearchCondition.Alphabet ?? ""; ViewBag.RegistrationDateFrom = (data.doSearchCondition.RegistrationDateFrom == null) ? "" : data.doSearchCondition.RegistrationDateFrom.Value.ToString("dd-MMM-yyyy"); ViewBag.RegistrationDateTo = (data.doSearchCondition.RegistrationDateTo == null) ? "" : data.doSearchCondition.RegistrationDateTo.Value.ToString("dd-MMM-yyyy"); ViewBag.Salesman1Code = data.doSearchCondition.Salesman1Code ?? ""; ViewBag.Salesman1Name = data.doSearchCondition.Salesman1Name ?? ""; ViewBag.ContractTargetName = data.doSearchCondition.ContractTargetName ?? ""; ViewBag.SiteName = data.doSearchCondition.SiteName ?? ""; ViewBag.ContractOfficeCode = (data.doSearchCondition.ContractOfficeCode == null || data.doSearchCondition.ContractOfficeCode.Contains(",")) ? "" : data.doSearchCondition.ContractOfficeCode; ViewBag.OperationOfficeCode = (data.doSearchCondition.OperationOfficeCode == null || data.doSearchCondition.OperationOfficeCode.Contains(",")) ? "" : data.doSearchCondition.OperationOfficeCode; ViewBag.CurrentIndex = CTS030Param.CurrentIndex; ViewBag.CurrentSortColIndex = CTS030Param.CurrentSortColIndex; ViewBag.CurrentSortType = CTS030Param.CurrentSortType; ViewBag.HasSessionData = true; } else { ViewBag.CurrentPage = 0; ViewBag.HasSessionData = false; } ViewBag.AuditLabel = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_CONTRACT, ScreenID.C_SCREEN_ID_SEARCH_APPROVE, "headerAudit"); ViewBag.PageRow = CommonValue.ROWS_PER_PAGE_FOR_SEARCHPAGE; #region Update data UpdateScreenObject(CTS030Param); #endregion } catch (Exception) { } return(View("CTS030")); }