コード例 #1
0
 public string AddOrg(Org org)
 {
     try
     {
         _orgApp.AddOrUpdate(org);
     }
     catch (Exception ex)
     {
         BjuiResponse.statusCode = "300";
         BjuiResponse.message    = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(BjuiResponse));
 }
コード例 #2
0
ファイル: TestOrgApp.cs プロジェクト: yu99233/OpenAuth.Net
        public void TestAddOrg()
        {
            int rootId = _app.AddOrUpdate(new Org
            {
                Name     = "集团总部",
                ParentId = 0
            });

            Assert.IsTrue(rootId != 0);
            int id = _app.AddOrUpdate(new Org
            {
                Name     = "一分公司",
                ParentId = rootId
            });

            id = _app.AddOrUpdate(new Org
            {
                Name     = "二分公司",
                ParentId = rootId
            });
            id = _app.AddOrUpdate(new Org
            {
                Name     = "三分公司",
                ParentId = rootId
            });

            Assert.IsTrue(id != 0);
        }
コード例 #3
0
 public string AddOrg(Org org)
 {
     try
     {
         _orgApp.AddOrUpdate(org);
     }
     catch (Exception ex)
     {
         Result.Status  = false;
         Result.Message = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(Result));
 }
コード例 #4
0
 public void Add()
 {
     try
     {
         for (int i = 0; i < 2; i++)
         {
             var random = new Random();
             int val    = random.Next();
             _app.AddOrUpdate(new Org
             {
                 Id         = Guid.Empty,
                 Name       = "test" + val,
                 CreateTime = DateTime.Now,
                 ParentId   = null,
                 ParentName = "",
                 SortNo     = 1
             });
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }