/// <summary> /// Get instrument data list by search condition /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS170_Search(CMS170_SearchCondition cond) { ObjectResultData res = new ObjectResultData(); try { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); doInstrumentSearchCondition searchCon = new doInstrumentSearchCondition(); //Start: Prepare search condition---------------------------------------------------------- //Set parameter value for partial matching search textbox searchCon.InstrumentCode = (cond.InstrumentCode != null) ? cond.InstrumentCode.Replace('*', '%') : null; searchCon.InstrumentName = (cond.InstrumentName != null) ? cond.InstrumentName.Replace('*', '%') : null; searchCon.Maker = (cond.Maker != null) ? cond.Maker.Replace('*', '%') : null; searchCon.SupplierCode = cond.SupplierCode; searchCon.LineUpTypeCode = cond.LineUpTypeCode; searchCon.InstrumentFlag = new List <int?>(); if (cond.InstFlagMain) { searchCon.InstrumentFlag.Add(1); } if (cond.InstFlagOption) { searchCon.InstrumentFlag.Add(0); } searchCon.ExpansionType = new List <string>(); if (cond.ExpTypeHas) { searchCon.ExpansionType.Add(ExpansionType.C_EXPANSION_TYPE_PARENT); } if (cond.ExpTypeNo) { searchCon.ExpansionType.Add(ExpansionType.C_EXPANSION_TYPE_CHILD); } if (cond.ProdTypeSale) { searchCon.SaleFlag = 1; } if (cond.ProdTypeAlarm) { searchCon.RentalFlag = 1; } searchCon.InstrumentType = new List <string>(); if (cond.InstTypeGen) { searchCon.InstrumentType.Add(InstrumentType.C_INST_TYPE_GENERAL); } if (cond.InstTypeMon) { searchCon.InstrumentType.Add(InstrumentType.C_INST_TYPE_MONITOR); } if (cond.InstTypeMat) { searchCon.InstrumentType.Add(InstrumentType.C_INST_TYPE_MATERIAL); } //End: Prepare search condition---------------------------------------------------------- List <doInstrumentData> list = hand.GetInstrumentDataForSearch(searchCon); for (int i = 0; i < list.Count(); i++) { list[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } res.ResultData = CommonUtil.ConvertToXml <doInstrumentData>(list, "Common\\CMS170", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Check seach condition that is required field /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS170_CheckReqField(CMS170_SearchCondition cond) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { #region Removed check intrument flag & expansion type & product type //if (cond.InstFlagMain == false && cond.InstFlagOption == false) //{ // res.AddErrorMessage(MessageUtil.MODULE_COMMON, // CMS170_Screen, // MessageUtil.MODULE_COMMON, // MessageUtil.MessageList.MSG0079, // new string[] { "lblInstruFlag" }, // new string[] { "cms170_InstFlagMain", "cms170_InstFlagOption" }); //} //if (cond.ExpTypeHas == false && cond.ExpTypeNo == false) //{ // res.AddErrorMessage(MessageUtil.MODULE_COMMON, // CMS170_Screen, // MessageUtil.MODULE_COMMON, // MessageUtil.MessageList.MSG0079, // new string[] { "lblExpanFlag" }, // new string[] { "cms170_ExpTypeHas", "cms170_ExpTypeNo" }); //} //if (cond.ProdTypeAlarm == false && cond.ProdTypeSale == false) //{ // res.AddErrorMessage(MessageUtil.MODULE_COMMON, // CMS170_Screen, // MessageUtil.MODULE_COMMON, // MessageUtil.MessageList.MSG0079, // new string[] { "lblProductType" }, // new string[] { "cms170_ProdTypeSale", "cms170_ProdTypeAlarm" }); //} #endregion if (cond.InstTypeGen == false && cond.InstTypeMon == false && cond.InstTypeMat == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, CMS170_Screen, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0079, new string[] { "lblInstruType" }, new string[] { "cms170_InstTypeGen", "cms170_InstTypeMon", "cms170_InstTypeMat" }); } if (res.IsError) { return(Json(res)); } res.ResultData = true; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }