Esempio n. 1
0
 // 游客登陆
 public void loginVisitor(CMD_GP_VisitorLogon VisitorAccount)
 {
     mVisitorAccount = VisitorAccount;
     mVisitorAccount.dwPlazaVersion = DF.shared().GetPlazaVersion();
     mMissionType = MISSION_LOGIN_VISITOR;
     start();
 }
Esempio n. 2
0
        public void TryBuildPredicate_FilterGroups_Succeed()
        {
            var query = new FilterGroup[]
            {
                new FilterGroup
                {
                    Filters = new List <Filter>
                    {
                        new Filter {
                            Property = "Integer", Operator = "=", Value = DF.Integer1.ToString()
                        },
                        new Filter {
                            Property = "String", Operator = "=", Value = DF.String1
                        }
                    }
                },
                new FilterGroup
                {
                    Filters = new List <Filter>
                    {
                        new Filter {
                            Property = "Integer", Operator = "=", Value = DF.Integer3.ToString()
                        }
                    }
                }
            }.TryBuildPredicate <TestEntity>(validProperties: new string[] { "Integer", "String" });

            Assert.True(query.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(query.Result);
                Assert.Equal(2, value);
            }
        }
        public void ParsePredicate_Integer_Succeed()
        {
            var query = $"Integer={DF.Integer1} and Integer != 0 and Integer<{DF.Integer2} and Integer<={DF.Integer1} and Integer>={DF.Integer1} and Integer>0 and Integer in [{DF.Integer1},{DF.Integer2},{DF.Integer3}]";
            var and1  = Interpreter.ParsePredicate <TestEntity>(query);
            var and2  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&&"));
            var and3  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&"));
            var or1   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "or"));
            var or2   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "||"));
            var or3   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "|"));

            Assert.True(and1.Succeeded);
            Assert.True(and2.Succeeded);
            Assert.True(and3.Succeeded);
            Assert.True(or1.Succeeded);
            Assert.True(or2.Succeeded);
            Assert.True(or3.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(and1.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and2.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and3.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(or1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or3.Result);
                Assert.True(value > 0);
            }
        }
        public void ParsePredicate_Double_Succeed()
        {
            var query = $"Double={DF.Double3} and Double != 0.0 and Double<{DF.DoubleN} and Double<={DF.Double3} and Double>={DF.Double1} and Double>0.0 and Double in [{DF.Double1},{DF.Double2},{DF.Double3},{DF.DoubleN}]";
            var and1  = Interpreter.ParsePredicate <TestEntity>(query);
            var and2  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&&"));
            var and3  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&"));
            var or1   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "or"));
            var or2   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "||"));
            var or3   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "|"));

            Assert.True(and1.Succeeded);
            Assert.True(and2.Succeeded);
            Assert.True(and3.Succeeded);
            Assert.True(or1.Succeeded);
            Assert.True(or2.Succeeded);
            Assert.True(or3.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(and1.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and2.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and3.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(or1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or3.Result);
                Assert.True(value > 0);
            }
        }
 public virtual void loadGameBaseData(ushort wKindID)
 {
     //if (HNMJGameScence::KIND_ID == wKindID)
     {
         DF.shared().init(wKindID, GameNet.GameScene.MAX_PLAYER, (int)GameScene.VERSION_CLIENT, Encoding.Default.GetBytes("Game"));
     }
 }
        public void ParsePredicate_String_Succeed()
        {
            var query = $"String='{DF.String1}' and String != null and String @* 'N' and String *@ '1' and String @ 'm' and String in ['{DF.String1}','{DF.String2}','{DF.String3}','{DF.DoubleN}']";
            var and1  = Interpreter.ParsePredicate <TestEntity>(query);
            var and2  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&&"));
            var and3  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&"));
            var or1   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "or"));
            var or2   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "||"));
            var or3   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "|"));

            Assert.True(and1.Succeeded);
            Assert.True(and2.Succeeded);
            Assert.True(and3.Succeeded);
            Assert.True(or1.Succeeded);
            Assert.True(or2.Succeeded);
            Assert.True(or3.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(and1.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and2.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and3.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(or1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or3.Result);
                Assert.True(value > 0);
            }
        }
Esempio n. 7
0
        public void TryOrderBy_Success()
        {
            using (var context = DF.GetContext())
            {
                var result = context.Entities.Where(p => p.OrderBy1 < 50).TryOrderBy("OrderBy1 desc, OrderBy2 desc");
                Assert.True(result.Succeeded);
                var value = result.Result.FirstOrDefault();
                Assert.Equal("EBC", value.OrderBy2);

                result = context.Entities.Where(p => p.OrderBy1 < 50).TryOrderBy(new[] { new OrderByInfo {
                                                                                             Property = "OrderBy1", Descending = true
                                                                                         }, new OrderByInfo {
                                                                                             Property = "OrderBy2", Descending = true
                                                                                         } });
                Assert.True(result.Succeeded);
                value = result.Result.FirstOrDefault();
                Assert.Equal("EBC", value.OrderBy2);

                result = context.Entities.TryOrderBy("OrderBy1 desc, OrderBy2 desc", new[] { "OrderBy1" });
                Assert.False(result.Succeeded);
                Assert.True(result.InvalidProperties.Count() == 1 && result.InvalidProperties.First() == "OrderBy2");

                result = context.Entities.TryOrderBy(new[] { new OrderByInfo {
                                                                 Property = "OrderBy1", Descending = true
                                                             }, new OrderByInfo {
                                                                 Property = "OrderBy2", Descending = true
                                                             } }, new[] { "OrderBy1" });
                Assert.False(result.Succeeded);
                Assert.True(result.InvalidProperties.Count() == 1 && result.InvalidProperties.First() == "OrderBy2");
            }
        }
        public void ParsePredicate_Enum_Succeed()
        {
            var query = $"Option='{TestOptions.Option1}' and Option != 1 and Option = 0  and Option in ['{TestOptions.Option1}','{TestOptions.Option2}','{TestOptions.Option3}']";
            var and1  = Interpreter.ParsePredicate <TestEntity>(query);
            var and2  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&&"));
            var and3  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&"));
            var or1   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "or"));
            var or2   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "||"));
            var or3   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "|"));

            Assert.True(and1.Succeeded);
            Assert.True(and2.Succeeded);
            Assert.True(and3.Succeeded);
            Assert.True(or1.Succeeded);
            Assert.True(or2.Succeeded);
            Assert.True(or3.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(and1.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and2.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and3.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(or1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or3.Result);
                Assert.True(value > 0);
            }
        }
        public void ParsePredicate_Guid_Succeed()
        {
            var query = $"Guid='{DF.Guid1}' and Guid in ['{DF.Guid1}','{DF.Guid2}','{DF.Guid3}']";
            var and1  = Interpreter.ParsePredicate <TestEntity>(query);
            var and2  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&&"));
            var and3  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&"));
            var or1   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "or"));
            var or2   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "||"));
            var or3   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "|"));

            Assert.True(and1.Succeeded);
            Assert.True(and2.Succeeded);
            Assert.True(and3.Succeeded);
            Assert.True(or1.Succeeded);
            Assert.True(or2.Succeeded);
            Assert.True(or3.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(and1.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and2.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and3.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(or1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or3.Result);
                Assert.True(value > 0);
            }
        }
Esempio n. 10
0
        public ActionResult DeleteConfirmed(string id)
        {
            DF df = db.DFs.Find(id);

            db.DFs.Remove(df);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 11
0
        public void OrderBy_Expression_PropertyMapping_Success()
        {
            var propertyMapping = new Dictionary <string, string> {
                ["Name"] = "OrderBy1"
            };

            using (var context = DF.GetContext())
            {
                var value = context.Entities.OrderBy("Name", propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal(10, value.OrderBy1);
                value = context.Entities.OrderBy("Name asc", propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal(10, value.OrderBy1);
                value = context.Entities.OrderBy("Name desc", propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal(50, value.OrderBy1);
                value = context.Entities.Where(p => p.OrderBy1 < 50).OrderBy("Name desc, OrderBy2 desc", propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal("EBC", value.OrderBy2);
                value = context.Entities.OrderBy(new[] { new OrderByInfo {
                                                             Property = "Name"
                                                         } }, propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal(10, value.OrderBy1);
                value = context.Entities.OrderBy(new[] { new OrderByInfo {
                                                             Property = "Name", Descending = true
                                                         } }, propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal(50, value.OrderBy1);
                value = context.Entities.Where(p => p.OrderBy1 < 50).OrderBy(new[] { new OrderByInfo {
                                                                                         Property = "Name", Descending = true
                                                                                     }, new OrderByInfo {
                                                                                         Property = "OrderBy2", Descending = true
                                                                                     } }, propertyMapping: propertyMapping).FirstOrDefault();
                Assert.Equal("EBC", value.OrderBy2);

                var result = context.Entities.Where(p => p.OrderBy1 < 50).TryOrderBy("Name desc, OrderBy2 desc", propertyMapping: propertyMapping);
                Assert.True(result.Succeeded);
                value = result.Result.FirstOrDefault();
                Assert.Equal("EBC", value.OrderBy2);

                result = context.Entities.Where(p => p.OrderBy1 < 50).TryOrderBy(new[] { new OrderByInfo {
                                                                                             Property = "Name", Descending = true
                                                                                         }, new OrderByInfo {
                                                                                             Property = "OrderBy2", Descending = true
                                                                                         } }, propertyMapping: propertyMapping);
                Assert.True(result.Succeeded);
                value = result.Result.FirstOrDefault();
                Assert.Equal("EBC", value.OrderBy2);

                result = context.Entities.TryOrderBy("Name desc, OrderBy2 desc", new[] { "Name" }, propertyMapping: propertyMapping);
                Assert.False(result.Succeeded);
                Assert.True(result.InvalidProperties.Count() == 1 && result.InvalidProperties.First() == "OrderBy2");

                result = context.Entities.TryOrderBy(new[] { new OrderByInfo {
                                                                 Property = "Name", Descending = true
                                                             }, new OrderByInfo {
                                                                 Property = "OrderBy2", Descending = true
                                                             } }, new[] { "Name" }, propertyMapping: propertyMapping);
                Assert.False(result.Succeeded);
                Assert.True(result.InvalidProperties.Count() == 1 && result.InvalidProperties.First() == "OrderBy2");
            }
        }
Esempio n. 12
0
 /// <summary>
 /// Moves files to a bad file directory on the same device, so that their
 /// storage will not be reused.
 /// </summary>
 public override bool ReportChecksumFailure(Path p, FSDataInputStream @in, long inPos
                                            , FSDataInputStream sums, long sumsPos)
 {
     try
     {
         // canonicalize f
         FilePath f = ((RawLocalFileSystem)fs).PathToFile(p).GetCanonicalFile();
         // find highest writable parent dir of f on the same device
         string   device = new DF(f, GetConf()).GetMount();
         FilePath parent = f.GetParentFile();
         FilePath dir    = null;
         while (parent != null && FileUtil.CanWrite(parent) && parent.ToString().StartsWith
                    (device))
         {
             dir    = parent;
             parent = parent.GetParentFile();
         }
         if (dir == null)
         {
             throw new IOException("not able to find the highest writable parent dir");
         }
         // move the file there
         FilePath badDir = new FilePath(dir, "bad_files");
         if (!badDir.Mkdirs())
         {
             if (!badDir.IsDirectory())
             {
                 throw new IOException("Mkdirs failed to create " + badDir.ToString());
             }
         }
         string   suffix  = "." + rand.Next();
         FilePath badFile = new FilePath(badDir, f.GetName() + suffix);
         Log.Warn("Moving bad file " + f + " to " + badFile);
         @in.Close();
         // close it first
         bool b = f.RenameTo(badFile);
         // rename it
         if (!b)
         {
             Log.Warn("Ignoring failure of renameTo");
         }
         // move checksum file too
         FilePath checkFile = ((RawLocalFileSystem)fs).PathToFile(GetChecksumFile(p));
         // close the stream before rename to release the file handle
         sums.Close();
         b = checkFile.RenameTo(new FilePath(badDir, checkFile.GetName() + suffix));
         if (!b)
         {
             Log.Warn("Ignoring failure of renameTo");
         }
     }
     catch (IOException e)
     {
         Log.Warn("Error moving bad file " + p + ": " + e);
     }
     return(false);
 }
    static void cf <T> ()
    {
        G <T> g = new G <T> ();

        df = delegate
        {
            foo(g.def());
        };
    }
Esempio n. 14
0
 /// <exception cref="System.IO.IOException"/>
 public CheckedVolume(NameNodeResourceChecker _enclosing, FilePath dirToCheck, bool
                      required)
 {
     this._enclosing = _enclosing;
     // Space (in bytes) reserved per volume.
     this.df       = new DF(dirToCheck, this._enclosing.conf);
     this.required = required;
     this.volume   = this.df.GetFilesystem();
 }
Esempio n. 15
0
        public void ParsePredicate_String_ComparisonFunction_Succeed()
        {
            var query = $"String='{DF.String1}' and String != null and String.startsWith(String) and String.endsWith('1') and String.contains('m') and String in ['{DF.String1}','{DF.String2}','{DF.String3}','{DF.StringN}']";
            var and1  = Interpreter.ParsePredicate <TestEntity>(query);
            var and2  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&&"));
            var and3  = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "&"));
            var or1   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "or"));
            var or2   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "||"));
            var or3   = Interpreter.ParsePredicate <TestEntity>(query.Replace("and", "|"));
            var t1    = Interpreter.ParsePredicate <TestEntity>($"'{DF.String1}'.contains('Name')");
            var t2    = Interpreter.ParsePredicate <TestEntity>($"'{DF.String1}'.startsWith('Name')");
            var t3    = Interpreter.ParsePredicate <TestEntity>($"'{DF.String1}'.endsWith('1')");
            var t4    = Interpreter.ParsePredicate <TestEntity>($"'{DF.String1}' @ 'Name'");
            var t5    = Interpreter.ParsePredicate <TestEntity>($"'{DF.String1}' @* 'Name'");
            var t6    = Interpreter.ParsePredicate <TestEntity>($"'{DF.String1}' *@ '1'");

            Assert.True(and1.Succeeded);
            Assert.True(and2.Succeeded);
            Assert.True(and3.Succeeded);
            Assert.True(or1.Succeeded);
            Assert.True(or2.Succeeded);
            Assert.True(or3.Succeeded);
            Assert.True(t1.Succeeded);
            Assert.True(t2.Succeeded);
            Assert.True(t3.Succeeded);
            Assert.True(t4.Succeeded);
            Assert.True(t5.Succeeded);
            Assert.True(t6.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(and1.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and2.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(and3.Result);
                Assert.Equal(1, value);
                value = context.Entities.Count(or1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(or3.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(t1.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(t2.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(t3.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(t4.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(t5.Result);
                Assert.True(value > 0);
                value = context.Entities.Count(t6.Result);
                Assert.True(value > 0);
            }
        }
Esempio n. 16
0
        //
        // GET: /DFAdmin/Details/5

        public ActionResult Details(string id = null)
        {
            DF df = db.DFs.Find(id);

            if (df == null)
            {
                return(HttpNotFound());
            }
            return(View(df));
        }
Esempio n. 17
0
 public ActionResult Edit(DF df)
 {
     if (ModelState.IsValid)
     {
         db.Entry(df).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(df));
 }
Esempio n. 18
0
        public void RegisterAccount()
        {
            //lin: 微信第三方注册还未实现!!

            //m_kAccount = "Account_652595469";
            //m_kUid = "Uid";
            //m_kOpenid = "Openid";
            //m_kPssword = "WeiXinPassword                  ";
            //m_kNickName = "慷慨阿姆斯特朗炮";

            CMD_GP_RegisterAccounts kRegister = new CMD_GP_RegisterAccounts();

            kRegister.Init();
            kRegister.dwPlazaVersion  = DF.shared().GetPlazaVersion();
            kRegister.cbValidateFlags = MsgDefine.MB_VALIDATE_FLAGS | MsgDefine.LOW_VER_VALIDATE_FLAGS;
            kRegister.cbGender        = (byte)(m_bMale ? 1 : 0);
            kRegister.wFaceID         = 0;
            kRegister.wChannleId      = m_ChannelID;
            var tempBuf = Encoding.Default.GetBytes(m_kAccount);

            Buffer.BlockCopy(tempBuf, 0, kRegister.szAccounts, 0, tempBuf.Length);

            tempBuf = System.Text.Encoding.Default.GetBytes(m_kUid);
            Buffer.BlockCopy(tempBuf, 0, kRegister.szUid, 0, tempBuf.Length);
            tempBuf = System.Text.Encoding.Default.GetBytes(m_kOpenid);
            Buffer.BlockCopy(tempBuf, 0, kRegister.szOpenid, 0, tempBuf.Length);

            tempBuf = Encoding.Default.GetBytes(m_kPssword);
            Buffer.BlockCopy(tempBuf, 0, kRegister.szLogonPass, 0, tempBuf.Length);
            tempBuf = Encoding.UTF8.GetBytes(m_kNickName);  //不能使用GetEncoding(936),会导致数据库存的是乱码 在服务端进行UTF8转GB编码处理
            Buffer.BlockCopy(tempBuf, 0, kRegister.szNickName, 0, tempBuf.Length);
            //kRegister.szAccounts = Encoding.Default.GetBytes (m_kAccount);
            //kRegister.szLogonPass = Encoding.Default.GetBytes(m_kPssword);
            //kRegister.szNickName = Encoding.Default.GetBytes(m_kNickName);
            //strncpy(kRegister.szAccounts, kAccounts.c_str(), kAccounts.size());
            //strncpy(kRegister.szLogonPass, m_kPssword.c_str(), m_kPssword.size());
            //std::string kNickName = (m_kWeiXinUserInfo.nickname);
            //strncpy(kRegister.szNickName, kNickName.c_str(), kNickName.size());
            m_kLoginMission.registerServer(kRegister);
            if (HNGameManager.bWeChatLogonIn == false)
            {
                //游客登陆
                Loom.QueueOnMainThread(() =>
                {
                    PlayerPrefs.SetString("UserName", m_kAccount);
                    PlayerPrefs.SetString("Uid", m_kUid);
                    PlayerPrefs.SetString("Openid", m_kOpenid);
                    PlayerPrefs.SetString("Psd", m_kPssword);
                    PlayerPrefs.SetString("NickName", m_kNickName);
                    PlayerPrefs.SetInt("Sex", m_bMale ? 1 : 0);
                    //PlayerPrefs.SetString("HeadURL", m_headURL);
                    PlayerPrefs.Save();
                });
            }
        }
Esempio n. 19
0
        public void ParsePredicate_NestedProperty_Succeed()
        {
            var result = Interpreter.ParsePredicate <TestEntity>($"Parent.Id = 1 and Parent.Id >= 1");

            Assert.True(result.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(result.Result);
                Assert.Equal(1, value);
            }
        }
Esempio n. 20
0
 void TreeAdd(DF df)
 {
     foreach (var v in df.Childs)
     {
         card_objectChanged(v.Owner, v, ChangeType.Created);
         if (v is DF)
         {
             TreeAdd(v as DF);
         }
     }
 }
Esempio n. 21
0
        public ActionResult Create(DF df)
        {
            if (ModelState.IsValid)
            {
                db.DFs.Add(df);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(df));
        }
Esempio n. 22
0
        public void ParsePredicate_ComplicatedGroup_Success()
        {
            var result = Interpreter.ParsePredicate <TestEntity>($"(Integer={DF.Integer1} or Double={DF.Double3}) and (Guid=='{DF.Guid1}' or DateTime='{DF.DateTime3}')");

            Assert.True(result.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(result.Result);
                Assert.Equal(2, value);
            }
        }
Esempio n. 23
0
        public void ParsePredicate_CustomVariableResolver_Success()
        {
            var result = Interpreter.ParsePredicate <TestEntity>("Integer=user.Id", new CustomVariableResolver());

            Assert.True(result.Succeeded);
            using (var context = DF.GetContext())
            {
                var value = context.Entities.Count(result.Result);
                Assert.Equal(1, value);
            }
        }
 bool IsInScope(DF scope, BSO obj)
 {
     if (scope == obj.Parent)
     {
         return(true);
     }
     if (scope.Parent == null)
     {
         return(false);
     }
     return(IsInScope(scope.Parent, obj));
 }
Esempio n. 25
0
 void setOwner(ICardObject obj, IISO7816Card owner)
 {
     obj.Owner = owner;
     if (obj is DF)
     {
         DF df = obj as DF;
         foreach (var c in df.Childs)
         {
             setOwner(c, owner);
         }
     }
 }
Esempio n. 26
0
        static int Main()
        {
            DF.Window.Start += () =>
            {
                var strawberry = new Sprite("strawberry.png");
                DF.Console.Cls();
                strawberry.AddComponent <StrawberryController>();
                DF.Root.Add(strawberry);
            };

            return(DF.Run());
        }
 public override void OnStart(Dictionary <string, object> args)
 {
     Print("Via OnStart() method. Frame:" + Window.TotalFrame);
     DF.NextFrame(() =>
     {
         Print("Via NextFrame. Frame:" + Window.TotalFrame);
         DF.NextFrame(() =>
         {
             Print("Via nested NextFrame. Frame:" + Window.TotalFrame);
             Print("Press ESC key to return");
         });
     });
 }
 private void Reset_Click(object sender, RoutedEventArgs e)
 {
     NTBox.Clear();
     NUP.Clear();
     NMP.Clear();
     CIU.Clear();
     CIM.Clear();
     DF.Clear();
     MIT.Clear();
     PIM.Clear();
     isMasked.IsChecked = false;
     Result.Items.Clear();
 }
Esempio n. 29
0
 public void OrderBy_Expression_Success()
 {
     using (var context = DF.GetContext())
     {
         var value = context.Entities.OrderBy("OrderBy1").FirstOrDefault();
         Assert.Equal(10, value.OrderBy1);
         value = context.Entities.OrderBy("OrderBy1 asc").FirstOrDefault();
         Assert.Equal(10, value.OrderBy1);
         value = context.Entities.OrderBy("OrderBy1 desc").FirstOrDefault();
         Assert.Equal(50, value.OrderBy1);
         value = context.Entities.Where(p => p.OrderBy1 < 50).OrderBy("OrderBy1 desc, OrderBy2 desc").FirstOrDefault();
         Assert.Equal("EBC", value.OrderBy2);
     }
 }
Esempio n. 30
0
        internal V_FAMILY_CONTACT(SeamlessViewsContext Context, DF DF)
            : base(Context)
        {
            var UM = DF.HOMEKEY_UM;

            _DFKEY     = DF.DFKEY;
            _MOBILE    = UM?.MOBILE;
            _TELEPHONE = UM?.TELEPHONE;
            _E_MAIL_A  = DF.E_MAIL_A;
            _NAME_A    = DF.NAME_A;
            _SURNAME_A = DF.SURNAME_A;
            _NAME_B    = DF.NAME_B;
            _SURNAME_B = DF.SURNAME_B;
        }
Esempio n. 31
0
 static void M(string msg, DF df)
 {
     System.Console.Write(msg);
     System.Console.WriteLine("false");
     df(new F());
 }
Esempio n. 32
0
	static void P (DF df)
	{
		System.Console.WriteLine ("False");
		df (new F ());
	}
Esempio n. 33
0
 public ActionResult Add(DF.Domain.Concrete.User user)
 {
     return Save(user);
 }
 private ActionResult SaveRegionLocation(DF.Domain.Concrete.RegionLocation regionlocation)
 {
     try
     {
         _manager.RegionLocationRepository = _repository;
         TempData["Result"] = _manager.Save(regionlocation);
         return RedirectToAction("Index");
     }
     catch (Exception ex)
     {
         ViewBag.SaveResult = "There was an error saving the region location.  No changes were made.";
         return View("AddRegionLocation", regionlocation);
     }
 }
 public ActionResult AddRegionLocation(DF.Domain.Concrete.RegionLocation regionlocation)
 {
     return SaveRegionLocation(regionlocation);
 }
Esempio n. 36
0
            public RANGE memrange; /* memory range */

            public DIS(ulong _pc, RANGE _mr)
            {
                flags = 0;
                pc = _pc;
                data[0] = data[1] = data[2] = 0xDEAD;
                n = 0;
                w = 0;
                c = 0;
                i = Reg.NOREG;
                j = Reg.NOREG;
                x = 0;
                opnds = null;
                comment = null;
                memrange = _mr;
            }
Esempio n. 37
0
 public ActionResult Edit(DF.Domain.Concrete.User user)
 {
     ValidateModel(user);
     return Save(user);
 }
Esempio n. 38
0
 private ActionResult Save(DF.Domain.Concrete.User user)
 {
     try
     {
         _manager.UserRepository = _repository;
         TempData["Result"] = _manager.Save(user);
         return RedirectToAction("Index");
     }
     catch (Exception ex)
     {
         ViewBag.SaveResult = "There was an error saving the user.  No changes were made.";
         return View("AddUser", user);
     }
 }
 public ActionResult AddRegionLocationType(DF.Domain.Concrete.RegionLocationType regionlocationtype)
 {
     return SaveRegionLocationType(regionlocationtype);
 }
 public ActionResult EditRegionLocationType(DF.Domain.Concrete.RegionLocationType regionlocationtype)
 {
     ValidateModel(regionlocationtype);
     return SaveRegionLocationType(regionlocationtype);
 }
Esempio n. 41
0
 private ActionResult SaveTeam(DF.Domain.Concrete.Team team)
 {
     try
     {
         _manager.TeamRepository = _repository;
         TempData["Result"] = _manager.Save(team);
         return RedirectToAction("Index");
     }
     catch (Exception ex)
     {
         ViewBag.SaveResult = "There was an error saving the team.  No changes were made.";
         return View("AddTeam", team);
     }
 }
 public ActionResult EditRegionLocation(DF.Domain.Concrete.RegionLocation regionlocation)
 {
     ValidateModel(regionlocation);
     return SaveRegionLocation(regionlocation);
 }
Esempio n. 43
0
 public ActionResult AddTeam(DF.Domain.Concrete.Team team)
 {
     return SaveTeam(team);
 }
Esempio n. 44
0
 public ActionResult EditTeam(DF.Domain.Concrete.Team team)
 {
     ValidateModel(team);
     return SaveTeam(team);
 }