public static IEnumerable<TasinirComboEntity> CreateItemsSource(ICommandAdapter cmd, int duzey, string startsWidth) { SelectSql sql = new SelectSql(); sql.Custom("SELECT Id, Adi, TasinirKodu FROM TasinirKod".ToQuery()); sql.Where(" (LEN(TasinirKodu)- LEN(REPLACE(TasinirKodu,'.',''))) = @0".ToQuery(duzey)); if (!String.IsNullOrEmpty(startsWidth)) { sql.Where("TasinirKodu", ConditionOperator.StartsWith, startsWidth); } return cmd.Query<TasinirComboEntity>(sql.ToQuery()); }
private void ShowReport(Report report) { report.Parameters.Clear(); foreach (var ctrl in this.ReportParameterSearch) { if (ctrl.HasValue) ctrl.Set(report.Parameters); } foreach (DataSource ds in report.DataSources) { SelectSql sql = new SelectSql(); sql.Custom(ds.ReportSql.ToQuery()); foreach (var ctrl in this.FieldSearchControls) { if (!ctrl.AllowNull && ctrl.Value.IsNull()) { base.RadAlert(String.Format("Lütfen {0} Alanı için Veri Giriniz.", ctrl.Label)); return; } if (String.Equals(ctrl.DataSourceName, ds.DataSourceName)) ctrl.Set(sql); else { if (!String.IsNullOrEmpty(ctrl.AlsoAvailableFor)) { string[] arr = ctrl.AlsoAvailableFor.Split(','); foreach(string dsName in arr) { if (String.Equals(dsName, ds.DataSourceName, StringComparison.OrdinalIgnoreCase)) { ctrl.Set(sql); } } } } } SqlQuery query = sql.ToQuery();//Düzeltme (İç İçe Sorgu Yazlılmasın Diye) Eğer Sıkıntı Çıkarırısa Select * from (...) dene. foreach(var par in query.Parameters) { if (par.ParameterName.Contains(".")) { string orginal = "@" + par.ParameterName; par.ParameterName = par.ParameterName.Replace(".", "");//Düzeltme query.Text.Replace(orginal, "@" + par.ParameterName); } } ds.ReportSelectQuery = query; string sqlString = ds.ReportSelectQuery.Text.ToString(); foreach (var ctrl in this.SqlParameterSearch) { if (ctrl.Value.IsNull()) { base.RadAlert(String.Format("Lütfen {0} Alanı için Veri Giriniz.", ctrl.ParameterName)); return; } if (ctrl.AlsoAddAsReportParameter) report.Parameters.Add(ctrl.ParameterName, ctrl.Value); if (sqlString.Contains(ctrl.ParameterName)) ctrl.Set(ds.ReportSelectQuery); } } switch(Sessions.ShowType) { case ShowReportType.PopUp: ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ShowReport", "ShowReportPage();", true); break; case ShowReportType.Redirect: base.Response.Redirect("~/Pages/ShowReportPagePopup.aspx"); break; default: throw new NotSupportedException(Sessions.ShowType.ToString()); } // ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "ShowReport", "ShowReportPage();", true); }