コード例 #1
0
ファイル: ExecHm.cs プロジェクト: Centny/cswf
 public static void V_VNA(NetwRunnable nr, ExecHm rc, Bys m, out string name, out IDictionary<string, Object> args)
 {
     var res = new Dict(m.V<Dictionary<string, object>>());
     name = res.Val("name", "");
     var obj = res["args"];
     args = res["args"] as IDictionary<string,object>;
 }
コード例 #2
0
ファイル: GLFragoutput.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Create OpenGL object. Standard object constructor for ProtoFX.
        /// </summary>
        /// <param name="block"></param>
        /// <param name="scene"></param>
        /// <param name="debugging"></param>
        public GLFragoutput(Compiler.Block block, Dict scene, bool debugging)
            : base(block.Name, block.Anno)
        {
            var err = new CompileException($"fragoutput '{name}'");

            // PARSE ARGUMENTS
            Cmds2Fields(block, err);

            // CREATE OPENGL OBJECT
            glname = GL.GenFramebuffer();
            GL.BindFramebuffer(FramebufferTarget.Framebuffer, glname);

            // PARSE COMMANDS
            foreach (var cmd in block)
                Attach(cmd, scene, err | $"command '{cmd.Name}'");

            // if any errors occurred throw exception
            if (err.HasErrors())
                throw err;

            // CHECK FOR OPENGL ERRORS
            Bind();
            var status = GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer);
            Unbind();

            // final error checks
            if (HasErrorOrGlError(err, block))
                throw err;
            if (status != FramebufferErrorCode.FramebufferComplete)
                throw err.Add("Could not be created due to an unknown error.", block);
        }
コード例 #3
0
ファイル: GLVertoutput.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Create OpenGL object. Standard object constructor for ProtoFX.
        /// </summary>
        /// <param name="block"></param>
        /// <param name="scene"></param>
        /// <param name="debugging"></param>
        public GLVertoutput(Compiler.Block block, Dict scene, bool debugging)
            : base(block.Name, block.Anno)
        {
            var err = new CompileException($"vertoutput '{name}'");

            // PARSE ARGUMENTS
            Cmds2Fields(block, err);

            // CREATE OPENGL OBJECT
            glname = GL.GenTransformFeedback();
            GL.BindTransformFeedback(TransformFeedbackTarget.TransformFeedback, glname);

            // parse commands
            int numbindings = 0;
            foreach (var cmd in block["buff"])
                Attach(numbindings++, cmd, scene, err | $"command '{cmd.Text}'");

            // if errors occurred throw exception
            if (err.HasErrors())
                throw err;

            // unbind object and check for errors
            GL.BindTransformFeedback(TransformFeedbackTarget.TransformFeedback, 0);
            if (HasErrorOrGlError(err, block))
                throw err;
        }
コード例 #4
0
ファイル: HttpRequestBase.cs プロジェクト: meta-42/uEasyKit
 protected void SendRequest(string rPath, Dict<string, string> rArgs, ServerType rType, Action<WWW> rOnResponse)
 {
     var url = HttpServerHost + rPath;
     useServerType = rType;
     WaitingLayer.Show();
     this.StartCoroutine(GET(url, rArgs, rOnResponse));
 }
コード例 #5
0
ファイル: DictEdit.aspx.cs プロジェクト: romanu6891/fivemen
    protected void btnSure_Click(object sender, EventArgs e)
    {
        Dict dep = new Dict();
        WebFormHelper.GetDataFromForm(this, dep);
        if(dep.Id<0)
        {
            if (SimpleOrmOperator.Create(dep))
            {
                WebTools.Alert("添加成功!");
            }
            else
            {
                WebTools.Alert("添加失败!");

            }
        }
        else{
            if (SimpleOrmOperator.Update(dep))
            {
                WebTools.Alert("修改成功!");
            }
            else
            {
                WebTools.Alert("修改失败!");

            }

         }
    }
コード例 #6
0
    static List<AssetBundleBuild> GeneratorAssetbundleEntry()
    {
        string path = Application.dataPath + "/" + PackagePlatform.packageConfigPath;
        if (string.IsNullOrEmpty(path)) return null;

        string str = File.ReadAllText(path);

        Dict<string, ABEntry> abEntries = new Dict<string, ABEntry>();

        PackageConfig apc = JsonUtility.FromJson<PackageConfig>(str);

        AssetBundlePackageInfo[] bundlesInfo = apc.bundles;

        for (int i = 0; i < bundlesInfo.Length; i++)
        {
            ABEntry entry = new ABEntry();
            entry.bundleInfo = bundlesInfo[i];

            if (!abEntries.ContainsKey(entry.bundleInfo.name))
            {
                abEntries.Add(entry.bundleInfo.name, entry);
            }
        }

        List<AssetBundleBuild> abbList = new List<AssetBundleBuild>();
        foreach (var rEntryItem in abEntries)
        {
            abbList.AddRange(rEntryItem.Value.ToABBuild());
        }
        return abbList;
    }
コード例 #7
0
ファイル: GLTexture.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Create OpenGL object specifying the referenced scene objects directly.
        /// </summary>
        /// <param name="block"></param>
        /// <param name="scene"></param>
        /// <param name="glbuff"></param>
        /// <param name="glimg"></param>
        public GLTexture(Compiler.Block block, Dict scene, GLBuffer glbuff, GLImage glimg)
            : base(block.Name, block.Anno)
        {
            var err = new CompileException($"texture '{name}'");

            // PARSE ARGUMENTS
            Cmds2Fields(block, err);

            // set name
            glBuff = glbuff;
            glImg = glimg;

            // GET REFERENCES
            if (Buff != null)
                scene.TryGetValue(Buff, out glBuff, block, err);
            if (Img != null)
                scene.TryGetValue(Img, out glImg, block, err);
            if (glBuff != null && glImg != null)
                err.Add("Only an image or a buffer can be bound to a texture object.", block);
            if (glBuff == null && glImg == null)
                err.Add("Ether an image or a buffer has to be bound to a texture object.", block);

            // IF THERE ARE ERRORS THROW AND EXCEPTION
            if (err.HasErrors())
                throw err;

            // INCASE THIS IS A TEXTURE OBJECT
            Link(block.Filename, block.LineInFile, err);
            if (HasErrorOrGlError(err, block))
                throw err;
        }
コード例 #8
0
ファイル: AffairsProvider.aspx.cs プロジェクト: holdbase/IES2
 public static List<Dict> Dict_List(Dict model,int OCID)
 {
     //if (!UserService.OC_IsRole(OCID))
     //{
     //    return null;
     //}
     AffairsBLL affairsBLL = new AffairsBLL();
     return affairsBLL.Dict_List(model);
 }
コード例 #9
0
 static void LoggingHandler(Logger.Level level, string message, Dict args)
 {
     if (args != null)
     {
         foreach (string key in args.Keys) {
             message += string.Format(" {0}: {1},", "" + key, "" + args[key]);
         }
     }
     Console.WriteLine("[ActionTests] [{0}] {1}", level, message);
 }
コード例 #10
0
ファイル: GLTech.cs プロジェクト: h3tch/ProtoFX
 /// <summary>
 /// Parse commands in block.
 /// </summary>
 /// <param name="list"></param>
 /// <param name="block"></param>
 /// <param name="scene"></param>
 /// <param name="err"></param>
 private void ParsePasses(ref List<GLPass> list, Compiler.Block block, Dict scene,
     CompileException err)
 {
     GLPass pass;
     var cmdName = ReferenceEquals(list, init)
         ? "init" : ReferenceEquals(list, passes) ? "pass" : "uninit";
     foreach (var cmd in block[cmdName])
         if (scene.TryGetValue(cmd[0].Text, out pass, block, err | $"command '{cmd.Text}'"))
             list.Add(pass);
 }
コード例 #11
0
ファイル: Page.cs プロジェクト: Green-Orca/WebStuffCore
 public Page(Page p_pParentPage)
 {
     this.Parent = p_pParentPage;
     this.Document = new HtmlDocument();
     this.MetaInfo = new List<PageMeta>();
     this.MetaLinkInfo = new List<PageMetaLink>();
     this.AnchorList = new List<Anchor>();
     this.ImageList = new List<Image>();
     this.OtherTags = new Dict<string, string>();
     this.DirectChildren = new List<Page>();
 }
コード例 #12
0
        public override Dict GetAttrDict(ICallerContext context, object self)
        {
            List attrs = GetAttrNames(context, self);

            Dict res = new Dict();
            foreach (string o in attrs) {
                res[o] = GetAttr(context, self, SymbolTable.StringToId(o));
            }

            return res;
        }
コード例 #13
0
ファイル: UtilService.cs プロジェクト: AgileEAP/WebStack
        public void SaveDict(Dict domain)
        {
            using (Transaction trans = UnitOfWork.BeginTransaction(typeof(Dict)))
            {
                repository.SaveOrUpdate(domain);

                foreach (var item in domain.DictItems)
                    repository.SaveOrUpdate(item);

                trans.Commit();
            }
        }
コード例 #14
0
ファイル: DictTest.cs プロジェクト: bogdanuifalean/JuniorMind
 public void ItShouldAdd()
 {
     Dict<int, string> test = new Dict<int, string>();
     test.Add(1, "One");
     test.Add(2, "Two");
     test.Add(3, "Three");
     test.Add(4, "Four");
     test.Add(5, "Five");
     bool actual = test.ContainsKey(1);
     bool expected = true;
     Assert.AreEqual(expected, actual);
 }
コード例 #15
0
ファイル: DictTest.cs プロジェクト: bogdanuifalean/JuniorMind
 public void ItShouldGetValueForSpecificKey()
 {
     Dict<int, string> test = new Dict<int, string>();
     test.Add(1, "One");
     test.Add(2, "Two");
     test.Add(3, "Three");
     test.Add(4, "Four");
     test.Add(5, "Five");
     test.Add(18, "Eightteen");
     string actual = test[18];
     string expected = "Eightteen";
     Assert.AreEqual(expected, actual);
 }
コード例 #16
0
		internal BaseAction(string type, Options options)
		{
			options = options ?? new Options ();

			this.Type = type;
			this.MessageId = Guid.NewGuid ().ToString();
			if (options.Timestamp.HasValue)
				this.Timestamp = options.Timestamp.ToString ();
            else
                this.Timestamp = DateTime.Now.ToString("o");
			this.Context = options.Context;
			this.Integrations = options.Integrations;
        }
コード例 #17
0
		public void SendBatch(Batch batch)
		{
			Dict props = new Dict {
				{ "batch id", batch.MessageId },
				{ "batch size", batch.batch.Count }
			};

			try
			{
				// set the current request time
				batch.SentAt = DateTime.Now.ToString("o");
				string json = JsonConvert.SerializeObject(batch);
				props["json size"] = json.Length;

				Uri uri = new Uri(_host + "/v1/import");

				HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, uri);

				// basic auth: https://segment.io/docs/tracking-api/reference/#authentication
				request.Headers.Add("Authorization", BasicAuthHeader(batch.WriteKey, ""));
				request.Content = new StringContent(json, Encoding.UTF8, "application/json");

				Logger.Info("Sending analytics request to Segment.io ..", props);

				var start = DateTime.Now;
			
				var response = _client.SendAsync(request).Result;

				var duration = DateTime.Now - start;
				props["success"] = response.IsSuccessStatusCode;
				props["duration (ms)"] = duration.TotalMilliseconds;

				if (response.IsSuccessStatusCode) {
					Succeed(batch);
					Logger.Info("Request successful", props);
				}
				else {
					string reason = string.Format("Status Code {0} ", response.StatusCode);
					reason += response.Content.ToString();
					props["reason"] = reason;
					Logger.Error("Request failed", props);
					Fail(batch, new APIException("Unexpected Status Code", reason));
				}
			}
			catch (System.Exception e)
			{
				props ["reason"] = e.Message;
				Logger.Error ("Request failed", props);
				Fail(batch, e);
			}
		}
コード例 #18
0
ファイル: FXDebugger.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// (Re)initialize the debugger. This method must
        /// be called whenever a program is compiled.
        /// </summary>
        /// <param name="scene"></param>
        public static void Initilize(Dict scene)
        {
            // allocate GPU resources
            buf = new GLBuffer(DbgBufKey, "dbg", BufferUsageHint.DynamicRead, stage_size * 6 * 16);
            tex = new GLTexture(DbgTexKey, "dbg", GpuFormat.Rgba32f, buf, null);

#if DEBUG   // add to scene for debug inspection
            scene.Add(DbgBufKey, buf);
            scene.Add(DbgTexKey, tex);
#endif
            passes.Clear();
            // reset watch count for indexing in debug mode
            dbgVarCount = 0;
        }
コード例 #19
0
ファイル: GLTech.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Create OpenGL object. Standard object constructor for ProtoFX.
        /// </summary>
        /// <param name="block"></param>
        /// <param name="scene"></param>
        /// <param name="debugging"></param>
        public GLTech(Compiler.Block block, Dict scene, bool debugging)
            : base(block.Name, block.Anno)
        {
            var err = new CompileException($"tech '{name}'");

            // PARSE COMMANDS
            ParsePasses(ref init, block, scene, err);
            ParsePasses(ref passes, block, scene, err);
            ParsePasses(ref uninit, block, scene, err);

            // IF THERE ARE ERRORS THROW AND EXCEPTION
            if (err.HasErrors())
                throw err;
        }
コード例 #20
0
ファイル: DictTest.cs プロジェクト: bogdanuifalean/JuniorMind
 public void ItShouldClear()
 {
     Dict<int, string> test = new Dict<int, string>();
     test.Add(1, "One");
     test.Add(2, "Two");
     test.Add(3, "Three");
     test.Add(4, "Four");
     test.Add(5, "Five");
     test.Add(18, "Eightteen");
     test.Clear();
     int expected = 0;
     int actual = test.Count;
     Assert.AreEqual(expected, actual);
 }
コード例 #21
0
ファイル: FFCM.cs プロジェクト: Centny/ffcm
 public virtual HResult OnFfProc(Request r)
 {
     var args = HttpUtility.ParseQueryString(r.req.Url.Query);
     var tid = args.Get("tid");
     var duration_ = args.Get("duration");
     if (String.IsNullOrWhiteSpace(tid) || String.IsNullOrWhiteSpace(duration_))
     {
         r.res.StatusCode = 400;
         r.WriteLine("the tid/duration is required");
         return HResult.HRES_RETURN;
     }
     float duration = 0;
     if (!float.TryParse(duration_, out duration))
     {
         r.res.StatusCode = 400;
         r.WriteLine("the duration must be float");
         return HResult.HRES_RETURN;
     }
     StreamReader reader = new StreamReader(r.req.InputStream);
     String line = null;
     var frame = new Dict();
     while ((line = reader.ReadLine()) != null)
     {
         line = line.Trim();
         if (line.Length < 1)
         {
             continue;
         }
         var kvs = line.Split(new char[] { '=' }, 2);
         var key = kvs[0].Trim();
         if (kvs.Length < 2)
         {
             frame[key] = "";
         }
         else
         {
             frame[key] = kvs[1].Trim();
         }
         if (key != "progress")
         {
             continue;
         }
         var ms = frame.Val<float>("out_time_ms", 0);
         this.DTMC.NotifyProc(tid, ms / duration);
     }
     r.res.StatusCode = 200;
     r.WriteLine("OK");
     r.Flush();
     return HResult.HRES_RETURN;
 }
コード例 #22
0
ファイル: DictTest.cs プロジェクト: bogdanuifalean/JuniorMind
 public void ItShouldRemove()
 {
     Dict<int, string> test = new Dict<int, string>();
     test.Add(1, "One");
     test.Add(2, "Two");
     test.Add(3, "Three");
     test.Add(4, "Four");
     test.Add(5, "Five");
     test.Add(18, "Eightteen");
     test.Remove(3);
     bool actual=test.ContainsKey(3);
     bool expected=false;
     Assert.AreEqual(expected, actual);
 }
コード例 #23
0
ファイル: DictTest.cs プロジェクト: Centny/cswf
 public void ParseTest2()
 {
     var dict = new Dict();
     dict["ival"] = 1f;
     dict["ival_a"] = new float[] { 1, 2, 3 };
     dict["ival_l"] = new List<float> { 10, 20, 30 };
     //
     dict["fval"] = 1;
     dict["fval_a"] = new int[] { 1, 2, 3 };
     dict["fval_l"] = new List<int> { 10, 20, 30 };
     //
     dict["sval"] = "val";
     dict["sval_a"] = new string[] { "a", "b", "c" };
     dict["sval_l"] = new List<string> { "a1", "b1", "c1" };
     //
     dict["oval"] = Util.dict("a", "x1");
     dict["oval_a"] = new IDictionary<string, object>[] {
         Util.dict("a", "x2"),
         Util.dict("a", "x3"),
         Util.dict("a", "x4"),
     };
     dict["oval_l"] = new List<IDictionary<string, object>> {
         Util.dict("a", "x2"),
         Util.dict("a", "x3"),
         Util.dict("a", "x4"),
     };
     var res = (ClsA)dict.Parse(typeof(ClsA));
     //
     Assert.AreEqual(1, res.IVal);
     Assert.AreEqual(3, res.IValA.Length);
     Assert.AreEqual(1, res.IValA[0]);
     Assert.AreEqual(3, res.IValL.Count);
     Assert.AreEqual(10, res.IValL[0]);
     //
     Assert.AreEqual(1f, res.FVal);
     Assert.AreEqual(3, res.FValA.Length);
     Assert.AreEqual(3, res.FValL.Count);
     //
     Assert.AreEqual("val", res.SVal);
     Assert.AreEqual(3, res.SValA.Length);
     Assert.AreEqual(3, res.SValL.Count);
     //
     Assert.AreEqual("x1", res.OVal.A);
     Assert.AreEqual(3, res.OValA.Length);
     Assert.AreEqual(3, res.OValL.Count);
 }
コード例 #24
0
ファイル: HttpRequestSignin.cs プロジェクト: meta-42/uEasyKit
    public void CreateAccount(string account, string password)
    {
        var rPassword = Util.MD5String(password);
        var rArgs = new Dict<string, string>();
        rArgs["acc"] = account;
        rArgs["pass"] = rPassword;
        var rPath = "CreateAccount";
        this.SendRequest(rPath, rArgs, ServerType.LoginServer, (args) =>
        {
            var stream = new MemoryStream(args.bytes);
            StreamReader sr = new StreamReader(stream, System.Text.Encoding.GetEncoding("UTF-8"));
            var ret = UInt32.Parse(sr.ReadLine());

            var eventArgs = new ResponseEventArgs(ret);

            ResponseCreateAccountEvent(this, eventArgs);
        });
    }
コード例 #25
0
ファイル: GLVertinput.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Parse command line and attach the buffer object
        /// to the specified unit (input stream).
        /// </summary>
        /// <param name="unit"></param>
        /// <param name="cmd"></param>
        /// <param name="scene"></param>
        /// <param name="err"></param>
        private void Attach(int unit, Compiler.Command cmd, Dict scene, CompileException err)
        {
            // check commands for errors
            if (cmd.ArgCount < 3)
            {
                err.Add("Command attr needs at least 3 attributes (e.g. 'attr buff_name float 4')", cmd);
                return;
            }

            // parse command arguments
            string buffname = cmd[0].Text;
            string typename = cmd[1].Text;
            int length = int.Parse(cmd[2].Text);
            int stride = cmd.ArgCount > 3 ? int.Parse(cmd[3].Text) : 0;
            int offset = cmd.ArgCount > 4 ? int.Parse(cmd[4].Text) : 0;
            int divisor = cmd.ArgCount > 5 ? int.Parse(cmd[5].Text) : 0;

            GLBuffer buff;
            if (scene.TryGetValue(buffname, out buff, cmd, err) == false)
            {
                err.Add($"Buffer '{buffname}' could not be found.", cmd);
                return;
            }

            // enable vertex array attribute
            GL.BindBuffer(BufferTarget.ArrayBuffer, buff.glname);
            GL.EnableVertexAttribArray(unit);

            // bind buffer to vertex array attribute
            VertAttrIntType typei;
            VertAttrType typef;
            if (Enum.TryParse(typename, true, out typei))
                GL.VertexAttribIPointer(unit, length, (IntType)typei, stride, (IntPtr)offset);
            else if (Enum.TryParse(typename, true, out typef))
                GL.VertexAttribPointer(unit, length, (PointerType)typef, false, stride, offset);
            else
                err.Add($"Type '{typename}' is not supported.", cmd);

            if (divisor > 0)
                GL.VertexAttribDivisor(unit, divisor);

            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
        }
コード例 #26
0
ファイル: DocCovTest.cs プロジェクト: Centny/cswf.doc
        public void TestDoWord()
        {
            TaskPool.Shared.MaximumConcurrency = 3;
            FCfg cfg = new FCfg();
            DocCovT cov;
            cov = new DocCovT("DocCov", cfg);
            cov.DoCmd("a1", cfg, "Word test\\xx.docx docx_00-{0}.jpg 768 1024");
            while (cov.done == null)
            {
                Thread.Sleep(500);
            }

            var data_ = cov.done as IDictionary<string, object>;
            var data = new Dict(data_);
            Assert.AreEqual(0, data.Val("code", -1));
            Assert.AreEqual("a1", data.Val("tid", ""));
            var res = data["data"] as CovRes;
            Assert.AreEqual(true, res.Count > 0 && res.Count == res.Files.Count);
            Assert.AreNotEqual(0, cov.rate);
            //
            cov = new DocCovT("DocCov", cfg);
            cov.DoCmd("a2", cfg, "Word test\\xx.docxx docx_00-{0}.jpg 768 1024");
            while (cov.done == null)
            {
                Thread.Sleep(500);
            }
            data_ = cov.done as IDictionary<string, object>;
            data = new Dict(data_);
            Assert.AreNotEqual(0, data.Val("code", 0));
            Assert.AreEqual("a2", data.Val("tid", ""));
            var err = data["err"] as String;
            Assert.AreNotEqual(0, err.Length);
            //
            //
            cov = new DocCovT("DocCov", cfg);
            cov.error = true;
            cov.DoCmd("a2", cfg, "Word test\\xx.docx docx_01-{0}.jpg 768 1024");
            while (!cov.do_err)
            {
                Thread.Sleep(500);
            }
        }
コード例 #27
0
ファイル: NodeFactory.cs プロジェクト: koksaver/CodeHelper
        //static T CreateNode<T>(DatabaseType dbType) where T : BaseNode
        //{
        //    if (dbType == DatabaseType.SqlServer)
        //    {
        //        if (typeof(T).Equals(typeof(FieldNode)))
        //        {
        //            BaseNode node = new SqlFieldNode();
        //            return (T)node;
        //        }
        //        if (typeof(T).Equals(typeof(ColumnNode)))
        //        {
        //            BaseNode node = new SqlColumnNode();
        //            return (T)node;
        //        }
        //    }
        //    if (dbType == DatabaseType.Postgres)
        //    {
        //        if (typeof(T).Equals(typeof(FieldNode)))
        //        {
        //            BaseNode node = new PostgresFieldNode();
        //            return (T)node;
        //        }
        //        if (typeof(T).Equals(typeof(ColumnNode)))
        //        {
        //            BaseNode node = new PostgresColumnNode();
        //            return (T)node;
        //        }
        //    }
        //    return default(T);
        //}
        //public static T CreateNode<T>() where T : BaseNode
        //{
        //    if (GlobalService.DbType == DatabaseType.UnKnown)
        //    {
        //        System.Windows.Forms.MessageBox.Show("请确保选择一个链接节点");
        //        return null;
        //    }
        //    return CreateNode<T>(GlobalService.DbType);
        //}
        public static BaseNode Create(Dict.NodeType nodeType , string name = null, string text = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
            }

            BaseNode node = null;
            if (nodeType == Dict.NodeType.Unknown)
                throw new Exception("必须有节点类型");

            if (nodeType == Dict.NodeType.Project)
                node = new DesignProjectNode();
            if (nodeType == Dict.NodeType.XmlModelSet)
                node = new XmlModelSetNode();
            if (nodeType == Dict.NodeType.XmlModel)
                node = new XmlModelNode();
            if (nodeType == Dict.NodeType.DataModelSet)
                node= new DataModelSetNode();
            if (nodeType == Dict.NodeType.DataModel)
                node = new DataModelNode();
            //if (nodeType == Dict.NodeType.DataViewSet)
            //    node = new DataViewSetNode();
            //if (nodeType == Dict.NodeType.DataView)
            //    node = new DataViewNode();
            //if (nodeType == Dict.NodeType.ViewModel)
            //    node = new ViewModelNode();
            //if (nodeType == Dict.NodeType.ViewModelSet)
            //    node = new ViewModelSetNode();
            //if (nodeType == Dict.NodeType.WorkFlow)
            //    node = new WorkFlowNode();
            //if (nodeType == Dict.NodeType.WorkFlowSet)
            //    node = new WorkFlowSetNode();

            if (node != null)
            {
                if (name != null) node.Name = name;
                if (text != null) node.Text = text;
            }

            return node;
        }
コード例 #28
0
ファイル: HttpRequestBase.cs プロジェクト: meta-42/uEasyKit
    IEnumerator GET(string url, Dict<string, string> rArgs, Action<WWW> rOnResponse)
    {
        string Parameters;
        bool first;

        if (rArgs.Count > 0)
        {
            first = true;
            Parameters = "?";

            foreach (var arg in rArgs)
            {
                if (first) first = false;
                else Parameters += "&";

                Parameters += arg.Key + "=" + arg.Value;
            }
        }
        else
        {
            Parameters = "";
        }

        url = url + Parameters;
        WWW rWWW = new WWW(url);
        yield return rWWW;

        if (rWWW.error != null)
        {
            Debug.Log("error :" + rWWW.error);

        }
        else
        {
            rOnResponse.Invoke(rWWW);
            rWWW.Dispose();
            rWWW = null;
        }
        Destroy(this);
        WaitingLayer.Hide();
    }
コード例 #29
0
ファイル: HttpRequestSignin.cs プロジェクト: meta-42/uEasyKit
    public void CreateRole(string account, string loginKey, UInt32 serverID, string roleName, UInt32 p)
    {
        var rArgs = new Dict<string, string>();
        rArgs["acc"] = account;
        rArgs["key"] = loginKey;
        rArgs["sid"] = serverID.ToString();
        rArgs["n"] = roleName;
        rArgs["p"] = p.ToString();

        var rPath = "CreateRole";
        this.SendRequest(rPath, rArgs, ServerType.LoginServer, (args) =>
        {
            var stream = new MemoryStream(args.bytes);
            StreamReader sr = new StreamReader(stream, System.Text.Encoding.GetEncoding("UTF-8"));
            var ret = UInt32.Parse(sr.ReadLine());

            var eventArgs = new ResponseEventArgs(ret);

            ResponseCreateRoleEvent(this, eventArgs);
        });
    }
コード例 #30
0
ファイル: GLVertinput.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Create OpenGL object. Standard object constructor for ProtoFX.
        /// </summary>
        /// <param name="block"></param>
        /// <param name="scene"></param>
        /// <param name="debugging"></param>
        public GLVertinput(Compiler.Block block, Dict scene, bool debugging)
            : base(block.Name, block.Anno)
        {
            var err = new CompileException($"vertinput '{name}'");

            // CREATE OPENGL OBJECT
            glname = GL.GenVertexArray();
            GL.BindVertexArray(glname);

            int numAttr = 0;
            foreach (var cmd in block["attr"])
                Attach(numAttr++, cmd, scene, err | $"command '{cmd.Text}'");

            // if errors occurred throw exception
            if (err.HasErrors())
                throw err;

            // unbind object and check for errors
            GL.BindVertexArray(0);
            if (HasErrorOrGlError(err, block))
                throw err;
        }
コード例 #31
0
 private async void SelectListFavoriteWords_OnLoaded(object sender, RoutedEventArgs e)
 {
     SelectListFavoriteWords.ItemsSource = null;
     SelectListFavoriteWords.ItemsSource = await Dict.LoadFavoriteWords();
 }
コード例 #32
0
        initializeCommandDefaults()
        {
            fGrading.cmdRTr_Default = "R";
            Dict.setCmdDefault("cmdRTr", "cmdDefault", "R");

            fGrading.cmdRTr_Slope = "0.015";
            Dict.setCmdDefault("cmdRTr", "Slope", "0.015");

            fGrading.cmdRTr_DeltaZ = "-4.04";
            Dict.setCmdDefault("cmdRTr", "DeltaZ", "-4.04");


            fGrading.cmdRTd_Default = "D";
            Dict.setCmdDefault("cmdRTd", "cmdDefault", "D");

            fGrading.cmdRTd_Distance = "0";
            Dict.setCmdDefault("cmdRTd", "Distance", "0");

            fGrading.cmdRTd_Elevation = "0";
            Dict.setCmdDefault("cmdRTd", "Elevation", "0");

            fGrading.cmdRTd_Slope = "0.015";
            Dict.setCmdDefault("cmdRTd", "Slope", "0.015");


            fGrading.cmdRL_Default = "R";
            Dict.setCmdDefault("cmdRL", "cmdDefault", "R");

            fGrading.cmdRL_GRADE = "0.005";
            Dict.setCmdDefault("cmdRL", "GRADE", "0.005");

            fGrading.cmdRL_DELTAZ = "-4.04";
            Dict.setCmdDefault("cmdRL", "DELTAZ", "-4.04");


            fGrading.cmdBV_Control = "FL";
            Dict.setCmdDefault("cmdBV", "CONTROL", "FL");

            fGrading.cmdBV_Source = "POINTS";
            Dict.setCmdDefault("cmdBV", "SOURCE", "POINTS");

            fGrading.cmdBV_GutterDepth = "0.17";
            Dict.setCmdDefault("cmdBV", "GUTTERDEPTH", "0.17");

            fGrading.cmdBV_GutterWidth = "3.0";
            Dict.setCmdDefault("cmdBV", "GUTTERWIDTH", "3.0");


            fGrading.cmdFL_resBot = "FL";
            Dict.setCmdDefault("cmdFL", "resBot", "FL");

            fGrading.cmdG_resBot = "FL";
            Dict.setCmdDefault("cmdFL", "resTop", "TC");


            fGrading.cmdG_resBot = "FL";
            Dict.setCmdDefault("cmdG", "resBot", "FL");
            fGrading.cmdG_resTop = "TC";
            Dict.setCmdDefault("cmdG", "resTop", "TC");
            fGrading.cmdG_resCurb = "0.50";
            Dict.setCmdDefault("cmdG", "resCurb", "0.50");


            fGrading.cmdLD_resBot = "";
            Dict.setCmdDefault("cmdLD", "resBot", "");
            fGrading.cmdLD_resTop = "";
            Dict.setCmdDefault("cmdLD", "resTop", "");


            Dict.setCmdDefault("cmdSDS", "resPrefix", "FL");
            Dict.setCmdDefault("cmdSDS", "resSuffix", "TC");
            Dict.setCmdDefault("cmdSDS", "resDesc", "0.50");


            Dict.setCmdDefault("cmdSDE", "resPrefix", "STA");
            Dict.setCmdDefault("cmdSDE", "resSuffix", "BC");
            Dict.setCmdDefault("cmdSDE", "resDesc", "");
            Dict.setCmdDefault("cmdSDE", "resElevSuf", "INV");


            Dict.setCmdDefault("cmdSED", "resPrefix", "STA");
            Dict.setCmdDefault("cmdSED", "resSuffix", "BC");
            Dict.setCmdDefault("cmdSED", "resDesc", "");
            Dict.setCmdDefault("cmdSED", "resElevSuf", "INV");
        }
コード例 #33
0
ファイル: Dict.cs プロジェクト: zsy3105/UnityFramework
 public static bool ContainsKey <TKey, TValue>(this Dict <TKey, TValue> rDict, TKey key)
 {
     return(rDict.Collection.ContainsKey((object)key));
 }
コード例 #34
0
        private FR_Base Load(DbConnection Connection, DbTransaction Transaction, Guid ObjectID, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                #region Verify/Create Connections
                //Create connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                //If transaction is not open/not valid
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }
                #endregion
                //Get the SelectQuerry
                string SelectQuery = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_CMN_BPT_EMP.CMN_BPT_EMP_ExtraWorkCalculation.SQL.Select.sql")).ReadToEnd();

                DbCommand command = Connection.CreateCommand();
                //Set Connection/Transaction
                command.Connection  = Connection;
                command.Transaction = Transaction;
                //Set Query/Timeout
                command.CommandText    = SelectQuery;
                command.CommandTimeout = QueryTimeout;

                //Firstly, before loading, set the GUID to empty
                //So the entity does not exist, it will have a GUID set to empty
                _CMN_BPT_EMP_ExtraWorkCalculationID = Guid.Empty;
                CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CMN_BPT_EMP_ExtraWorkCalculationID", ObjectID);

                #region Command Execution
                try
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());
                    reader.SetOrdinals(new string[] { "CMN_BPT_EMP_ExtraWorkCalculationID", "GlobalPropertyMatchingID", "ExtraWorkCalculation_Name_DictID", "IsCalculatingOvertimeEnabled", "AreAdditionalWorkDays_CalculatedIn_Hours", "AreAdditionalWorkDays_CalculatedIn_DaysAsHours", "AreAdditionalWorkDays_CalculatedIn_Days", "StandardWorkDay_in_mins", "IsDisplayedAs_HoursAsDays", "IsDisplayedAs_DaysAndHours", "MinimalOvertimeTreshold_in_minutes", "Creation_Timestamp", "IsDeleted", "Tenant_RefID" });
                    if (reader.HasRows == true)
                    {
                        reader.Read();                         //Single result only
                        //0:Parameter CMN_BPT_EMP_ExtraWorkCalculationID of type Guid
                        _CMN_BPT_EMP_ExtraWorkCalculationID = reader.GetGuid(0);
                        //1:Parameter GlobalPropertyMatchingID of type String
                        _GlobalPropertyMatchingID = reader.GetString(1);
                        //2:Parameter ExtraWorkCalculation_Name of type Dict
                        _ExtraWorkCalculation_Name = reader.GetDictionary(2);
                        loader.Append(_ExtraWorkCalculation_Name, TableName);
                        //3:Parameter IsCalculatingOvertimeEnabled of type Boolean
                        _IsCalculatingOvertimeEnabled = reader.GetBoolean(3);
                        //4:Parameter AreAdditionalWorkDays_CalculatedIn_Hours of type Boolean
                        _AreAdditionalWorkDays_CalculatedIn_Hours = reader.GetBoolean(4);
                        //5:Parameter AreAdditionalWorkDays_CalculatedIn_DaysAsHours of type Boolean
                        _AreAdditionalWorkDays_CalculatedIn_DaysAsHours = reader.GetBoolean(5);
                        //6:Parameter AreAdditionalWorkDays_CalculatedIn_Days of type Boolean
                        _AreAdditionalWorkDays_CalculatedIn_Days = reader.GetBoolean(6);
                        //7:Parameter StandardWorkDay_in_mins of type int
                        _StandardWorkDay_in_mins = reader.GetInteger(7);
                        //8:Parameter IsDisplayedAs_HoursAsDays of type Boolean
                        _IsDisplayedAs_HoursAsDays = reader.GetBoolean(8);
                        //9:Parameter IsDisplayedAs_DaysAndHours of type Boolean
                        _IsDisplayedAs_DaysAndHours = reader.GetBoolean(9);
                        //10:Parameter MinimalOvertimeTreshold_in_minutes of type int
                        _MinimalOvertimeTreshold_in_minutes = reader.GetInteger(10);
                        //11:Parameter Creation_Timestamp of type DateTime
                        _Creation_Timestamp = reader.GetDate(11);
                        //12:Parameter IsDeleted of type Boolean
                        _IsDeleted = reader.GetBoolean(12);
                        //13:Parameter Tenant_RefID of type Guid
                        _Tenant_RefID = reader.GetGuid(13);
                    }
                    //Close the reader so other connections can use it
                    reader.Close();

                    loader.Load();

                    if (_CMN_BPT_EMP_ExtraWorkCalculationID != Guid.Empty)
                    {
                        //Successfully loaded
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    else
                    {
                        //Fault in loading due to invalid UUID (Guid)
                        Status_IsAlreadySaved = false;
                        Status_IsDirty        = false;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                #endregion

                #region Cleanup Transaction/Connection
                //If we started the transaction, we will commit it
                if (cleanupTransaction && Transaction != null)
                {
                    Transaction.Commit();
                }

                //If we opened the connection we will close it
                if (cleanupConnection && Connection != null)
                {
                    Connection.Close();
                }

                #endregion
            } catch (Exception ex) {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw ex;
            }

            return(retStatus);
        }
コード例 #35
0
        MCG()
        {
            object dynMode   = null;
            object dynPrompt = null;
            object osMode    = null;

            try
            {
                dynMode   = Application.GetSystemVariable("DYNMODE");
                dynPrompt = Application.GetSystemVariable("DYNPROMPT");

                Application.SetSystemVariable("DYNMODE", 3);
                Application.SetSystemVariable("DYNPROMPT", 1);

                osMode = SnapMode.getOSnap();
                SnapMode.setOSnap((int)osModes.NOD);

                string       descVal = "", descKey = "";
                Point3d      pnt3dPick;
                PromptStatus ps;
                CogoPoint    cgPnt;
                Entity       ent    = Select.selectEntity(typeof(CogoPoint), "\nSelect a point on the desired group or <CR> for Menu: ", "", out pnt3dPick, out ps);
                short        color  = 256;
                string       prompt = "";
                TypedValue[] tvs;

                switch (ps)
                {
                case PromptStatus.OK:
                    cgPnt   = (CogoPoint)ent;
                    descVal = cgPnt.RawDescription;
                    break;

                case PromptStatus.Cancel:
                    return;

                case PromptStatus.None:
                    bool     exists;
                    ObjectId idDict = Dict.getNamedDictionary("cmdMCG", out exists);
                    if (exists)
                    {
                        ResultBuffer rb = Dict.getXRec(idDict, "defaultCmd");
                        if (rb == null)
                        {
                            descVal = "CPNT-ON";
                        }
                        else
                        {
                            tvs     = rb.AsArray();
                            descVal = tvs[0].Value.ToString();
                        }
                    }
                    else
                    {
                        descVal = "CPNT-ON";
                    }
                    descKey = "O";
                    foreach (CgPnt_Group.pntGroupParams pntGrp in CgPnt_Group.pntGroups)
                    {
                        if (pntGrp.name == descVal)
                        {
                            descKey = pntGrp.key;
                            break;
                        }
                    }

                    bool escape;
                    prompt = string.Format("\nSelect [cpntJoin/cpntOn/cpntSt/cpntTrans/cpntMisc/utlSEw/utlSD/utlWat/utlMIsc/Cp/SPnt/Exist/eXit] <{0}> [J/O/S/T/M/SE/SD/W/MI/C/SP/E/X]", descVal);
                    escape = UserInput.getUserInputKeyword(descKey, out descKey, prompt, "J O S T M SE SD W MI C SP E X");
                    if (escape)
                    {
                        return;
                    }

                    if (descKey.ToUpper() == "X")
                    {
                        return;
                    }

                    exists = false;
                    foreach (CgPnt_Group.pntGroupParams pntGrp in CgPnt_Group.pntGroups)
                    {
                        if (pntGrp.key == descKey)
                        {
                            descVal = pntGrp.name;
                            color   = pntGrp.color;
                            exists  = true;
                            break;
                        }
                    }

                    if (!exists)
                    {
                        Application.ShowAlertDialog("Value entered is out of range. Exiting...");
                        return;
                    }

                    break;
                }
                Layer.manageLayers(descVal);
                ObjectId idPntLblStyle = Pnt_Style.getPntLabelStyle(descVal);
                ObjectId idPntStyle    = Pnt_Style.getPntStyle(descVal);

                Layer.manageLayer(descVal, color);

                prompt = string.Format("\nSelect Point(s) to be moved to group {0}\r", descVal);

                Editor ed = BaseObjs._editor;

                tvs = new TypedValue[1];
                Type type = typeof(CogoPoint);
                tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(type).DxfName), 0);

                SelectionFilter        filter = new SelectionFilter(tvs);
                PromptSelectionOptions pso    = new PromptSelectionOptions();
                pso.MessageForAdding            = prompt;
                pso.MessageForRemoval           = "\nRemove Items";
                pso.RejectObjectsOnLockedLayers = true;

                PromptSelectionResult psr = null;
                BaseObjs.acadActivate();

                psr = BaseObjs._editor.GetSelection(pso, filter);
                SelectionSet ss = psr.Value;

                if (ss != null && ss.Count > 0)
                {
                    ObjectId[] ids = ss.GetObjectIds();
                    try
                    {
                        using (Transaction tr = BaseObjs.startTransactionDb())
                        {
                            foreach (ObjectId id in ids)
                            {
                                CogoPoint cogoPnt = (CogoPoint)tr.GetObject(id, OpenMode.ForWrite);
                                cogoPnt.RawDescription = descVal;
                                cogoPnt.Layer          = descVal;
                                cogoPnt.LabelStyleId   = idPntLblStyle;
                                cogoPnt.StyleId        = idPntStyle;
                            }
                            tr.Commit();
                        }
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(ex.Message + " cmdMCG.cs: line: 155");
                    }
                    CgPnt_Group.updatePntGroups();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdMCG.cs: line: 162");
            }
            finally
            {
                SnapMode.setOSnap((int)osMode);
                Application.SetSystemVariable("DYNMODE", (Int16)dynMode);
                Application.SetSystemVariable("DYNPROMPT", (Int16)dynPrompt);
            }
        }
コード例 #36
0
 public virtual void Add <T>(NetMsgEnum netMsg)
 {
     Dict.Add((UInt32)netMsg, typeof(T));
 }
コード例 #37
0
 /// <summary>
 /// Получить имя файла словаря в зависимости от культуры SCADA
 /// </summary>
 public static string GetDictionaryFileName(string directory, string fileNamePrefix)
 {
     return(Dict.GetFileName(directory, fileNamePrefix, Culture.Name));
 }
コード例 #38
0
ファイル: SmartETLTool.cs プロジェクト: reilf/Hawk
        private void InitUI()

        {
            var alltools = CurrentETLTools.Take(ETLMount).ToList();


            if (generateFloatGrid)
            {
                var gridview = PluginProvider.GetObjectInstance <IDataViewer>("可编辑列表");

                var r = gridview.SetCurrentView(Documents);

                if (ControlExtended.DockableManager == null)
                {
                    return;
                }

                ControlExtended.DockableManager.AddDockAbleContent(
                    FrmState.Custom, r, "样例数据");
                generateFloatGrid = false;
            }
            else
            {
                var view = new GridView();


                Dict.Clear();
                var keys = new List <string> {
                    ""
                };
                var docKeys = Documents.GetKeys(null, SampleMount);

                keys.AddRange(docKeys);
                var tool = CurrentTool;


                foreach (var key in keys)
                {
                    var col = new GridViewColumn
                    {
                        Header = key,
                        DisplayMemberBinding = new Binding($"[{key}]"),
                        Width = 155
                    };
                    view.Columns.Add(col);

                    var group = new SmartGroup
                    {
                        Name  = key,
                        Value = alltools.Where(d => d.Column == key).ToList()
                    };

                    group.PropertyChanged += (s, e) =>
                    {
                        if (e.PropertyName == "Name")
                        {
                            var last = alltools.LastOrDefault() as IColumnDataTransformer;
                            if (last != null && last.TypeName == "列名修改器" && last.NewColumn == key)
                            {
                                last.NewColumn = group.Name;
                            }
                            else
                            {
                                last           = PluginProvider.GetObjectInstance("列名修改器") as IColumnDataTransformer;
                                last.NewColumn = group.Name;
                                last.Column    = key;
                                InsertModule(last);
                                ETLMount++;
                                OnPropertyChanged("ETLMount");
                                RefreshSamples();
                            }
                        }
                    };
                    Dict.Add(group
                             );
                }
                if (tool != null)
                {
                    Dict.Where(d => d.Name == tool.Column).Execute(d => d.GroupType = GroupType.Input);
                    var transformer = tool as IColumnDataTransformer;
                    if (transformer != null)
                    {
                        var newcol = transformer.NewColumn.Split(' ');
                        if (transformer.IsMultiYield)
                        {
                            Dict.Execute(d => d.GroupType = newcol.Contains(d.Name)? GroupType.Input:GroupType.Output);
                        }
                        else
                        {
                            Dict.Where(d => d.Name == transformer.NewColumn).Execute(d => d.GroupType = GroupType.Output);;
                        }
                    }
                }
                var nullgroup = Dict.FirstOrDefault(d => string.IsNullOrEmpty(d.Name));
                nullgroup?.Value.AddRange(
                    alltools.Where(
                        d =>
                        Documents.GetKeys().Contains(d.Column) == false &&
                        string.IsNullOrEmpty(d.Column) == false));
                if (MainDescription.IsUIForm && IsUISupport)
                {
                    if (dataView != null)
                    {
                        dataView.View = view;
                    }
                }
            }
        }
コード例 #39
0
    public static void Init()
    {
        Attributes = new List <int>();
        Props      = new List <int>();
        //楼层初始化(怪物、Npc、门、装备、道具)
        CurMapId          = System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["mapId"][1]);//初始楼层id | = 2
        heroDir           = System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["heroDir"][1]);
        ReachFloorIdLimit = new Vector2Int(2, System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["maxArriveMapId"][1]));
        PurchaseCount     = System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["purchaseCount"][1]);

        string _dbName  = Dict.SaveDBName;
        string _tabName = "z_save_hero_info";
        Dictionary <string, Dictionary <int, object> > _cols = Dict.GetAllDict()[_dbName][_tabName];

        //属性赋值
        //int _index = 1;
        //if (Dict.GetInt(_dbName, _tabName, "saveId", 1) > 0)
        //{

        //    for (int _id = 1; _id <= _cols.Count; _id++)
        //    {

        //        foreach (string _col in _cols.Keys)
        //        {

        //            if (_index == _id)
        //            {

        //                int _value;
        //                _value = Dict.GetInt(_dbName, _tabName, _col, 1);

        //            }

        //        }

        //    }

        //}
        //else
        //{

        Attributes.Add(Dict.GetInt(_dbName, _tabName, "saveId", 1));           //saveId     ==>  0
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "hp", 1));               //hp             ==>  1
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "at", 1));               //at             ==>  2
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "df", 1));               //df             ==>  3
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "gold", 1));             //gold           ==>  4
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "exp", 1));              //exp            ==>  5
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "lv", 1));               //lv             ==>  6
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "equip01", 1));          //equip01        ==>  7
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "equip02", 1));          //equip02        ==>  8
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "keyRed", 1));           //keyred         ==>  9
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "keyBlue", 1));          //keyblue        ==>  10
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "keyYellow", 1));        //keyyellow      ==>  11
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "isProp2Advanced", 1));  //isprop2advanced  ==>  12 火眼金睛是否强化 0 未强化 1 已强化
        Attributes.Add(Dict.GetInt(_dbName, _tabName, "isProp16Advanced", 1)); //isprop16advanced ==>  13 筋斗云是否强化 0 未强化 1 已强化

        //}

        int         _i  = 0;
        GameManager _gm = GameObject.FindWithTag("GameManager").GetComponent <GameManager>();

        foreach (var text in _gm.MyUI.AttrsValue)
        {
            text.text  = "";
            text.text += Attributes[_i];
            _i++;
        }

        //道具赋值
        _dbName  = Dict.SqlDBName;
        _tabName = "prop";
        for (int _id = 1; _id <= Dict.GetColCount(_dbName, _tabName); _id++)
        {
            Props.Add(Dict.GetInt(_dbName, _tabName, "value", _id));
        }
        RefreshUI();
    }
コード例 #40
0
ファイル: ViewController.cs プロジェクト: xJayLee/knight
 public ViewController()
 {
     this.ViewModels = new Dict <string, ViewModel>();
 }
コード例 #41
0
ファイル: Data.cs プロジェクト: 2cwldys/fodev-tools
 public static bool HasKey(int key)
 {
     return(Dict.ContainsKey(key));
 }
コード例 #42
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5PA_SPED_1313 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();
            returnValue.Result = false;

            P_L2LN_GALFTID_1530 langParam = new P_L2LN_GALFTID_1530();
            langParam.Tenant_RefID = securityTicket.TenantID;
            var DBLanguages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, langParam, securityTicket).Result;

            var medPro_Credentials = cls_Get_TenantMemershipData.Invoke(Connection, Transaction, securityTicket).Result;
            var examination        = ORM_HEC_ACT_PerformedAction.Query.Search(Connection, Transaction, new ORM_HEC_ACT_PerformedAction.Query()
            {
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID,
                HEC_ACT_PerformedActionID = Parameter.ExaminationID
            }).Single();
            #region save

            foreach (var item in Parameter.newDiagnoses)
            {
                if (medPro_Credentials.Credantial != null)
                {
                    var potentialDiagnosisQuery = new ORM_HEC_DIA_PotentialDiagnosis.Query();
                    potentialDiagnosisQuery.IsDeleted             = false;
                    potentialDiagnosisQuery.Tenant_RefID          = securityTicket.TenantID;
                    potentialDiagnosisQuery.PotentialDiagnosisITL = item.DiagnoseITL;

                    var potentialDiagnosis = ORM_HEC_DIA_PotentialDiagnosis.Query.Search(Connection, Transaction, potentialDiagnosisQuery).SingleOrDefault();

                    if (potentialDiagnosis == null)
                    {
                        potentialDiagnosis = new ORM_HEC_DIA_PotentialDiagnosis();
                        potentialDiagnosis.HEC_DIA_PotentialDiagnosisID = Guid.NewGuid();
                        potentialDiagnosis.ICD10_Code = item.DiagnoseICD10;

                        Dict name = new Dict("hec_dia_potentialdiagnoses");
                        for (int i = 0; i < DBLanguages.Length; i++)
                        {
                            name.AddEntry(DBLanguages[i].CMN_LanguageID, item.DiagnoseName);
                        }
                        potentialDiagnosis.PotentialDiagnosis_Name = name;
                        potentialDiagnosis.PotentialDiagnosisITL   = item.DiagnoseITL;
                        potentialDiagnosis.Tenant_RefID            = securityTicket.TenantID;
                        potentialDiagnosis.Creation_Timestamp      = DateTime.Now;
                        potentialDiagnosis.Modification_Timestamp  = DateTime.Now;
                        potentialDiagnosis.Save(Connection, Transaction);
                    }

                    //check if exists active patient diagnoses (same one)
                    var patientDiagQuery = new ORM_HEC_Patient_Diagnosis.Query();
                    patientDiagQuery.IsDeleted    = false;
                    patientDiagQuery.Tenant_RefID = securityTicket.TenantID;
                    patientDiagQuery.R_IsActive   = true;
                    patientDiagQuery.R_PotentialDiagnosis_RefID = potentialDiagnosis.HEC_DIA_PotentialDiagnosisID;
                    patientDiagQuery.Patient_RefID = Parameter.PatientID;
                    var patientDiagExists = ORM_HEC_Patient_Diagnosis.Query.Search(Connection, Transaction, patientDiagQuery).SingleOrDefault();

                    if (patientDiagExists == null)
                    {
                        ORM_HEC_Patient_Diagnosis patientDiagnoses = new ORM_HEC_Patient_Diagnosis();
                        patientDiagnoses.HEC_Patient_DiagnosisID = Guid.NewGuid();
                        patientDiagnoses.Creation_Timestamp      = DateTime.Now;
                        patientDiagnoses.Modification_Timestamp  = DateTime.Now;
                        patientDiagnoses.R_IsActive                 = true;
                        patientDiagnoses.Patient_RefID              = Parameter.PatientID;
                        patientDiagnoses.Tenant_RefID               = securityTicket.TenantID;
                        patientDiagnoses.R_DiagnosedOnDate          = examination.IfPerfomed_DateOfAction;
                        patientDiagnoses.R_ScheduledExpiryDate      = patientDiagnoses.R_DiagnosedOnDate.AddDays(item.days_valid);
                        patientDiagnoses.R_PotentialDiagnosis_RefID = potentialDiagnosis.HEC_DIA_PotentialDiagnosisID;
                        patientDiagnoses.Save(Connection, Transaction);

                        ORM_HEC_ACT_PerformedAction_DiagnosisUpdate diagnosisUpdate = new ORM_HEC_ACT_PerformedAction_DiagnosisUpdate();
                        diagnosisUpdate.HEC_ACT_PerformedAction_DiagnosisUpdateID = Guid.NewGuid();
                        diagnosisUpdate.Creation_Timestamp            = DateTime.Now;
                        diagnosisUpdate.Modification_Timestamp        = DateTime.Now;
                        diagnosisUpdate.Tenant_RefID                  = securityTicket.TenantID;
                        diagnosisUpdate.ScheduledExpiryDate           = DateTime.Now.AddDays(item.days_valid);
                        diagnosisUpdate.PotentialDiagnosis_RefID      = potentialDiagnosis.HEC_DIA_PotentialDiagnosisID;
                        diagnosisUpdate.HEC_Patient_Diagnosis_RefID   = patientDiagnoses.HEC_Patient_DiagnosisID;
                        diagnosisUpdate.HEC_ACT_PerformedAction_RefID = Parameter.ExaminationID;
                        diagnosisUpdate.Save(Connection, Transaction);
                    }
                }
                else
                {
                    var potentialDiagnosisQuery = new ORM_HEC_DIA_PotentialDiagnosis.Query();
                    potentialDiagnosisQuery.IsDeleted    = false;
                    potentialDiagnosisQuery.Tenant_RefID = securityTicket.TenantID;
                    potentialDiagnosisQuery.HEC_DIA_PotentialDiagnosisID = new Guid(item.DiagnoseITL);

                    var potentialDiagnosis = ORM_HEC_DIA_PotentialDiagnosis.Query.Search(Connection, Transaction, potentialDiagnosisQuery).SingleOrDefault();


                    //check if exists active patient diagnoses (same one)
                    var patientDiagQuery = new ORM_HEC_Patient_Diagnosis.Query();
                    patientDiagQuery.IsDeleted    = false;
                    patientDiagQuery.Tenant_RefID = securityTicket.TenantID;
                    patientDiagQuery.R_IsActive   = true;
                    patientDiagQuery.R_PotentialDiagnosis_RefID = potentialDiagnosis.HEC_DIA_PotentialDiagnosisID;

                    var patientDiagExists = ORM_HEC_Patient_Diagnosis.Query.Search(Connection, Transaction, patientDiagQuery).SingleOrDefault();

                    if (patientDiagExists == null)
                    {
                        ORM_HEC_Patient_Diagnosis patientDiagnoses = new ORM_HEC_Patient_Diagnosis();
                        patientDiagnoses.HEC_Patient_DiagnosisID = Guid.NewGuid();
                        patientDiagnoses.Creation_Timestamp      = DateTime.Now;
                        patientDiagnoses.Modification_Timestamp  = DateTime.Now;
                        patientDiagnoses.R_IsActive                 = true;
                        patientDiagnoses.Patient_RefID              = Parameter.PatientID;
                        patientDiagnoses.Tenant_RefID               = securityTicket.TenantID;
                        patientDiagnoses.R_DiagnosedOnDate          = DateTime.Now;
                        patientDiagnoses.R_ScheduledExpiryDate      = DateTime.Now.AddDays(item.days_valid);
                        patientDiagnoses.R_PotentialDiagnosis_RefID = potentialDiagnosis.HEC_DIA_PotentialDiagnosisID;
                        patientDiagnoses.Save(Connection, Transaction);

                        ORM_HEC_ACT_PerformedAction_DiagnosisUpdate diagnosisUpdate = new ORM_HEC_ACT_PerformedAction_DiagnosisUpdate();
                        diagnosisUpdate.HEC_ACT_PerformedAction_DiagnosisUpdateID = Guid.NewGuid();
                        diagnosisUpdate.Creation_Timestamp            = DateTime.Now;
                        diagnosisUpdate.Modification_Timestamp        = DateTime.Now;
                        diagnosisUpdate.Tenant_RefID                  = securityTicket.TenantID;
                        diagnosisUpdate.ScheduledExpiryDate           = DateTime.Now.AddDays(item.days_valid);
                        diagnosisUpdate.PotentialDiagnosis_RefID      = potentialDiagnosis.HEC_DIA_PotentialDiagnosisID;
                        diagnosisUpdate.HEC_Patient_Diagnosis_RefID   = patientDiagnoses.HEC_Patient_DiagnosisID;
                        diagnosisUpdate.HEC_ACT_PerformedAction_RefID = Parameter.ExaminationID;
                        diagnosisUpdate.Save(Connection, Transaction);
                    }
                }
            }

            #endregion

            #region negated

            foreach (var item in Parameter.deletedDiagnoses)
            {
                var patientDiagnosesQuery = new ORM_HEC_Patient_Diagnosis.Query();
                patientDiagnosesQuery.IsDeleted               = false;
                patientDiagnosesQuery.R_IsNegated             = false;
                patientDiagnosesQuery.R_IsActive              = true;
                patientDiagnosesQuery.Tenant_RefID            = securityTicket.TenantID;
                patientDiagnosesQuery.HEC_Patient_DiagnosisID = item.PatientDiagnoseID;

                var patientDiagnoses = ORM_HEC_Patient_Diagnosis.Query.Search(Connection, Transaction, patientDiagnosesQuery).Single();
                patientDiagnoses.R_IsNegated = true;
                patientDiagnoses.R_IsActive  = false;
                patientDiagnoses.Save(Connection, Transaction);

                var diagnoseUpdateQuery = new ORM_HEC_ACT_PerformedAction_DiagnosisUpdate.Query();
                diagnoseUpdateQuery.HEC_Patient_Diagnosis_RefID = item.PatientDiagnoseID;
                diagnoseUpdateQuery.IsDeleted          = false;
                diagnoseUpdateQuery.IsDiagnosisNegated = false;
                diagnoseUpdateQuery.Tenant_RefID       = securityTicket.TenantID;

                var patientUpdate = ORM_HEC_ACT_PerformedAction_DiagnosisUpdate.Query.Search(Connection, Transaction, diagnoseUpdateQuery).Single();
                patientUpdate.IsDiagnosisNegated = true;
                patientUpdate.Save(Connection, Transaction);
            }

            returnValue.Result = true;
            #endregion
            return(returnValue);

            #endregion UserCode
        }
コード例 #43
0
ファイル: LRUCache.cs プロジェクト: sq/Libraries
 public LRUCache(int cacheSize, IEqualityComparer <K> comparer)
 {
     _CacheSize = cacheSize;
     _Dict      = new Dict(cacheSize, comparer);
 }
コード例 #44
0
ファイル: LRUCache.cs プロジェクト: sq/Libraries
 public LRUCache(int cacheSize)
 {
     _CacheSize = cacheSize;
     _Dict      = new Dict(cacheSize);
 }
コード例 #45
0
ファイル: c.cs プロジェクト: plusxp/kx-1
                                         void w(object x)
                                         {
                                             int i = 0, n, t = c.t(x); w((byte)t); if (t < 0)

                                             {
                                                 switch (t)
                                                 {
                                                 case -1: w((bool)x); return;

                                                 case -4: w((byte)x); return;

                                                 case -5: w((short)x); return;

                                                 case -6: w((int)x); return;

                                                 case -7: w((long)x); return;

                                                 case -8: w((float)x); return;

                                                 case -9: w((double)x); return;

                                                 case -10: w((char)x); return;

                                                 case -11: w((string)x); return;

                                                 case -13: w((Month)x); return;

                                                 case -17: w((Minute)x); return;

                                                 case -18: w((Second)x); return;

                                                 case -14: w((DateTime)x); return;

                                                 case -15: W((DateTime)x); return;

                                                 case -19: w((TimeSpan)x); return;
                                                 }
                                             }
                                             if (t == 99)
                                             {
                                                 Dict r = (Dict)x; w(r.x); w(r.y); return;
                                             }
                                             B[J++] = 0; if (t == 98)
                                             {
                                                 Flip r = (Flip)x; B[J++] = 99; w(r.x); w(r.y); return;
                                             }
                                             w(n = c.n(x)); for (; i < n; ++i)
                                             {
                                                 if (t == 0)
                                                 {
                                                     w(((object[])x)[i]);
                                                 }
                                                 else if (t == 1)
                                                 {
                                                     w(((bool[])x)[i]);
                                                 }
                                                 else if (t == 4)
                                                 {
                                                     w(((byte[])x)[i]);
                                                 }
                                                 else if (t == 5)
                                                 {
                                                     w(((short[])x)[i]);
                                                 }
                                                 else if (t == 6)
                                                 {
                                                     w(((int[])x)[i]);
                                                 }
                                                 else if (t == 7)
                                                 {
                                                     w(((long[])x)[i]);
                                                 }
                                                 else if (t == 8)
                                                 {
                                                     w(((float[])x)[i]);
                                                 }
                                                 else if (t == 9)
                                                 {
                                                     w(((double[])x)[i]);
                                                 }
                                                 else if (t == 10)
                                                 {
                                                     w(((char[])x)[i]);
                                                 }
                                                 else if (t == 14)
                                                 {
                                                     w(((DateTime[])x)[i]);
                                                 }
                                                 else if (t == 15)
                                                 {
                                                     W(((DateTime[])x)[i]);
                                                 }
                                                 else if (t == 19)
                                                 {
                                                     w(((TimeSpan[])x)[i]);
                                                 }
                                             }
                                         }
コード例 #46
0
        private void w(object x)
        {
            int t = c.t(x);

            w((byte)t);
            if (t < 0)
            {
                switch (t)
                {
                case -1:
                    w((bool)x);
                    return;

                case -4:
                    w((byte)x);
                    return;

                case -5:
                    w((short)x);
                    return;

                case -6:
                    w((int)x);
                    return;

                case -7:
                    w((long)x);
                    return;

                case -8:
                    w((float)x);
                    return;

                case -9:
                    w((double)x);
                    return;

                case -10:
                    w((char)x);
                    return;

                case -11:
                    w((string)x);
                    return;

                case -12:
                    w((DateTime)x);
                    return;

                case -13:
                    w((Month)x);
                    return;

                case -14:
                    w((Date)x);
                    return;

                case -15:
                    w((DateTime)x);
                    return;

                case -16:
                    w((KTimespan)x);
                    return;

                case -17:
                    w((Minute)x);
                    return;

                case -18:
                    w((Second)x);
                    return;

                case -19:
                    w((TimeSpan)x);
                    return;
                }
            }
            if (t == 99)
            {
                Dict r = (Dict)x;
                w(r.x);
                w(r.y);
                return;
            }
            B[J++] = 0;
            if (t == 98)
            {
                Flip r = (Flip)x;
                B[J++] = 99;
                w(r.x);
                w(r.y);
                return;
            }
            w(c.n(x));
            switch (t)
            {
            case 0:
                foreach (object o in (object[])x)
                {
                    w(o);
                }
                return;

            case 1:
                foreach (bool o in (bool[])x)
                {
                    w(o);
                }
                return;

            case 4:
                foreach (byte o in (byte[])x)
                {
                    w(o);
                }
                return;

            case 5:
                foreach (short o in (short[])x)
                {
                    w(o);
                }
                return;

            case 6:
                foreach (int o in (int[])x)
                {
                    w(o);
                }
                return;

            case 7:
                foreach (long o in (long[])x)
                {
                    w(o);
                }
                return;

            case 8:
                foreach (float o in (float[])x)
                {
                    w(o);
                }
                return;

            case 9:
                foreach (double o in (double[])x)
                {
                    w(o);
                }
                return;

            case 10:
                foreach (byte b in e.GetBytes((char[])x))
                {
                    w(b);
                }
                return;

            case 11:
                foreach (string o in (string[])x)
                {
                    w(o);
                }
                return;

            case 12:
                foreach (DateTime o in (DateTime[])x)
                {
                    w(o);
                }
                return;

            case 13:
                foreach (Month o in (Month[])x)
                {
                    w(o);
                }
                return;

            case 14:
                foreach (Date o in (Date[])x)
                {
                    w(o);
                }
                return;

            case 15:
                foreach (DateTime o in (DateTime[])x)
                {
                    w(o);
                }
                return;

            case 16:
                foreach (KTimespan o in (KTimespan[])x)
                {
                    w(o);
                }
                return;

            case 17:
                foreach (Minute o in (Minute[])x)
                {
                    w(o);
                }
                return;

            case 18:
                foreach (Second o in (Second[])x)
                {
                    w(o);
                }
                return;

            case 19:
                foreach (TimeSpan o in (TimeSpan[])x)
                {
                    w(o);
                }
                return;
            }
        }
コード例 #47
0
ファイル: c.cs プロジェクト: plusxp/kx-1
 public class Flip { public string[] x; public object[] y; public Flip(Dict X)
                     {
                         x = (string[])X.x; y = (object[])X.y;
                     }
コード例 #48
0
ファイル: Dict.cs プロジェクト: zsy3105/UnityFramework
 public static TValue LastValue <TKey, TValue>(this Dict <TKey, TValue> rDict)
 {
     return((TValue)rDict.Collection.Values.Last());
 }
コード例 #49
0
        static void Main()
        {
            var easyMap = new EasyMap <int, string>
            {
                new Item <int, string>(1, "Один"),
                new Item <int, string>(2, "Два"),
                new Item <int, string>(3, "Три"),
                new Item <int, string>(4, "Четыре"),
                new Item <int, string>(5, "Пять")
            };


            Console.WriteLine("Вывод EasyMap");
            Print(easyMap);

            Console.WriteLine("Поиск элемента по ключу 3");
            Console.WriteLine(easyMap.Search(3) ?? "Не найдено");
            Console.WriteLine();


            Console.WriteLine("Поиск элемента по ключу 7");
            Console.WriteLine(easyMap.Search(7) ?? "Не найдено");
            Console.WriteLine();

            Console.WriteLine("Удалим элемент с ключом 2 и выведем результат");
            easyMap.Remove(2);
            Print(easyMap);

            Console.WriteLine("Очистим словарь");
            easyMap.Clear();
            Print(easyMap);

            Console.WriteLine("Dict------------------");

            var dict = new Dict <int, string>(10)
            {
                new Item <int, string>(1, "Один"),
                new Item <int, string>(2, "Два"),
                new Item <int, string>(3, "Три"),
                new Item <int, string>(4, "Четыре"),
                new Item <int, string>(5, "Пять"),
                new Item <int, string>(11, "Одиннадцать"),
                new Item <int, string>(12, "Двенадцать"),
                new Item <int, string>(22, "Двадцать Два")
            };

            dict.Add(new Item <int, string>(23, "Двадцать три"));
            dict.Add(new Item <int, string>(111, "Сто одиннадцать"));

            Console.WriteLine("Вывод Dict");
            Print(dict);

            Console.WriteLine($"Словарь имеет максимальный размер = {dict.Count}");
            Console.WriteLine("Пробуем добавить еще элемент (44, Сорок четыре)");
            dict.Add(new Item <int, string>(44, "Сорок четыре"));
            Console.WriteLine("Вывод Dict");
            Print(dict);

            Console.WriteLine("Поиск элемента по ключу 3");
            Console.WriteLine(dict.Search(3) ?? "Не найдено");
            Console.WriteLine();


            Console.WriteLine("Поиск элемента по ключу 7");
            Console.WriteLine(dict.Search(7) ?? "Не найдено");
            Console.WriteLine();

            Console.WriteLine("Удалим элемент с ключом 2 и выведем результат");
            dict.Remove(2);
            Print(dict);

            Console.WriteLine("Поиск элемента по ключу 22");
            Console.WriteLine(dict.Search(22) ?? "Не найдено");
            Console.WriteLine();

            Console.WriteLine("Удалим элемент с ключом 22 и выведем результат");
            dict.Remove(22);
            Print(dict);

            Console.WriteLine("Удалим элемент с ключом 23 и выведем результат");
            dict.Remove(23);
            Print(dict);

            Console.WriteLine("Очистим словарь");
            dict.Clear();
            Print(dict);
        }
コード例 #50
0
        private void MultiDict()
        {
            build.Remove(0, build.Length);
            int count = 0, newDict = MainDict.selected;

            for (i = 0; i < MainDict.Dicts.Length; i++)
            {
                meaning = MainDict.Dicts[i].Lookup2(textBox1.Text, ref MainDict.similarWord, i * 15);
                if (meaning != "")
                {
                    count++;
                    if (count != 1)
                    {
                        build.Append("\n<hr>\n");
                    }
                    build.Append("#Từ điển " + MainDict.Dicts[i].dln[3] + "\n");
                    build.Append(meaning + "\n");
                }
            }
            if (count == 0)//không có từ nào thì tra từ tiếp theo của từ điển đang chọn
            {
                build.Append("#Không có result nào, lựa chọn các result dưới:\n");
                Array.Sort(MainDict.similarWord, MainDict.ss);
                //lọc phần tử trùng nhau
                j = 0;
                for (i = 0; i < MainDict.similarWord.Length; i++)
                {
                    if (MainDict.similarWord[i] != MainDict.similarWord[j])
                    {
                        j++;
                        MainDict.similarWord[j] = MainDict.similarWord[i];
                    }
                }
                count = Array.BinarySearch(MainDict.similarWord, 0, j, textBox1.Text, MainDict.ss);
                if (count < 0)
                {
                    count = ~count;
                }
                for (i = count - 7; i < count; i++)
                {
                    if ((i >= 0) && (i <= j) && MainDict.similarWord[i] != "")
                    {
                        build.Append("<a href='#reference'>" + MainDict.similarWord[i] + "</a> , ");
                    }
                }
                build.Append("&lt; &gt; ");
                for (i = count; i < count + 8; i++)
                {
                    if ((i >= 0) && (i <= j) && MainDict.similarWord[i] != "")
                    {
                        build.Append("<a href='#reference'>" + MainDict.similarWord[i] + "</a> , ");
                    }
                }
            }
            else
            {
                build.Insert(0, "<i><u>There're : " + count.ToString() + " results</u></i>\n");
            }
            webBrowser1.Document.OpenNew(true);
            webBrowser1.DocumentText = Dict.ToHtml(build.ToString());
        }
コード例 #51
0
 public Flip(Dict X)
 {
     x = (string[])X.x;
     y = (object[])X.y;
 }
コード例 #52
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_CAS_CIPA_1140 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();

            ORM_HEC_ACT_ActionType.Query initial_action_typeQ = new ORM_HEC_ACT_ActionType.Query();
            initial_action_typeQ.GlobalPropertyMatchingID = "mm.docconect.doc.app.performed.action.initial";
            initial_action_typeQ.Tenant_RefID             = securityTicket.TenantID;
            initial_action_typeQ.IsDeleted = false;

            var initial_action_type    = ORM_HEC_ACT_ActionType.Query.Search(Connection, Transaction, initial_action_typeQ).SingleOrDefault();
            var initial_action_type_id = Guid.Empty;
            if (initial_action_type == null)
            {
                Dict action_type_name_dict = new Dict(ORM_HEC_ACT_ActionType.TableName);

                initial_action_type = new ORM_HEC_ACT_ActionType();

                foreach (var lang in Parameter.all_languagesL)
                {
                    var content = lang.ISO_639_1.Equals("DE") ? "anfänglich" : "initial";
                    action_type_name_dict.AddEntry(lang.CMN_LanguageID, content);
                }

                initial_action_type.ActionType_Name          = action_type_name_dict;
                initial_action_type.Creation_Timestamp       = DateTime.Now;
                initial_action_type.GlobalPropertyMatchingID = "mm.docconect.doc.app.performed.action.initial";
                initial_action_type.Modification_Timestamp   = DateTime.Now;
                initial_action_type.HEC_ACT_ActionTypeID     = Guid.NewGuid();
                initial_action_type.Tenant_RefID             = securityTicket.TenantID;
                initial_action_type.Save(Connection, Transaction);

                initial_action_type_id = initial_action_type.HEC_ACT_ActionTypeID;
            }
            else
            {
                initial_action_type_id = initial_action_type.HEC_ACT_ActionTypeID;
            }

            ORM_HEC_ACT_PerformedAction initial_performed_action = new ORM_HEC_ACT_PerformedAction();
            initial_performed_action.HEC_ACT_PerformedActionID      = Guid.NewGuid();
            initial_performed_action.Creation_Timestamp             = DateTime.Now;
            initial_performed_action.IfPerfomed_DateOfAction        = DateTime.Now;
            initial_performed_action.IfPerformed_DateOfAction_Day   = DateTime.Now.Day;
            initial_performed_action.IfPerformed_DateOfAction_Month = DateTime.Now.Month;
            initial_performed_action.IfPerformed_DateOfAction_Year  = DateTime.Now.Year;
            initial_performed_action.Tenant_RefID                      = securityTicket.TenantID;
            initial_performed_action.IsPerformed_Internally            = true;
            initial_performed_action.IsPerformed_MedicalPractice_RefID = Parameter.practice_id;
            initial_performed_action.Patient_RefID                     = Parameter.patient_id;
            initial_performed_action.IfPerformedInternaly_ResponsibleBusinessParticipant_RefID = Parameter.created_by_bpt;

            initial_performed_action.Save(Connection, Transaction);

            ORM_HEC_CAS_Case_RelevantPerformedAction initial_performed_action_to_case = new ORM_HEC_CAS_Case_RelevantPerformedAction();
            initial_performed_action_to_case.Case_RefID             = Parameter.case_id;
            initial_performed_action_to_case.Creation_Timestamp     = DateTime.Now;
            initial_performed_action_to_case.Modification_Timestamp = DateTime.Now;
            initial_performed_action_to_case.PerformedAction_RefID  = initial_performed_action.HEC_ACT_PerformedActionID;
            initial_performed_action_to_case.Tenant_RefID           = securityTicket.TenantID;

            initial_performed_action_to_case.Save(Connection, Transaction);

            ORM_HEC_ACT_PerformedAction_2_ActionType initial_performed_action_2_type = new ORM_HEC_ACT_PerformedAction_2_ActionType();
            initial_performed_action_2_type.Tenant_RefID                  = securityTicket.TenantID;
            initial_performed_action_2_type.Creation_Timestamp            = DateTime.Now;
            initial_performed_action_2_type.IsDeleted                     = false;
            initial_performed_action_2_type.HEC_ACT_ActionType_RefID      = initial_action_type_id;
            initial_performed_action_2_type.HEC_ACT_PerformedAction_RefID = initial_performed_action.HEC_ACT_PerformedActionID;
            initial_performed_action_2_type.IM_ActionType_Name            = "initial";
            initial_performed_action_2_type.Modification_Timestamp        = DateTime.Now;
            initial_performed_action_2_type.AssignmentID                  = Guid.NewGuid();

            initial_performed_action_2_type.Save(Connection, Transaction);

            returnValue.Result = initial_performed_action.HEC_ACT_PerformedActionID;
            return(returnValue);

            #endregion UserCode
        }
コード例 #53
0
        private FR_Base Load(DbConnection Connection, DbTransaction Transaction, Guid ObjectID, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                #region Verify/Create Connections
                //Create connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                //If transaction is not open/not valid
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }
                #endregion
                //Get the SelectQuerry
                string SelectQuery = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_CMN_STR_SCE.CMN_STR_SCE_CapacityRestriction_Type.SQL.Select.sql")).ReadToEnd();

                DbCommand command = Connection.CreateCommand();
                //Set Connection/Transaction
                command.Connection  = Connection;
                command.Transaction = Transaction;
                //Set Query/Timeout
                command.CommandText    = SelectQuery;
                command.CommandTimeout = QueryTimeout;

                //Firstly, before loading, set the GUID to empty
                //So the entity does not exist, it will have a GUID set to empty
                _CMN_STR_SCE_CapacityRestriction_TypeID = Guid.Empty;
                CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CMN_STR_SCE_CapacityRestriction_TypeID", ObjectID);

                #region Command Execution
                try
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());
                    reader.SetOrdinals(new string[] { "CMN_STR_SCE_CapacityRestriction_TypeID", "CapacityRestrictionType_Name_DictID", "Creation_Timestamp", "IsDeleted", "Tenant_RefID" });
                    if (reader.HasRows == true)
                    {
                        reader.Read();                         //Single result only
                        //0:Parameter CMN_STR_SCE_CapacityRestriction_TypeID of type Guid
                        _CMN_STR_SCE_CapacityRestriction_TypeID = reader.GetGuid(0);
                        //1:Parameter CapacityRestrictionType_Name of type Dict
                        _CapacityRestrictionType_Name = reader.GetDictionary(1);
                        loader.Append(_CapacityRestrictionType_Name, TableName);
                        //2:Parameter Creation_Timestamp of type DateTime
                        _Creation_Timestamp = reader.GetDate(2);
                        //3:Parameter IsDeleted of type Boolean
                        _IsDeleted = reader.GetBoolean(3);
                        //4:Parameter Tenant_RefID of type Guid
                        _Tenant_RefID = reader.GetGuid(4);
                    }
                    //Close the reader so other connections can use it
                    reader.Close();

                    loader.Load();

                    if (_CMN_STR_SCE_CapacityRestriction_TypeID != Guid.Empty)
                    {
                        //Successfully loaded
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    else
                    {
                        //Fault in loading due to invalid UUID (Guid)
                        Status_IsAlreadySaved = false;
                        Status_IsDirty        = false;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                #endregion

                #region Cleanup Transaction/Connection
                //If we started the transaction, we will commit it
                if (cleanupTransaction && Transaction != null)
                {
                    Transaction.Commit();
                }

                //If we opened the connection we will close it
                if (cleanupConnection && Connection != null)
                {
                    Connection.Close();
                }

                #endregion
            } catch (Exception ex) {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw ex;
            }

            return(retStatus);
        }
コード例 #54
0
        addBrksToPntXDict(ObjectId idPoly3dRF, ObjectId idPoly3dTAR, double offset, double deltaZ, double beg, double end)
        {
            ResultBuffer rb = idPoly3dRF.getXData(apps.lnkBrks2);  //FL stores end Cogo Points

            if (rb == null)
            {
                return;
            }
            List <Handle> handles = rb.rb_handles();

            if (handles.Count == 0)
            {
                return;
            }

            ObjectId idDictM = ObjectId.Null;
            bool     exists  = false;

            try
            {
                idDictM = Dict.getNamedDictionary(apps.lnkBrks3, out exists);     //dictionary for storing edge parameters
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " Grading_Dict.cs: line: 34");
            }

            ObjectId idDictPntBEG = Dict.getSubEntry(idDictM, handles[0].ToString());       //Cogo Point stores edge parameters in dictionary

            if (idDictPntBEG == ObjectId.Null)
            {
                idDictPntBEG = Dict.addSubDict(idDictM, handles[0].ToString());
            }

            ObjectId idDictB = Dict.getSubEntry(idDictPntBEG, idPoly3dTAR.getHandle().ToString());

            if (idDictB == ObjectId.Null)
            {
                idDictB = Dict.addSubDict(idDictPntBEG, idPoly3dTAR.getHandle().ToString());
            }
            else
            {
                Dict.removeSubEntry(idDictPntBEG, idPoly3dTAR.getHandle().ToString());
                idDictB = Dict.addSubDict(idDictPntBEG, idPoly3dTAR.getHandle().ToString());
            }

            TypedValue tv = new TypedValue(1040, offset);

            Dict.addXRec(idDictB, "Offset", new ResultBuffer(tv));

            tv = new TypedValue(1040, deltaZ);
            Dict.addXRec(idDictB, "DeltaZ", new ResultBuffer(tv));

            tv = new TypedValue(1005, idPoly3dRF.getHandle().ToString());
            Dict.addXRec(idDictB, "HandleFL", new ResultBuffer(tv));

            tv = new TypedValue(1040, System.Math.Round(beg, 3));
            Dict.addXRec(idDictB, "Beg", new ResultBuffer(tv));

            tv = new TypedValue(1040, System.Math.Round(end, 3));
            Dict.addXRec(idDictB, "End", new ResultBuffer(tv));


            ObjectId idDictPntEND = Dict.getSubEntry(idDictM, handles[1].ToString());       //Cogo Point stores edge parameters in dictionary

            if (idDictPntEND == ObjectId.Null)
            {
                idDictPntEND = Dict.addSubDict(idDictM, handles[1].ToString());
            }

            ObjectId idDictE = Dict.getSubEntry(idDictPntEND, idPoly3dTAR.getHandle().ToString());

            if (idDictE == ObjectId.Null)
            {
                idDictE = Dict.addSubDict(idDictPntEND, idPoly3dTAR.getHandle().ToString());
            }
            else
            {
                Dict.removeSubEntry(idDictPntEND, idPoly3dTAR.getHandle().ToString());
                idDictE = Dict.addSubDict(idDictPntEND, idPoly3dTAR.getHandle().ToString());
            }

            tv = new TypedValue(1040, offset);
            Dict.addXRec(idDictE, "Offset", new ResultBuffer(tv));

            tv = new TypedValue(1040, deltaZ);
            Dict.addXRec(idDictE, "DeltaZ", new ResultBuffer(tv));

            tv = new TypedValue(1005, idPoly3dRF.getHandle().ToString());
            Dict.addXRec(idDictE, "HandleFL", new ResultBuffer(tv));

            tv = new TypedValue(1040, System.Math.Round(beg, 3));
            Dict.addXRec(idDictE, "Beg", new ResultBuffer(tv));

            tv = new TypedValue(1040, System.Math.Round(end, 3));
            Dict.addXRec(idDictE, "End", new ResultBuffer(tv));
        }
コード例 #55
0
ファイル: WfSendCmd.cs プロジェクト: Daoting/dt
        /// <summary>
        /// 执行发送
        /// </summary>
        /// <param name="p_manualSend">是否手动选择接收者</param>
        async void DoSend(bool p_manualSend)
        {
            #region 后续活动
            // 生成后续活动的活动实例、工作项、迁移实例,一个或多个
            var tblAtvs = Table <WfiAtv> .Create();

            var tblItems = Table <WfiItem> .Create();

            var tblTrs = Table <WfiTrs> .Create();

            DateTime time = Kit.Now;

            if (_info.NextRecvs.FinishedAtv != null &&
                (!p_manualSend || _info.NextRecvs.FinishedAtv.IsSelected))
            {
                // 完成
                _info.PrcInst.Status = WfiAtvStatus.结束;
                _info.PrcInst.Mtime  = time;
            }
            else
            {
                // 普通活动
                foreach (AtvRecv ar in _info.NextRecvs.Atvs)
                {
                    // 手动无选择时
                    if (p_manualSend &&
                        (ar.SelectedRecvs == null || ar.SelectedRecvs.Count == 0))
                    {
                        continue;
                    }

                    var atvInst = new WfiAtv(
                        ID: await AtCm.NewID(),
                        PrciID: _info.PrcInst.ID,
                        AtvdID: ar.Def.ID,
                        Status: WfiAtvStatus.活动,
                        Ctime: time,
                        Mtime: time);
                    tblAtvs.Add(atvInst);

                    if (p_manualSend)
                    {
                        // 手动发送,已选择项可能为用户或角色
                        atvInst.InstCount = ar.SelectedRecvs.Count;
                        foreach (var recvID in ar.SelectedRecvs)
                        {
                            var wi = await WfiItem.Create(atvInst.ID, time, ar.IsRole, recvID, ar.Note, false);

                            tblItems.Add(wi);
                        }
                    }
                    else
                    {
                        // 自动发送,按角色
                        atvInst.InstCount = ar.Recvs.Count;
                        foreach (var row in ar.Recvs)
                        {
                            var wi = await WfiItem.Create(atvInst.ID, time, ar.IsRole, row.ID, ar.Note, false);

                            tblItems.Add(wi);
                        }
                    }

                    // 增加迁移实例
                    var trs = await _info.CreateAtvTrs(ar.Def.ID, atvInst.ID, time, false);

                    tblTrs.Add(trs);
                }

                // 同步活动
                var syncAtv = _info.NextRecvs.SyncAtv;
                if (syncAtv != null &&
                    (!p_manualSend || (syncAtv.SelectedRecvs != null && syncAtv.SelectedRecvs.Count > 0)))
                {
                    // 同步实例
                    var syncInst = new WfiAtv(
                        ID: await AtCm.NewID(),
                        PrciID: _info.PrcInst.ID,
                        AtvdID: syncAtv.SyncDef.ID,
                        Status: WfiAtvStatus.步,
                        InstCount: 1,
                        Ctime: time,
                        Mtime: time);
                    tblAtvs.Add(syncInst);

                    // 同步工作项
                    WfiItem item = new WfiItem(
                        ID: await AtCm.NewID(),
                        AtviID: syncInst.ID,
                        AssignKind: WfiItemAssignKind.普通指派,
                        Status: WfiItemStatus.步,
                        IsAccept: false,
                        UserID: Kit.UserID,
                        Sender: Kit.UserName,
                        Stime: time,
                        Ctime: time,
                        Mtime: time,
                        Dispidx: await AtCm.NewSeq("sq_wfi_item"));
                    tblItems.Add(item);

                    // 同步迁移实例
                    Dict dt = new Dict();
                    dt["prcid"]      = _info.PrcInst.PrcdID;
                    dt["SrcAtvID"]   = _info.AtvInst.AtvdID;
                    dt["TgtAtvID"]   = syncAtv.SyncDef.ID;
                    dt["IsRollback"] = false;
                    long trsdid = await AtCm.GetScalar <long>("流程-迁移模板ID", dt);

                    var trs = new WfiTrs(
                        ID: await AtCm.NewID(),
                        TrsdID: trsdid,
                        SrcAtviID: _info.AtvInst.ID,
                        TgtAtviID: syncInst.ID,
                        IsRollback: false,
                        Ctime: time);
                    tblTrs.Add(trs);

                    // 同步活动的后续活动实例
                    var nextInst = new WfiAtv(
                        ID: await AtCm.NewID(),
                        PrciID: _info.PrcInst.ID,
                        AtvdID: syncAtv.Def.ID,
                        Status: WfiAtvStatus.活动,
                        Ctime: time,
                        Mtime: time);
                    tblAtvs.Add(nextInst);

                    if (p_manualSend)
                    {
                        // 手动发送,已选择项可能为用户或角色
                        nextInst.InstCount = syncAtv.SelectedRecvs.Count;
                        foreach (var recvID in syncAtv.SelectedRecvs)
                        {
                            var wi = await WfiItem.Create(nextInst.ID, time, syncAtv.IsRole, recvID, "", false);

                            tblItems.Add(wi);
                        }
                    }
                    else
                    {
                        // 自动发送,按角色
                        nextInst.InstCount = syncAtv.Recvs.Count;
                        foreach (var row in syncAtv.Recvs)
                        {
                            var wi = await WfiItem.Create(nextInst.ID, time, syncAtv.IsRole, row.ID, "", false);

                            tblItems.Add(wi);
                        }
                    }

                    // 增加迁移实例
                    dt               = new Dict();
                    dt["prcid"]      = _info.PrcInst.PrcdID;
                    dt["SrcAtvID"]   = syncAtv.SyncDef.ID;
                    dt["TgtAtvID"]   = syncAtv.Def.ID;
                    dt["IsRollback"] = false;
                    trsdid           = await AtCm.GetScalar <long>("流程-迁移模板ID", dt);

                    trs = new WfiTrs(
                        ID: await AtCm.NewID(),
                        TrsdID: trsdid,
                        SrcAtviID: syncInst.ID,
                        TgtAtviID: nextInst.ID,
                        IsRollback: false,
                        Ctime: time);
                    tblTrs.Add(trs);
                }
            }

            // 发送是否有效
            // 1. 只有'完成'时有效
            // 2. 至少含有一个活动实例时有效
            if (tblAtvs.Count == 0 && _info.PrcInst.Status != WfiAtvStatus.结束)
            {
                Kit.Msg("所有后续活动均无接收者,发送失败!");
                return;
            }
            #endregion

            #region 整理待保存数据
            List <object> data = new List <object>();
            if (_info.PrcInst.IsChanged)
            {
                data.Add(_info.PrcInst);
            }

            _info.AtvInst.Finished();
            data.Add(_info.AtvInst);

            _info.WorkItem.Finished();
            data.Add(_info.WorkItem);

            if (tblAtvs.Count > 0)
            {
                data.Add(tblAtvs);
                data.Add(tblItems);
                data.Add(tblTrs);
            }
            #endregion

            if (await AtCm.BatchSave(data, false))
            {
                Kit.Msg("发送成功!");
                _info.CloseWin();
                // 推送客户端提醒
            }
            else
            {
                // 避免保存失败后,再次点击发送时和保存表单一起被保存,造成状态错误!
                _info.PrcInst.RejectChanges();
                _info.AtvInst.RejectChanges();
                _info.WorkItem.RejectChanges();
                Kit.Warn("发送失败!");
            }
        }
コード例 #56
0
 public EventTypeObject(UnityEngine.Object rTargetGo)
 {
     this.TargetGo      = rTargetGo;
     this.EventTypeObjs = new Dict <HEventTriggerType, EventObject>();
 }
コード例 #57
0
ファイル: Dict.cs プロジェクト: zsy3105/UnityFramework
 public static bool ContainValue <TKey, TValue>(this Dict <TKey, TValue> rDict, TValue value)
 {
     return(rDict.Collection.ContainsValue((object)value));
 }
コード例 #58
0
 public JsonParser(string src, Dict context)
 {
     lexer        = new PeekableLexer(src, 0, 1);
     t            = lexer.Peek(0);
     this.context = context ?? DefaultContext;
 }
コード例 #59
0
ファイル: Dict.cs プロジェクト: zsy3105/UnityFramework
 public static TKey FirstKey <TKey, TValue>(this Dict <TKey, TValue> rDict)
 {
     return((TKey)rDict.Collection.Keys.First());
 }
コード例 #60
0
        private object ParseObject()
        {
            Dict ParseFlag()
            {
                var raw = t.Raw;
                var k1  = lexer.Peek(1).Kind;

                if (raw.Length > 0 && raw[0] >= '0' && raw[0] <= '7' && k1 != Kind.Colon && k1 != Kind.Div)
                {
                    Next();
                    return(new Dict {
                        { "$", raw }
                    });
                }

                return(null);
            }

            bool Close()
            {
                if (t.Kind == Kind.Close)
                {
                    Next();
                    return(true);
                }

                return(false);
            }

            Next();
            var obj = ParseFlag();

            if (obj == null)
            {
                obj = new Dict();
                if (Close())
                {
                    return(obj);
                }
                else
                {
                    /*loop*/
                }
            }
            else
            {
                if (Sep())
                {
                    if (Close())
                    {
                        return(obj);
                    }
                    else
                    {
                        /*loop*/
                    }
                }
                else
                {
                    if (Close())
                    {
                        return(obj);
                    }
                    else
                    {
                        throw Expect("','");
                    }
                }
            }

            path.Push();
            try
            {
                while (true)
                {
                    obj = ReadPathValue(obj);
                    if (Close())
                    {
                        return(obj);
                    }

                    if (Sep())
                    {
                        if (Close())
                        {
                            return(obj);
                        }
                        else
                        {
                            /*loop*/
                        }
                    }
                    else
                    {
                        throw Expect("','");
                    }
                }
            }
            finally
            {
                path.Pop();
            }
        }