コード例 #1
0
ファイル: DataSource.cs プロジェクト: foxbill/xbase-2018.01
        private void setQueryParameters(CommandSchema cmdSchema, DbCommand cmd)
        {
            DatabaseAdmin dbAdmin = DatabaseAdmin.getInstance(_schema.ConnectionName);

            foreach (ParameterSchema p in cmdSchema.QueryParams)
            {
                switch (p.Direction)
                {
                case ParameterDirection.Input:
                case ParameterDirection.InputOutput:
                    string value = p.DefaultValue;
                    if (Request.QueryString.AllKeys.Contains(p.Id))
                    {
                        value = Request[p.Id];
                    }
                    if (!string.IsNullOrEmpty(value) && value.StartsWith("(") && value.EndsWith(")"))
                    {
                        value = null;
                        object obj = Umc.invoke(value, null).ToString();
                        if (obj != null)
                        {
                            value = obj.ToString();
                        }
                    }

                    break;
                }
            }
        }
コード例 #2
0
ファイル: DataSource.cs プロジェクト: foxbill/xbase-2018.01
 private string getExpressValue(string express)
 {
     if (string.IsNullOrEmpty(express))
     {
         return(express);
     }
     if (!(express.StartsWith("[") && express.EndsWith("]")))
     {
         return(express);
     }
     express = express.Trim('[', ']');
     return(Umc.invoke(express, null).ToString());
 }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                umc = Umc.getInstance(context);
                parseRequestPath(context.Request.Path);
                Dictionary <string, string> jsonNameValues = HandlerUtils.getPostParams(context);

                if (ext.Equals(".keep"))
                {
                    umc.keepWbo(
                        this.wboTypeId,
                        this.wboName,
                        jsonNameValues["wboJSON"],
                        jsonNameValues["newName"]
                        );

                    writeToJsonResponse(context.Response, null);
                    return;
                }

                if (ext.Equals(".free"))
                {
                    umc.freeWbo(wboName, wboTypeId);
                    writeToJsonResponse(context.Response, null);
                    return;
                }

                if (ext.Equals(".del"))
                {
                    umc.delWbo(wboName, wboTypeId);
                    writeToJsonResponse(context.Response, null);
                    return;
                }

                if (ext.Equals(".disp", StringComparison.OrdinalIgnoreCase))
                {
                    object ret = umc.GetObject(wboName, this.wboTypeId);
                    if (!(ret is IVisualWbo))
                    {
                        throw new XException(Lang.ObjectIsNotVisualWbo);
                    }
                    string elementName = "";
                    if (jsonNameValues.ContainsKey("elementName"))
                    {
                        elementName = jsonNameValues["elementName"];
                    }
                    string html = (ret as IVisualWbo).Render(elementName);
                    context.Response.Write(html);
                    return;
                }

                if (reqName.EndsWith(".post"))
                {
                    jsonNameValues = null;
                }

                object obj;
                if (ext.Equals(".dir"))
                {
                    obj = Umc.dir(wboTypeId);
                }
                else
                {
                    obj = umc.invoke(reqName, jsonNameValues);
                }

                writeToJsonResponse(context.Response, obj);

                //context.Response.End();
            }
            catch (System.Reflection.TargetInvocationException e1)
            {
                string jsonErr = JsonExceptionUtils.ThrowErr(e1.InnerException).Serialize();
                if (e1.InnerException is PermissionException)
                {
                    jsonErr = JsonExceptionUtils.ThrowErr(SecErrs.NotPemission, (e1.InnerException as PermissionException).LoginUrl).Serialize();
                }
                context.Response.Write(jsonErr);
            }
            catch (PermissionException e2)
            {
                string jsonErr = JsonExceptionUtils.ThrowErr(10, e2.Message, e2.LoginUrl).Serialize();
                context.Response.Write(jsonErr);
            }
            catch (Exception e)
            {
                string jsonErr = JsonExceptionUtils.ThrowErr(e).Serialize();
                context.Response.Write(jsonErr);
            }
        }