public ResultModel LoadAuthSelfCorp(UserModel user) { ResultModel result = new ResultModel(); try { NFMT.Authority.CorpAuth auth = new NFMT.Authority.CorpAuth(); auth.AuthColumnNames.Add("corp.CorpId"); result = auth.CreateAuthorityStr(user); string cmdText = string.Format("select corp.* from dbo.Corporation corp where corp.IsSelf=1 and corp.CorpStatus ={0} {1}", (int)StatusEnum.已生效, result.ReturnValue.ToString()); DataTable dt = SqlHelper.ExecuteDataTable(ConnectString, cmdText, null, CommandType.Text); List<Corporation> corporations = new List<Corporation>(); foreach (DataRow dr in dt.Rows) { Corporation corporation = new Corporation(); corporation.CorpId = Convert.ToInt32(dr["CorpId"]); if (dr["ParentId"] != DBNull.Value) { corporation.ParentId = Convert.ToInt32(dr["ParentId"]); } if (dr["CorpCode"] != DBNull.Value) { corporation.CorpCode = Convert.ToString(dr["CorpCode"]); } if (dr["CorpName"] != DBNull.Value) { corporation.CorpName = Convert.ToString(dr["CorpName"]); } if (dr["CorpEName"] != DBNull.Value) { corporation.CorpEName = Convert.ToString(dr["CorpEName"]); } if (dr["TaxPayerId"] != DBNull.Value) { corporation.TaxPayerId = dr["TaxPayerId"].ToString(); } if (dr["CorpFullName"] != DBNull.Value) { corporation.CorpFullName = Convert.ToString(dr["CorpFullName"]); } if (dr["CorpFullEName"] != DBNull.Value) { corporation.CorpFullEName = Convert.ToString(dr["CorpFullEName"]); } if (dr["CorpAddress"] != DBNull.Value) { corporation.CorpAddress = Convert.ToString(dr["CorpAddress"]); } if (dr["CorpEAddress"] != DBNull.Value) { corporation.CorpEAddress = Convert.ToString(dr["CorpEAddress"]); } if (dr["CorpTel"] != DBNull.Value) { corporation.CorpTel = Convert.ToString(dr["CorpTel"]); } if (dr["CorpFax"] != DBNull.Value) { corporation.CorpFax = Convert.ToString(dr["CorpFax"]); } if (dr["CorpZip"] != DBNull.Value) { corporation.CorpZip = Convert.ToString(dr["CorpZip"]); } if (dr["CorpType"] != DBNull.Value) { corporation.CorpType = Convert.ToInt32(dr["CorpType"]); } if (dr["CorpStatus"] != DBNull.Value) { corporation.CorpStatus = (Common.StatusEnum)Enum.Parse(typeof(Common.StatusEnum), dr["CorpStatus"].ToString()); } if (dr["CreatorId"] != DBNull.Value) { corporation.CreatorId = Convert.ToInt32(dr["CreatorId"]); } if (dr["CreateTime"] != DBNull.Value) { corporation.CreateTime = Convert.ToDateTime(dr["CreateTime"]); } if (dr["LastModifyId"] != DBNull.Value) { corporation.LastModifyId = Convert.ToInt32(dr["LastModifyId"]); } if (dr["LastModifyTime"] != DBNull.Value) { corporation.LastModifyTime = Convert.ToDateTime(dr["LastModifyTime"]); } corporations.Add(corporation); } result.AffectCount = dt.Rows.Count; result.Message = "获取列表成功"; result.ResultStatus = 0; result.ReturnValue = corporations; } catch (Exception ex) { result.Message = ex.Message; } return result; }