Beispiel #1
0
        /// <summary>
        /// Check require field.<br />
        /// - ParentInstrumentCode must not null or empty.<br />
        /// - Check exist ParentInstrumentCode.<br />
        /// - Get information of ParentInstrumentCode.
        /// </summary>
        /// <param name="ParentInstrumentCode"></param>
        /// <returns></returns>
        public ActionResult MAS100_CheckReqField(String ParentInstrumentCode)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                if (CommonUtil.IsNullOrEmpty(ParentInstrumentCode))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_MASTER,
                                        MAS100_Screen,
                                        MessageUtil.MODULE_MASTER,
                                        MessageUtil.MessageList.MSG1040,
                                        new string[] { "lblParentinstrumentcode" },
                                        new string[] { "ParentInstrumentCode" });
                    res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;
                    return(Json(res));
                }

                //Check exist parent instrument
                IInstrumentMasterHandler  hand         = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler;
                List <doParentInstrument> doParentInst = hand.GetParentInstrument(ParentInstrumentCode);
                if (doParentInst.Count <= 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_MASTER,
                                        MAS100_Screen,
                                        MessageUtil.MODULE_MASTER,
                                        MessageUtil.MessageList.MSG1043,
                                        new string[] { "lblParentinstrumentcode" },
                                        new string[] { "ParentInstrumentCode" });
                    return(Json(res));
                }

                //Load data GetInstrumentExpansion
                List <doInstrumentExpansion> lst = hand.GetInstrumentExpansion(ParentInstrumentCode);

                MAS100_ScreenParameter MAS100Param = GetScreenObject <MAS100_ScreenParameter>();
                MAS100Param.ParentInstrumentCode      = doParentInst[0].ParentInstruementCode;
                MAS100Param.ParentInstrumentName      = doParentInst[0].ParentInstruementName;
                MAS100Param.SearchInstrumentExpansion = lst;

                //Clear AddInstrumentExpansion & DelInstrumentExpansion
                MAS100Param.AddInstrumentExpansion = new List <doInstrumentExpansion>();
                MAS100Param.DelInstrumentExpansion = new List <doInstrumentExpansion>();

                UpdateScreenObject(MAS100Param);

                res.ResultData = MAS100Param.ParentInstrumentName;
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }
Beispiel #2
0
        /// <summary>
        /// Retrieve parent instrument data.<br />
        /// - If ParentInstrumentCode is null or empty get information from session.<br />
        /// - If ParentInstrumentCode is not null or empty get information of ParentInstrumentCode.
        /// </summary>
        /// <param name="ParentInstrumentCode"></param>
        /// <returns></returns>
        public ActionResult MAS100_Retrieve(String ParentInstrumentCode)
        {
            ObjectResultData res = new ObjectResultData();

            try
            {
                MAS100_ScreenParameter       MAS100Param = GetScreenObject <MAS100_ScreenParameter>();
                List <doInstrumentExpansion> lst         = new List <doInstrumentExpansion>();

                if (CommonUtil.IsNullOrEmpty(ParentInstrumentCode)) //from click retrieve
                {
                    lst = MAS100Param.SearchInstrumentExpansion;
                }
                else //from click search parent instrument
                {
                    //Check exist parent instrument
                    IInstrumentMasterHandler  hand         = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler;
                    List <doParentInstrument> doParentInst = hand.GetParentInstrument(ParentInstrumentCode);
                    if (doParentInst.Count <= 0)
                    {
                        res.AddErrorMessage(MessageUtil.MODULE_MASTER,
                                            MAS100_Screen,
                                            MessageUtil.MODULE_MASTER,
                                            MessageUtil.MessageList.MSG1043,
                                            new string[] { "lblParentinstrument" },
                                            new string[] { "ParentInstrumentCode" });
                        return(Json(res));
                    }

                    lst = hand.GetInstrumentExpansion(ParentInstrumentCode);
                    MAS100Param.ParentInstrumentCode      = doParentInst[0].ParentInstruementCode;
                    MAS100Param.ParentInstrumentName      = doParentInst[0].ParentInstruementName;
                    MAS100Param.SearchInstrumentExpansion = lst;

                    //Clear AddInstrumentExpansion & DelInstrumentExpansion
                    MAS100Param.AddInstrumentExpansion = new List <doInstrumentExpansion>();
                    MAS100Param.DelInstrumentExpansion = new List <doInstrumentExpansion>();

                    UpdateScreenObject(MAS100Param);
                }

                res.ResultData = CommonUtil.ConvertToXml <doInstrumentExpansion>(lst, "Master\\MAS100", CommonUtil.GRID_EMPTY_TYPE.INSERT);
            }
            catch (Exception ex)
            {
                res.AddErrorMessage(ex);
            }

            return(Json(res));
        }