Пример #1
0
        // GET api/<controller>/5
        public string Get(string id)
        {
            //chkDtModel cDModel = new chkDtModel();
            //DataTable headDt = new DataTable();
            //cDModel.dt1 = cc1.QueryDataTable(string.Format("select * from (chkList as cl inner join ChkItem as ci on cl.sno=ci.sno and cl.hand_order=ci.hand_order and cl.coordsID=ci.coordsID) inner join ChkPointCoords as cc on cl.sno=cc.sno and cl.coordsID=cc.coordsID where cl.chk_date=convert([date],GETDATE(),0) and cl.sno='{0}';", id));
            //cDModel.dt1 = headDt;
            //DataTable listDt = new DataTable();
            //cDModel.dt2 = cc1.QueryDataTable(string.Format("select distinct cl.sno,cl.coordsID from (chkList as cl inner join ChkItem as ci on cl.sno=ci.sno and cl.hand_order=ci.hand_order and cl.coordsID=ci.coordsID) inner join ChkPointCoords as cc on cl.sno=cc.sno and cl.coordsID=cc.coordsID where cl.chk_date=convert([date],GETDATE(),0) and cl.sno='{0}';", id));
            //cDModel.dt2 = listDt;
            List <string> ls = new List <string>();

            //ls.Add(string.Format("select distinct cl.sno,cl.coordsID,SubImg,coords from (chkList as cl inner join ChkItem as ci on cl.sno=ci.sno and cl.hand_order=ci.hand_order and cl.coordsID=ci.coordsID) inner join ChkPointCoords as cc on cl.sno=cc.sno and cl.coordsID=cc.coordsID where cl.chk_date=convert([date],GETDATE(),0) and cl.sno='{0}';", id));
            //ls.Add(string.Format("select * from (chkList as cl inner join ChkItem as ci on cl.sno=ci.sno and cl.hand_order=ci.hand_order and cl.coordsID=ci.coordsID) inner join ChkPointCoords as cc on cl.sno=cc.sno and cl.coordsID=cc.coordsID where cl.chk_date=convert([date],GETDATE(),0) and cl.sno='{0}';", id));
            //ls.Add(string.Format("select distinct mach_map from chkList as cl inner join ChkMachInfo as cio on cl.sno=cio.sno where cl.chk_date=convert([date],GETDATE(),0) and cl.sno='{0}'", id));
            ls.Add(string.Format("select distinct cl.sno,cl.coordsID,SubImg,coords from (chkList as cl inner join ChkItem as ci on cl.sno=ci.sno and cl.hand_order=ci.hand_order and cl.coordsID=ci.coordsID) inner join ChkPointCoords as cc on cl.sno=cc.sno and cl.coordsID=cc.coordsID where  cl.sno='{0}';", id));
            ls.Add(string.Format("select * from (chkList as cl inner join ChkItem as ci on cl.sno=ci.sno and cl.hand_order=ci.hand_order and cl.coordsID=ci.coordsID) inner join ChkPointCoords as cc on cl.sno=cc.sno and cl.coordsID=cc.coordsID where cl.sno='{0}';", id));
            ls.Add(string.Format("select distinct mach_map from chkList as cl inner join ChkMachInfo as cio on cl.sno=cio.sno where  cl.sno='{0}'", id));

            string[] dsName = { "A", "B", "C" };
            DataSet  x      = cc1.InsertSDA(ls.ToArray(), dsName);

            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.Converters.Add(new CustomDataSetConverter());
            settings.Formatting = Formatting.Indented;

            string json = JsonConvert.SerializeObject(x, settings);

            Console.WriteLine(json);

            return(json);
        }