private void prepareQry() { DevExpress.XtraGrid.Views.Layout.LayoutView view = qsLayoutView; StringBuilder sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colAd))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("upper(Ad) containing upper('{0}')", view.GetFocusedRowCellDisplayText(colAd).Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTyp))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("upper(Typ) containing upper('{0}')", view.GetFocusedRowCellDisplayText(colTyp).Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTrhGE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("EXD >= '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colTrhGE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTrhLT))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("EXD < '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colTrhLT))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colSizeGE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("BlbLen >= {0}", view.GetFocusedRowCellValue(colSizeGE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colSizeLE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("BlbLen <= {0}", view.GetFocusedRowCellValue(colSizeLE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colDET))) { string str = view.GetFocusedRowCellValue(colDET).ToString(); if (!string.IsNullOrEmpty(str)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("DET in ("); string[] sa = str.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTAGS))) { string TAGS = view.GetFocusedRowCellValue(colTAGS).ToString(); if (!string.IsNullOrEmpty(TAGS)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = TAGS.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("TAGS containing '{0}'", sa[i].Trim())); } sb.AppendLine(" )"); } } if ((bool)view.GetFocusedRowCellValue(colBKMD) == true) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("BKMS containing '{0}'", Program.USRtag)); } view.SetFocusedRowCellValue(colQRY, sb.ToString()); }
private void prepareQry() { DevExpress.XtraGrid.Views.Layout.LayoutView view = this.qsLayoutView; //sender as DevExpress.XtraGrid.Views.Layout.LayoutView; StringBuilder sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colJRNID))) { sb.AppendLine(string.Format("JRNid = {0}", view.GetFocusedRowCellDisplayText(colJRNID))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colREFTBL))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("RefTbl = '{0}' and RefID = {1}", view.GetFocusedRowCellDisplayText(colREFTBL), view.GetFocusedRowCellValue(colREFID))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTXT))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("(upper(Subject) containing upper('{0}') or upper(Journal) containing upper('{0}'))", view.GetFocusedRowCellDisplayText(colTXT))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colSTU))) { string STU = view.GetFocusedRowCellValue(colSTU).ToString(); if (!string.IsNullOrEmpty(STU)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("STU in ("); string[] sa = STU.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTKPTRH))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("TkpTrh <= '{0:dd.MM.yyyy}'", view.GetFocusedRowCellValue(colTKPTRH))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colUPDTS1))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("UPD_TS >= '{0:dd.MM.yyyy}'", view.GetFocusedRowCellValue(colUPDTS1))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colUPDTS2))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("UPD_TS < '{0:dd.MM.yyyy}'", view.GetFocusedRowCellValue(colUPDTS2))); } /* * if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTAGS))) * { * string TAGS = view.GetFocusedRowCellValue(colTAGS).ToString(); * if (!string.IsNullOrEmpty(TAGS)) * { * if (sb.Length > 0) * sb.AppendLine(" and "); * sb.Append("( "); * string[] sa = TAGS.Split(new char[] { ',' }); * for (int i = 0; i < sa.Length; i++) * { * if (i > 0) * sb.Append(" and "); * sb.Append(string.Format("TAGS containing '{0}'", sa[i].Trim())); * } * sb.AppendLine(" )"); * } * }*/ if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTAGS))) { string str = view.GetFocusedRowCellValue(colTAGS).ToString(); if (!string.IsNullOrEmpty(str)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = str.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("TAGS containing '{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colMBRS))) { string str = view.GetFocusedRowCellValue(colMBRS).ToString(); if (!string.IsNullOrEmpty(str)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = str.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("MBRS containing '{0}'", sa[i].Trim())); } sb.AppendLine(" )"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colBKMS))) { string str = view.GetFocusedRowCellValue(colBKMS).ToString(); if (!string.IsNullOrEmpty(str)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = str.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("BKMS containing '{0}'", sa[i].Trim())); } sb.AppendLine(" )"); } } if ((bool)view.GetFocusedRowCellValue(colPRVT) == true) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("PRVT = '{0}'", "T")); } view.SetFocusedRowCellValue(colQRY, sb.ToString()); }
private void prepareQry() { DevExpress.XtraGrid.Views.Layout.LayoutView view = qsLayoutView; StringBuilder sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colEXDGE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("EXD >= '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colEXDGE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colmATDGE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("MATD >= '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colmATDGE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colmATDLT))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("MATD < '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colmATDLT))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOPHID))) { string str = view.GetFocusedRowCellDisplayText(colOPHID); if (!string.IsNullOrEmpty(str)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append(string.Format("OPHID in ({0})", str)); } /* * if (sb.Length > 0) * sb.AppendLine(" and "); * sb.AppendLine(string.Format("OPHid = {0}", view.GetFocusedRowCellDisplayText(colOPHID)));*/ } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOPMID))) { string str = view.GetFocusedRowCellDisplayText(colOPMID); if (!string.IsNullOrEmpty(str)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append(string.Format("OPMID in ({0})", str)); } /* * if (sb.Length > 0) * sb.AppendLine(" and "); * sb.AppendLine(string.Format("OPMID = {0}", view.GetFocusedRowCellDisplayText(colOPMID)));*/ } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colRefNo))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("upper(RefNo) containing upper('{0}')", view.GetFocusedRowCellDisplayText(colRefNo).Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colFirma))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("{0} in (ShpID,CneID,MnfID,DcnID,NfyID,Nf2ID,CrrID,AccID)", view.GetFocusedRowCellValue(colFirma))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOwnr))) { string val = view.GetFocusedRowCellValue(colOwnr).ToString(); if (!string.IsNullOrEmpty(val)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("OWNR in ("); string[] sa = val.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTOB))) { string val = view.GetFocusedRowCellValue(colTOB).ToString(); if (!string.IsNullOrEmpty(val)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("TOB in ("); string[] sa = val.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colProje))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("PrjID = {0}", view.GetFocusedRowCellValue(colProje))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colTAGS))) // TAGs, BKMs, MBRs in ile calismaz { string TAGS = view.GetFocusedRowCellValue(colTAGS).ToString(); if (!string.IsNullOrEmpty(TAGS)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = TAGS.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("TAGS containing '{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colROT))) { string ROT = view.GetFocusedRowCellValue(colROT).ToString(); if (!string.IsNullOrEmpty(ROT)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("ROT in ("); string[] sa = ROT.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colMOT))) { string MOT = view.GetFocusedRowCellValue(colMOT).ToString(); if (!string.IsNullOrEmpty(MOT)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("MOT in ("); string[] sa = MOT.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOrgCntry))) { string OrgCntry = view.GetFocusedRowCellValue(colOrgCntry).ToString(); if (!string.IsNullOrEmpty(OrgCntry)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("("); string[] sa = OrgCntry.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("ORG starting '{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colDstCntry))) { string DstCntry = view.GetFocusedRowCellValue(colDstCntry).ToString(); if (!string.IsNullOrEmpty(DstCntry)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("("); string[] sa = DstCntry.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("DST starting '{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colBKMS))) { string BKMS = view.GetFocusedRowCellValue(colBKMS).ToString(); if (!string.IsNullOrEmpty(BKMS)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = BKMS.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("BKMS containing '{0}'", sa[i].Trim())); } sb.AppendLine(" )"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOrdLine))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("exists (select * from OPO where OPID = OPH.OPHID and upper(INFO) containing upper('{0}'))", view.GetFocusedRowCellDisplayText(colOrdLine).Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOnyYtk))) { string OnyYtk = view.GetFocusedRowCellValue(colOnyYtk).ToString(); if (!string.IsNullOrEmpty(OnyYtk)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("OnyYtk in ("); string[] sa = OnyYtk.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOnyUsr))) { string OnyUsr = view.GetFocusedRowCellValue(colOnyUsr).ToString(); if (!string.IsNullOrEmpty(OnyUsr)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("OnyUsr in ("); string[] sa = OnyUsr.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOnyTrhGE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("OnyTrh >= '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colOnyTrhGE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colOnyTrhLT))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("OnyTrh < '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colOnyTrhLT))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colNrmStu))) { string NrmStu = view.GetFocusedRowCellValue(colNrmStu).ToString(); if (!string.IsNullOrEmpty(NrmStu)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("NSTU in ("); string[] sa = NrmStu.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colNrmStuTrhGE))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("OnyTrh >= '{0:dd.MM.yyyy HH:mm}'", view.GetFocusedRowCellValue(colNrmStuTrhGE))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colPrbStu))) { string PrbStu = view.GetFocusedRowCellValue(colPrbStu).ToString(); if (!string.IsNullOrEmpty(PrbStu)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("PSTU in ("); string[] sa = PrbStu.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(","); } sb.Append(string.Format("'{0}'", sa[i].Trim())); } sb.AppendLine(")"); } } view.SetFocusedRowCellValue(colQRY, sb.ToString()); }
private void prepareQry() { DevExpress.XtraGrid.Views.Layout.LayoutView view = qsLayoutView; StringBuilder sb = new StringBuilder(); if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colLOCid))) { sb.AppendLine(string.Format("LOCid like upper('{0}%')", view.GetFocusedRowCellDisplayText(colLOCid))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colAd))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("upper(AD) containing upper('{0}' collate WIN1254)", view.GetFocusedRowCellDisplayText(colAd).Replace("'", "''"))); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colCntry))) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("upper(CNTRY) starting upper('{0}' collate WIN1254)", view.GetFocusedRowCellDisplayText(colCntry).Replace("'", "''"))); } if ((bool)view.GetFocusedRowCellValue(colDrm) == true) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.AppendLine(string.Format("DRM = 'A'")); } if (!string.IsNullOrWhiteSpace(view.GetFocusedRowCellDisplayText(colFunc))) { string FUNCS = view.GetFocusedRowCellValue(colFunc).ToString(); if (!string.IsNullOrEmpty(FUNCS)) { if (sb.Length > 0) { sb.AppendLine(" and "); } sb.Append("( "); string[] sa = FUNCS.Split(new char[] { ',' }); for (int i = 0; i < sa.Length; i++) { if (i > 0) { sb.Append(" or "); } sb.Append(string.Format("FUNC containing '{0}'", sa[i].Trim())); } sb.AppendLine(" )"); } } view.SetFocusedRowCellValue(colQRY, sb.ToString()); }