Ejemplo n.º 1
0
        /// <summary>
        /// Dashboard formundaki layout ayarlarını getirir.
        /// </summary>
        public static Stream DashboardLayoutGetir(int iDashboardID)
        {
            BarduckCRMEntities data = new BarduckCRMEntities();

            try
            {
                var List = data.S_Dashboard(iDashboardID, -1).ToList(); //MListler.MList_S_Dashboard.Where(u => u.ID == iDashboardID);
                if (List == null)
                {
                    return(null);
                }
                byte[] bLayout = null;
                bLayout = (byte[])List.FirstOrDefault().Layout;
                return(Genel.ByteArrayToStream(bLayout));
            }
            catch (Exception exc)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        public static DataSet DsGetir(int SelectedReportID, bool DevexDashboardMu)
        {
            BarduckCRMEntities data     = new BarduckCRMEntities();
            DataSet            fulldata = new DataSet();
            //var Evrak = data.S_Evraklar(SelectedReportID, DevexDashboardMu, 1).FirstOrDefault();
            //if (Evrak.DataSourceKullaniciTanimliMi)
            //{
            //    MyDatabase sql = new MyDatabase();
            //    sql.DatabaseName = Genel.Veritabani;
            //    sql.ServerName = Genel.Sunucu;
            //    sql.UserName = Genel.UserName;
            //    sql.Password = Genel.Password;
            //    bool bbbb = sql.CreateConnection();

            //    DataTable dt = new DataTable();
            //    try
            //    {
            //        dt = sql.ExecuteDataTable(" SELECT  TD.QueryIcerik		, EvrakDataSourceName	   FROM T_SecmeliAlanlarData TS WITH(NOLOCK)    INNER JOIN Tn_EvrakDataSource TD WITH(NOLOCK) ON TD.ID = TS.KartID   WHERE TS.SecmeliAlanlarID IN (20,21) AND TS.KayitID = " + SelectedReportID + "");


            //        fulldata.Tables.Clear();

            //        foreach (DataRow row in dt.Rows)
            //        {
            //            var Queryicerik = row["QueryIcerik"].ToString();
            //            var EvrakDataSourceName = row["EvrakDataSourceName"].ToString();

            //            Queryicerik = Queryicerik.Replace("@DilID", Genel.DilID.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID01", MusteriID == null ? "" : MusteriID.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID02", ProjeID == null ? "" : ProjeID.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID03", AktiviteID == null ? "" : AktiviteID.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID04", Parametre4 == null ? "" : Parametre4.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID05", Parametre5 == null ? "" : Parametre5.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID06", Parametre6 == null ? "" : Parametre6.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID07", Parametre7 == null ? "" : Parametre7.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID08", Parametre8 == null ? "" : Parametre8.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID09", Parametre9 == null ? "" : Parametre9.Value.ToString());
            //            Queryicerik = Queryicerik.Replace("@ID10", Parametre10 == null ? "" : Parametre10.Value.ToString());

            //            dt.TableName = EvrakDataSourceName;
            //            if (Queryicerik != "")
            //            {
            //                dt = sql.ExecuteDataTable(Queryicerik);
            //                DataTable Dt = new DataTable();
            //                Dt = dt.Copy();
            //                Dt.TableName = EvrakDataSourceName;
            //                fulldata.Tables.Add(Dt);
            //                fulldata.DataSetName = "VERITABANI";
            //            }
            //        }



            //    }
            //    catch (Exception exc)
            //    {
            //    }

            //}
            //else
            //{
            var EvrakDataSourceList = data.S_EvrakDataSourceCalistir(-1, SelectedReportID, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1).ToList();

            foreach (var item in EvrakDataSourceList)
            {
                //if (item.QueryData != "" && item.QueryData.Contains("<row"))
                if (item.QueryData != "")
                {
                    DataSet theDataSet = new DataSet();

                    var gelendata = item.QueryData;

                    var    indexrow   = gelendata.IndexOf("<row");
                    string gelendata2 = "";
                    string gelendata3 = "";
                    if (indexrow > 0)
                    {
                        gelendata2 = gelendata.Substring(0, gelendata.IndexOf("<row"));
                        gelendata3 = item.QueryData.Substring(item.QueryData.IndexOf("<row"), item.QueryData.Length - item.QueryData.IndexOf("<row"));
                    }
                    else
                    {
                        gelendata2 = gelendata;
                    }
                    //gelendata2 = gelendata2.Trim();
                    StringReader theReader  = new StringReader(gelendata2);
                    StringReader theReader2 = new StringReader(gelendata3);

                    theDataSet.ReadXmlSchema(theReader);
                    theDataSet.ReadXml(theReader2, XmlReadMode.Fragment);


                    //System.IO.StringWriter writer = new System.IO.StringWriter();
                    //theDataSet.WriteXml(writer);

                    // var asdf = writer;
                    DataTable Dt = new DataTable();
                    Dt           = theDataSet.Tables[0].Copy();
                    Dt.TableName = item.TableName;
                    fulldata.Tables.Add(Dt);
                    fulldata.DataSetName = "VERITABANI";
                }
            }
            //}


            return(fulldata);
        }