/// <summary>
        /// Search instrument data by instrumentcode
        /// </summary>
        /// <param name="InstrumentCode"></param>
        /// <returns></returns>
        public ActionResult CTS230_GetInstrumentDataForSearch(string InstrumentCode)
        {
            if (!CommonUtil.IsNullOrEmpty(InstrumentCode))
            {
                IInstrumentMasterHandler    InstHand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler;
                doInstrumentSearchCondition Cond     = new doInstrumentSearchCondition();
                Cond.InstrumentCode = InstrumentCode;
                //====================== TRS update 17/07/2012 ============================
                //Cond.ExpansionType = new List<string>() { ExpansionType.C_EXPANSION_TYPE_PARENT };
                //Cond.InstrumentType = new List<string>() { InstrumentType.C_INST_TYPE_GENERAL };
                Cond.ExpansionType  = null;
                Cond.InstrumentType = null;
                //=========================================================================
                List <doInstrumentData> dtNewInstrument = InstHand.GetInstrumentDataForSearch(Cond);

                if (dtNewInstrument.Count > 0)
                {
                    return(Json(dtNewInstrument[0]));
                }
                else
                {
                    return(Json(""));
                }
            }
            return(Json(""));
        }
        /// <summary>
        /// Get instrument data for search.
        /// </summary>
        /// <param name="InstrumentCode"></param>
        /// <returns></returns>
        public ActionResult IVS250_GetInstrumentDataForSearch(string InstrumentCode)
        {
            if (!CommonUtil.IsNullOrEmpty(InstrumentCode))
            {
                ObjectResultData res = new ObjectResultData();

                IInstrumentMasterHandler    InstHand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler;
                doInstrumentSearchCondition Cond     = new doInstrumentSearchCondition();
                Cond.InstrumentCode = InstrumentCode;
                Cond.ExpansionType  = new List <string>()
                {
                    ExpansionType.C_EXPANSION_TYPE_CHILD
                };
                Cond.InstrumentType = new List <string>()
                {
                    InstrumentType.C_INST_TYPE_GENERAL, InstrumentType.C_INST_TYPE_MATERIAL
                };
                List <doInstrumentData> dtNewInstrument = InstHand.GetInstrumentDataForSearch(Cond);

                if (dtNewInstrument.Count > 0)
                {
                    return(Json(dtNewInstrument[0]));
                }
                else
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4037);
                    res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                    return(Json(res));
                }
            }
            return(Json(""));
        }
Example #3
0
        /// <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));
        }