Beispiel #1
0
        public override clsMsg getData(clsCmd cmd)
        {
            var obj = new NTier.Request.clsGetDataView(_adapter);



            if (this.func.isEmpty() == false)
            {
                NTier.Request.iRequest iCmd = AppDomain.CurrentDomain.CreateInstance(this.assemblyName, this.classPath).Unwrap() as iRequest;
                iCmd.setTier(this._tier);
                object[] objParams = new object[] { cmd };
                var      m         = iCmd.GetType().GetMethod(this.func);
                clsMsg   msg       = (clsMsg)m.Invoke(iCmd, objParams);

                return(msg);
            }
            else
            {
                NTier.Request.iGetData iCmd = AppDomain.CurrentDomain.CreateInstance(this.assemblyName, this.classPath).Unwrap() as iGetData;
                iCmd.setTier(this._tier);
                return(iCmd.getData(cmd));
            }

            return(g.msg("", obj.getData(cmd)));
        }
Beispiel #2
0
        public override clsMsg getData(clsCmd cmd)
        {
            var obj = new NTier.Request.clsGetDataView(_adapter);

            obj.viewName = this.viewName;
            obj.OrderBy  = this.orderBy;
            return(g.msg("", obj.getData(cmd)));
        }
Beispiel #3
0
        public clsAPIResponse get(clsCmd cmd)
        {
            var _adapter = _appService.getAdapter();
            var oView    = new NTier.Request.clsGetDataView(_adapter);

            oView.viewName = this.view;

            DataTable t = oView.getData(cmd);

            return(clsAPIResponse.ok(t));
        }
Beispiel #4
0
        public clsMsg getData(clsCmd cmd)
        {
            var oViewData = new NTier.Request.clsGetDataView(this._adapter);

            oViewData.viewName = this.ViewName;

            try
            {
                DataTable t = oViewData.getData(cmd);
                return(g.msg("", t));
            }
            catch (Exception ex)
            {
                return(g.msg_exception(ex));
            }
        }
        /*
         * private clsMsg getRequest_fork(string sRequestPath, clsCmd cmd)
         * {
         *  var oRequestPath = new requestPath(sRequestPath);
         *
         *
         *  var sPath = getPath(oRequestPath.getPath());
         *
         *  if (!System.IO.File.Exists(sPath))
         *      return g.msg("Request path not found !");
         *
         *  ///////////////////////////////////////////////
         *  string sRequestType = "";
         *  iRequest request = null;
         *
         *  var xDoc = getXmlDoc(oRequestPath.getPath());
         *
         *  var xNodeType = xDoc.SelectSingleNode("//request");
         *
         *  var attr = xNodeType.Attributes["type"];
         *  if (attr != null)
         *      sRequestType = attr.Value;
         *
         *  switch (sRequestType)
         *  {
         *      case "getData":
         *          var node = xDoc.SelectSingleNode("//request/dt[@name='" + oRequestPath.getQueryString("name") + "']/view");
         *          //request = getRequest(node);
         *          break;
         *  }
         *
         *  return request.getRequest(cmd);
         * }
         */


        //private iGetData getRequest(XmlNode node)
        //{

        //    var myRequest = new NTier.CRUD.clsReadSimple();
        //    myRequest.viewName = node.InnerText;
        //    return myRequest;
        //}

        public clsMsg getData(string sPath, clsCmd cmd)
        {
            XmlNode xNode = xDoc.SelectSingleNode("//appConfig/requestData[@type='getData']/dt[@name='" + sPath + "']");

            if (xNode.getXmlAttributeValue("type") == "view")
            {
                string sViewName = xNode.getXmlText("view");

                var obj = new NTier.Request.clsGetDataView(_adapter);
                obj.viewName = sViewName;
                obj.OrderBy  = xNode.getXmlText("orderby");

                return(g.msg("", obj.getData(cmd)));
            }
            else if (xNode.getXmlAttributeValue("type") == "other")
            {
                string sAssemblyName = xNode.getXmlAttributeValue("assemblyName");
                string sClassPath    = xNode.getXmlAttributeValue("classPath");
                string sFunc         = xNode.getXmlAttributeValue("func");

                NTier.Request.iGetData iCmd = AppDomain.CurrentDomain.CreateInstance(sAssemblyName, sClassPath).Unwrap() as iGetData;
                iCmd.setTier(this);

                if (!sFunc.isEmpty())
                {
                    object[] objParams = new object[] { cmd };
                    var      m         = iCmd.GetType().GetMethod(sFunc);
                    clsMsg   msg       = (clsMsg)m.Invoke(iCmd, objParams);
                    return(msg);
                }
                else
                {
                    return(iCmd.getData(cmd));
                }
            }

            return(g.msg(""));
        }