Ejemplo n.º 1
0
        public override object ExecuteReport(MethodReturn refMr = null)
        {
            decimal selectedServisId = ServisIds.first().toString("0").cto <decimal>();
            string  servisIdQuery    = $" = {selectedServisId}";
            string  dateQuery        = "";
            string  dateGunQuery1    = "";
            string  dateGunQuery2    = "";
            int     MinGun1;
            int     MaxGun1;


            if (MinGun.isNotEmpty())
            {
                MinGun1 = int.Parse(MinGun);
            }
            else
            {
                MinGun1 = -1;
            }
            if (MaxGun.isNotEmpty())
            {
                MaxGun1 = int.Parse(MaxGun);
            }
            else
            {
                MaxGun1 = -1;
            }


            if (ServisIds.isNotEmpty())
            {
                servisIdQuery = $" in ({ServisIds.joinNumeric(",")}) ";
            }
            else
            {
                //    servisIdQuery = $" > 1 ";
                selectedServisId = ServisId;
                servisIdQuery    = $" in( {selectedServisId} )";
            }



            if (MinGun1 > -1)
            {
                dateGunQuery1 = " AND acikkalmagunu >= " + MinGun;
            }
            if (MaxGun1 > -1)
            {
                dateGunQuery2 = " AND acikkalmagunu <= " + MaxGun;
            }


            //        StartDate = StartDate.startOfDay();
            //       FinishDate = FinishDate.endOfDay();
            //        dateQuery = ""+StartDate.ToString("dd/MM/yyyy") +  "' AND '"+ FinishDate.ToString("dd/MM/yyyy")+"";
            MethodReturn mr = new MethodReturn();

            List <object> queryResults = AppPool.EbaTestConnector.CreateQuery($@" 
                    select * from ( 
                        select 
                            ie1.servisid, 
                            SRV.PARTNERCODE, 
                            SRV.ISORTAKAD SERVISADI, 
                            ie1.isemirno, 
                            ie1.kayittarih KAYITTARIHI,
                            SYSDATE RAPORGUNU, 
                            round( sysdate - ie1.kayittarih) ACIKKALMAGUNU,
                            case 
                                when ie1.arackazali = 1 then 'EVET' 
                            else 'HAYIR' 
                                end ARAC_KAZALI, 
                            TO_CHAR(ie1.araccikiszamani,'dd.mm.yyyy') AS araccikiszamani,
                            case 
                                when ie1.aracserviste = 0 then 'HAYIR' 
                            else 'EVET' 
                            end  arac_servis_disinda,
                            case 
                                when SERVAR.VARLIKTIPID=3 then 'EVET'
                            else 'HAYIR'
                            end KAMU,
                            ie1.aciklama
                        from (
                            select * from servisisemirler where teknikolaraktamamla = 0 and tamamlanmatarih is null) ie1
                            left join vt_servisler srv on srv.dilkod = 'Turkish' and srv.servisid = ie1.servisid
                            inner join servisvarliklar servar on SERVAR.id=ie1.servisvarlikid
                            WHERE srv.servisid {servisIdQuery} 
                        )
                    where 
                        1=1 
                        {dateGunQuery1}
                        {dateGunQuery2}
                    order by  ACIKKALMAGUNU desc ,kayittarihi asc 

 
 
                ")
                                         .GetDataTable(mr)
                                         .ToModels();

            CloseCustomAppPool();
            return(queryResults);
        }