public string AddOrg(Org org)
 {
     try
     {
         _orgApp.AddOrUpdate(org);
     }
     catch (Exception ex)
     {
         BjuiResponse.statusCode = "300";
         BjuiResponse.message    = ex.Message;
     }
     return(JsonHelper.Instance.Serialize(BjuiResponse));
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
     }
 }