Exemplo n.º 1
0
        public object GetOrganization(string userid)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            try
            {
                string sql = @"select * from B_OA_Organization";
                DataSet ds = Utility.Database.ExcuteDataSet(sql, tran);
                DataTable dataTable = ds.Tables[0];
                string jsonData = JsonConvert.SerializeObject(dataTable);
                List<B_OA_Organization> list_Organization = (List<B_OA_Organization>)JsonConvert.DeserializeObject(jsonData, typeof(List<B_OA_Organization>));
                Utility.Database.Commit(tran);
                B_OA_Organization organization = new B_OA_Organization();
                return new
                {
                    list_Organization = list_Organization,
                    organization = organization

                };
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex);
                return Utility.JsonResult(false, ex.Message);
            }
        }
Exemplo n.º 2
0
        public object GetOrganization(string userid)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            try
            {
                string sql = @"
            select id,pId,randId,fullName as name,fullName from B_OA_Organization
            union
            select '0' as id ,'1' as parentId ,-1 as randId,'全部组织' as name ,'全部组织' as fullName";
                DataSet ds = Utility.Database.ExcuteDataSet(sql, tran);
                DataTable list_Organization = ds.Tables[0];
                B_OA_Organization organization = new B_OA_Organization();
                Utility.Database.Commit(tran);
                return new
                {
                    list_Organization = list_Organization,
                    organization = organization

                };

            }
            catch (Exception ex)
            {
                Utility.Database.Rollback(tran);
                ComBase.Logger(ex);
                throw (new Exception("加载数据失败!", ex));
            }
        }
Exemplo n.º 3
0
        public object GetOrganization(string userid)
        {
            IDbTransaction tran = Utility.Database.BeginDbTransaction();
            try
            {
                string sql = @"
            select id,pId,randId,fullName as name,fullName from B_OA_Organization
            union
            select '0' as id ,'1' as parentId ,-1 as randId,'全部组织' as name ,'全部组织' as fullName";
                DataSet ds = Utility.Database.ExcuteDataSet(sql, tran);
                DataTable list_Organization = ds.Tables[0];
                B_OA_Organization organization = new B_OA_Organization();
                return new
                {
                    list_Organization = list_Organization,
                    organization = organization

                };
            }
            catch (Exception ex)
            {
                ComBase.Logger(ex);
                return Utility.JsonMsg(false, ex.Message);
            }
        }
Exemplo n.º 4
0
 public object DeleteData(string id)
 {
     IDbTransaction tran = Utility.Database.BeginDbTransaction();
     try
     {
         B_OA_Organization org = new B_OA_Organization();
         org.Condition.Add("id =" + id);
         Utility.Database.Delete(org, tran);
         Utility.Database.Commit(tran);
         return new
         {
         };
     }
     catch (Exception ex)
     {
         ComBase.Logger(ex);
         throw (new Exception("保存数据失败!", ex));
     }
 }