首页 > 代码库 > 转为json类型

转为json类型

public class listGageData
{
public string gcustName
{
set;
get;
}
public string gcustIdtype
{
set;
get;
}
public string gcustIdno
{
set;
get;
}
public string gType
{
set;
get;
}
public string gName
{
set;
get;
}
public string gDesc
{
set;
get;
}
public decimal gValue
{
set;
get;
}
public string gLicno
{
set;
get;
}
public string gLicType
{
set;
get;
}
}
public class listComData
{
public string comName
{
set;
get;
}
public string comIdtype
{
set;
get;
}
public string comIdno
{
set;
get;
}
public string comTel
{
set;
get;
}
}
public class listRelData
{
public string relName
{
set;
get;
}
public string relIdtype
{
set;
get;
}
public string relIdno
{
set;
get;
}
public string relTel
{
set;
get;
}
}


public class IntoPiecesData
{
public string BrNo
{
set;
get;
}
public string BatNo
{
set;
get;
}
public int DataCnt
{
set;
get;
}
public List<IntoData> list
{
set;
get;
}
}
public class IntoData
{
public string PactNo
{
set;
get;
}
public string CustName
{
set;
get;
}
public string IdType
{
set;
get;
}
public string IdNo
{
set;
get;
}
public string CustType
{
set;
get;
}
public string Sex
{
set;
get;
}
public string Birth
{
set;
get;
}
public string Marriage
{
set;
get;
}
public string Children
{
set;
get;
}
public string Edu
{
set;
get;
}
public string Degree
{
set;
get;
}
public string TelNo
{
set;
get;
}
public string PhoneNo
{
set;
get;
}
public string PostCode
{
set;
get;
}
public string PostAddr
{
set;
get;
}
public string HomeArea
{
set;
get;
}
public string HomeTel
{
set;
get;
}
public string HomeCode
{
set;
get;
}
public string HomeAddr
{
set;
get;
}
public string HomeSts
{
set;
get;
}
public double Income
{
set;
get;
}
public string MateName
{
set;
get;
}
public string MateIdtype
{
set;
get;
}
public string MateIdno
{
set;
get;
}
public string MateWork
{
set;
get;
}
public string MateTel
{
set;
get;
}
public string ProjNo
{
set;
get;
}
public string PrdtNo
{
set;
get;
}
public double PactAmt
{
set;
get;
}
public double FeeTotal
{
set;
get;
}
public string PremNo
{
set;
get;
}
public double PremRate
{
set;
get;
}
public decimal LnRate
{
set;
get;
}
public string AppArea
{
set;
get;
}
public string AppUse
{
set;
get;
}
public int TermMon
{
set;
get;
}
public int TermDay
{
set;
get;
}
public string VouType
{
set;
get;
}
public string EndDate
{
set;
get;
}
public string PayType
{
set;
get;
}
public int PayDay
{
set;
get;
}
public decimal VouAmt
{
set;
get;
}
public string WorkType
{
set;
get;
}
public string WorkName
{
set;
get;
}
public string WorkSts
{
set;
get;
}
public string WorkWay
{
set;
get;
}
public string WorkCode
{
set;
get;
}
public string WorkAddr
{
set;
get;
}
public string WorkDuty
{
set;
get;
}
public string WorkTitle
{
set;
get;
}
public string WorkYear
{
set;
get;
}
public string IfCar
{
set;
get;
}
public string IfCarCred
{
set;
get;
}
public string IfRoom
{
set;
get;
}
public string IfMort
{
set;
get;
}
public string IfCard
{
set;
get;
}
public double CardAmt
{
set;
get;
}
public string IfApp
{
set;
get;
}
public string IfId
{
set;
get;
}
public string IfPact
{
set;
get;
}
public string PrePactNo
{
set;
get;
}
public string CzPactNo
{
set;
get;
}
public string CardChn
{
set;
get;
}

public List<listGageData> listGage
{
set;
get;
}

public List<listComData> listCom
{
set;
get;
}

public List<listRelData> listRel
{
set;
get;
}
public List<listAcData> listAc
{
set;
get;
}
}
public class listAcData
{
public String acUse 
{
set;
get;
}
public double acAmt 
{
set;
get;
}
public String acType 
{
set;
get;
}
public String acno // 账户号
{
set;
get;
}
public String acName 
{
set;
get;
}
public String bankCode 
{
set;
get;
}
public String bankProv 
{
set;
get;
}
public String bankCity 
{
set;
get;
}
public String bankSite 
{
set;
get;
}
public String idType 
{
set;
get;
}
public String idNo 
{
set;
get;
}
public String phoneNo 
{
set;
get;
}
public String validDate 
{
set;
get;
}
public String cvvNo 
{
set;
get;
}
}

public string I2101(string aa)
        {
            string getData = http://www.mamicode.com/"";
            try
            {
                IntoPiecesData IntoPiecesInfo = new IntoPiecesData();

                IntoPiecesInfo.BrNo = "023";
                IntoPiecesInfo.BatNo = SourceCaseNo.Replace("-", "");
                IntoPiecesInfo.DataCnt = 1;
                DAL.ControllerBase con = DAL.ControllerFactory.GetNewController(DAL.e_ConsType.Main2);

                string sqlIntoData = http://www.mamicode.com/string.Format(@"  ", aa);
                IntoData IntoDataInfo = new IntoData();
                DataTable dtIntoData = con.GetDataTable(sqlIntoData);
                List<listGageData> GageDataList = new List<listGageData>();

                if (dtIntoData.Rows.Count > 0)
                {
                    GageDataList.AddRange(CConvert.DataTableToList<listGageData>(dtIntoData));
                }
                IntoDataInfo.listGage = GageDataList;

                string sqlAcData = http://www.mamicode.com/string.Format(@"   ", aa);
                DataTable dtAcData = con.GetDataTable(sqlAcData);
                List<listAcData> AcList = new List<listAcData>();
                if (dtAcData.Rows.Count > 0)
                {
                    AcList.AddRange(CConvert.DataTableToList<listAcData>(dtAcData));
                }
                IntoDataInfo.listAc = AcList;

                string sqlComData = http://www.mamicode.com/string.Format(@"   ", aa);
                DataTable dtComData = con.GetDataTable(sqlComData);
                List<listComData> ComList = new List<listComData>();
                if (dtComData.Rows.Count > 0)
                {
                    ComList.AddRange(CConvert.DataTableToList<listComData>(dtComData));
                }
                IntoDataInfo.listCom = ComList;

                List<listRelData> RelList = new List<listRelData>();
                IntoDataInfo.listRel = RelList;

                string sql = string.Format(@"   ", aa);

                    DataTable dt = con.GetDataTable(sql);

                    IntoDataInfo.PactNo = SourceCaseNo.Replace("-", "");
                    IntoDataInfo.CustName = dt.Rows[0]["custName"].ToString();
                    IntoDataInfo.IdType = dt.Rows[0]["idType"].ToString();
                    IntoDataInfo.IdNo = dt.Rows[0]["idNo"].ToString();
                    IntoDataInfo.CustType = "03"; 
                    IntoDataInfo.Sex = dt.Rows[0]["sex"].ToString();
                    IntoDataInfo.Birth = dt.Rows[0]["birth"].ToString();
                    IntoDataInfo.Marriage = dt.Rows[0]["marriage"].ToString();
                    IntoDataInfo.Children = dt.Rows[0]["children"].ToString();
                    IntoDataInfo.Edu = dt.Rows[0]["edu"].ToString();
                    IntoDataInfo.Degree = "9"; 
                    IntoDataInfo.TelNo = dt.Rows[0]["telNo"].ToString();
                    IntoDataInfo.PhoneNo = dt.Rows[0]["phoneNo"].ToString();
                    IntoDataInfo.PostCode = "";
                    IntoDataInfo.PostAddr = "";
                    IntoDataInfo.HomeArea = "000000";
                    IntoDataInfo.HomeTel = "";
                    IntoDataInfo.HomeCode = "";
                    IntoDataInfo.HomeAddr = dt.Rows[0]["homeAddr"].ToString();
                    IntoDataInfo.HomeSts = dt.Rows[0]["homeSts"].ToString();
                    IntoDataInfo.Income = dt.Rows[0]["income"].AsTargetType<double>(0);
                    IntoDataInfo.MateName = dt.Rows[0]["mateName"].ToString();
                    IntoDataInfo.MateIdtype = dt.Rows[0]["mateIdtype"].ToString();
                    IntoDataInfo.MateIdno = dt.Rows[0]["mateIdno"].ToString();
                    IntoDataInfo.MateWork = dt.Rows[0]["mateWork"].ToString();
                    IntoDataInfo.MateTel = dt.Rows[0]["mateTel"].ToString();
                    IntoDataInfo.ProjNo = "30856";
                    IntoDataInfo.PrdtNo = "100001";
                    IntoDataInfo.FeeTotal = 0d;
                    IntoDataInfo.PremNo="";
                    IntoDataInfo.PremRate=0d;
                    IntoDataInfo.PactAmt = dt.Rows[0]["pactAmt"].AsTargetType<double>(0);
                    IntoDataInfo.LnRate = Math.Round(dt.Rows[0]["lnRate"].AsTargetType<decimal>(0), 6); //dt.Rows[0]["lnRate"].AsTargetType<double>(0);
                    IntoDataInfo.AppArea = "000000";
                    IntoDataInfo.AppUse = dt.Rows[0]["AppUse"].ToString();
                    IntoDataInfo.TermMon = dt.Rows[0]["termMon"].AsTargetType<int>(0);
                    IntoDataInfo.TermDay = 0;
                    IntoDataInfo.VouType = "2";
                    IntoDataInfo.EndDate = "";
                    IntoDataInfo.PayType = "02";
                    IntoDataInfo.PayDay = dt.Rows[0]["payDay"].AsTargetType<int>(0);
                    IntoDataInfo.VouAmt = Math.Round(dt.Rows[0]["VouAmt"].AsTargetType<decimal>(0), 2);
                    IntoDataInfo.WorkType = "Z";
                    IntoDataInfo.WorkName = "";//dt.Rows[0]["workName"].ToString();
                    IntoDataInfo.WorkSts = "01";
                    IntoDataInfo.WorkWay = dt.Rows[0]["workWay"].ToString();
                    IntoDataInfo.WorkCode = "";
                    IntoDataInfo.WorkAddr = "";//dt.Rows[0]["workAddr"].ToString();
                    IntoDataInfo.WorkDuty = dt.Rows[0]["workDuty"].ToString();
                    IntoDataInfo.WorkTitle = "9";
                    IntoDataInfo.WorkYear = "";
                    IntoDataInfo.IfCar = "2";
                    IntoDataInfo.IfCarCred = "2";
                    IntoDataInfo.IfRoom = "1";
                    IntoDataInfo.IfMort = "1";
                    IntoDataInfo.IfCard = "2";
                    IntoDataInfo.CardAmt = 0;
                    IntoDataInfo.IfApp = "2";
                    IntoDataInfo.IfId = "1";
                    IntoDataInfo.IfPact = "2";
                    IntoDataInfo.PrePactNo = SourceCaseNo.Replace("-", "");
                    IntoDataInfo.CzPactNo = "";
                    IntoDataInfo.CardChn = "CL0002";

                    List<IntoData> IntoDataList = new List<IntoData>();

                    IntoDataList.Add(IntoDataInfo);

                    IntoPiecesInfo.list = IntoDataList;

                    string IntoPiecesJson = JsonConvert.SerializeObject(IntoPiecesInfo);
                
            }
            catch (Exception ex)
            {
                return ex.Message;
            }

            return getData;
        }

 

转为json类型