protected void Search(object sender, DirectEventArgs e) { string sql = ""; cs.DBCommand dbc = new cs.DBCommand(); //string sql = "select * from V_Eflow_ETravel where [Active]=1 or [Active]=2 "; if (!string.IsNullOrEmpty(txtNo.Text)) { string rem = dbc.ConvertString(txtNo.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtNo.Text) + "%'") : (dbc.ConvertString(txtNo.Text) + @"%' escape '\'"); sql += "and ([No] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(cbxType.Text)) { sql += "and [Type]='" + cbxType.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount1.Text)) { sql += "and [Tamount]>='" + txtAmount1.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount2.Text)) { sql += "and [Tamount]<='" + txtAmount2.Text + "' "; } if (!string.IsNullOrEmpty(txtRemark.Text)) { string rem = dbc.ConvertString(txtRemark.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtRemark.Text) + "%'") : (dbc.ConvertString(txtRemark.Text) + @"%' escape '\'"); sql += "and ([Remark] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(dfTDate1.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)>='" + dfTDate1.RawText + "' "; } if (!string.IsNullOrEmpty(dfTDate2.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)<='" + dfTDate2.RawText + "' "; } if (!string.IsNullOrEmpty(cbxSubType.Text)) { sql += cbxSubType.Text == "0" ? "and [Step]!=0 " : "and [Step]=0 "; } if (!string.IsNullOrEmpty(cbxPerson.Text)) { sql += "and PersonID='" + cbxPerson.Text + "' "; } BindData(sql); }
protected void Search(object sender, DirectEventArgs e) { cs.DBCommand dbc = new cs.DBCommand(); string sql = ""; //string sql = "select * from V_Eflow_ETravel where [Active]=1 or [Active]=2 "; if (!string.IsNullOrEmpty(txtNo.Text)) { string rem = dbc.ConvertString(txtNo.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtNo.Text) + "%'") : (dbc.ConvertString(txtNo.Text) + @"%' escape '\'"); sql += "and ([No] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(cbxType.Text)) { sql += "and [Type]='" + cbxType.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount1.Text)) { sql += "and [Tamount]>='" + txtAmount1.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount2.Text)) { sql += "and [Tamount]<='" + txtAmount2.Text + "' "; } if (!string.IsNullOrEmpty(txtRemark.Text)) { string rem = dbc.ConvertString(txtRemark.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtRemark.Text) + "%'") : (dbc.ConvertString(txtRemark.Text) + @"%' escape '\'"); sql += "and ([Remark] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(dfTDate1.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)>='" + dfTDate1.RawText + "' "; } if (!string.IsNullOrEmpty(dfTDate2.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)<='" + dfTDate2.RawText + "' "; } if (!string.IsNullOrEmpty(cbxSubType.Text)) { sql += cbxSubType.Text == "0" ? "and [Step]!=0 " : "and [Step]=0 "; } if (!string.IsNullOrEmpty(cbxPerson.Text)) { sql += "and PersonID='" + cbxPerson.Text + "' "; } if (!string.IsNullOrEmpty(cbxCreatedBy.Text)) { sql += "and CreadedByID='" + cbxCreatedBy.Text + "' "; } if (!string.IsNullOrEmpty(cbxProcess.Text)) { sql += "and Status='" + cbxProcess.Text + "' "; //switch (cbxProcess.Text) //{ // case "待批": // sql += "and Status=1 "; // break; // case "Pending": // sql += "and Status=1 "; // break; // case "已批": // sql += "and Status=2 "; // break; // case "Approved": // sql += "and Status=2 "; // break; // case "已拒绝": // sql += "and Status=3 "; // break; // case "Rejected": // sql += "and Status=3 "; // break; // case "待申请": // sql += "and Status=0 "; // break; // case "Not Apply": // sql += "and Status=0 "; // break; // default: // break; //} } if (!string.IsNullOrEmpty(cbxStation.Text)) { sql += "and Station='" + cbxStation.Text + "' "; } else { string getright = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'"; DataTable dtright = dbc.GetData("eReimbursement", getright); DataTable dtStation = new DataTable(); dtStation.Columns.Add("Text", System.Type.GetType("System.String")); dtStation.Columns.Add("Value", System.Type.GetType("System.String")); for (int j = 0; j < dtright.Rows.Count; j++) { string[] dd = dtright.Rows[j]["Stations"].ToString().Split(','); for (int i = 0; i < dd.Length; i++) { if (!string.IsNullOrEmpty(dd[i].Trim())) { bool have = false; for (int g = 0; g < dtStation.Rows.Count; g++) { if (dtStation.Rows[g]["Text"].ToString() == dd[i].Trim()) { have = true; break; } } if (!have) { DataRow dr1 = dtStation.NewRow(); dr1["Text"] = dd[i]; dr1["Value"] = dd[i]; dtStation.Rows.Add(dr1); } } } } //获取被授权站点下的所有申请人 string station = ""; for (int i = 0; i < dtStation.Rows.Count; i++) { station += "'" + dtStation.Rows[i]["Text"].ToString() + "',"; } if (!string.IsNullOrEmpty(station)) { station = " and Station in (" + station.Substring(0, station.Length - 1) + ") "; sql += station; } else { sql += " and FlowID is null "; } } string sql1 = "select t1.*"; if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { sql1 += ",[Status1]=TDicStatus.CText,[Type1]=TDicMainType.CText,[Draft1]=TDicType.CText"; } else { sql1 += ",[Status1]=TDicStatus.EText,[Type1]=TDicMainType.EText,[Draft1]=TDicType.EText"; } sql1 += " from (select [Draft]=case when [Status]=0 then 1 else 0 end,* from V_Eflow_ETravel where FlowID>16097 and (Active=1 or Active=2) " + sql + ") t1"; sql1 += " left join (select * from Edic where KeyValue='MainType') TDicMainType on TDicMainType.CValue=t1.Type"; sql1 += " left join (select * from Edic where KeyValue='Status') TDicStatus on TDicStatus.CValue=t1.Status"; sql1 += " left join (select * from Edic where KeyValue='Type') TDicType on TDicType.CValue=t1.Draft"; DataTable dtdetail = new DataTable(); dtdetail = dbc.GetData("eReimbursement", sql1); DataTable dtnew = new DataTable(); dtnew.Columns.Add("FlowID", System.Type.GetType("System.String")); dtnew.Columns.Add("No", System.Type.GetType("System.String")); dtnew.Columns.Add("Type", System.Type.GetType("System.String")); dtnew.Columns.Add("Station", System.Type.GetType("System.String")); dtnew.Columns.Add("Department", System.Type.GetType("System.String")); dtnew.Columns.Add("Person", System.Type.GetType("System.String")); dtnew.Columns.Add("CreadedBy", System.Type.GetType("System.String")); dtnew.Columns.Add("CreadedDate", System.Type.GetType("System.String")); dtnew.Columns.Add("Tamount", System.Type.GetType("System.String")); dtnew.Columns.Add("Step", System.Type.GetType("System.String")); dtnew.Columns.Add("Status", System.Type.GetType("System.String")); dtnew.Columns.Add("Approver", System.Type.GetType("System.String")); dtnew.Columns.Add("ApproveDate", System.Type.GetType("System.String")); dtnew.Columns.Add("Remark", System.Type.GetType("System.String")); dtnew.Columns.Add("ApproverID", System.Type.GetType("System.String")); dtnew.Columns.Add("Draft", System.Type.GetType("System.String")); dtnew.Columns.Add("RequestID", System.Type.GetType("System.String")); dtnew.Columns.Add("Status1", System.Type.GetType("System.String")); dtnew.Columns.Add("Type1", System.Type.GetType("System.String")); dtnew.Columns.Add("Draft1", System.Type.GetType("System.String")); //151010,解析申请人Cost Center by Andy Kang dtnew.Columns.Add("PersonID", System.Type.GetType("System.String")); dtnew.Columns.Add("CostCenter", System.Type.GetType("System.String")); dtnew.Columns.Add("CostCenterNew", System.Type.GetType("System.String")); for (int i = 0; i < dtdetail.Rows.Count; i++) { DataRow dr = dtnew.NewRow(); dr["FlowID"] = dtdetail.Rows[i]["FlowID"].ToString(); dr["No"] = dtdetail.Rows[i]["No"].ToString(); dr["Type"] = dtdetail.Rows[i]["Type"].ToString(); dr["Station"] = dtdetail.Rows[i]["Station"].ToString(); dr["Department"] = dtdetail.Rows[i]["Department"].ToString(); dr["Person"] = dtdetail.Rows[i]["Person"].ToString(); dr["CreadedBy"] = dtdetail.Rows[i]["CreadedBy"].ToString(); dr["CreadedDate"] = dtdetail.Rows[i]["CreadedDate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["CreadedDate"].ToString()).ToString("yyyy/MM/dd"); dr["Tamount"] = dtdetail.Rows[i]["Tamount"].ToString(); dr["Step"] = dtdetail.Rows[i]["Step"].ToString(); dr["Status"] = dtdetail.Rows[i]["Status"].ToString(); dr["Approver"] = dtdetail.Rows[i]["Approver"].ToString(); dr["ApproveDate"] = dtdetail.Rows[i]["ApproveDate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["ApproveDate"].ToString()).ToString("yyyy/MM/dd"); dr["Remark"] = dtdetail.Rows[i]["Remark"].ToString(); dr["ApproverID"] = dtdetail.Rows[i]["ApproverID"].ToString(); dr["Draft"] = dtdetail.Rows[i]["Draft"].ToString(); dr["RequestID"] = dtdetail.Rows[i]["RequestID"].ToString(); dr["Status1"] = dtdetail.Rows[i]["Status1"].ToString(); dr["Type1"] = dtdetail.Rows[i]["Type1"].ToString(); dr["Draft1"] = dtdetail.Rows[i]["Draft1"].ToString(); //151010,解析申请人Cost Center by Andy Kang dr["PersonID"] = dtdetail.Rows[i]["PersonID"].ToString(); dr["CostCenter"] = dtdetail.Rows[i]["CostCenter"].ToString(); DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dtdetail.Rows[i]["PersonID"].ToString()); if (ds1.Tables[0].Rows.Count == 1) { DataTable dt1 = ds1.Tables[0]; dr["CostCenterNew"] = dt1.Rows[0]["CostCenter"].ToString(); } else { dr["CostCenterNew"] = "N/A"; } dtnew.Rows.Add(dr); } Store1.DataSource = dtnew; Store1.DataBind(); }
protected void Search(object sender, DirectEventArgs e) { cs.DBCommand dbc = new cs.DBCommand(); string sql = ""; //string sql = "select * from V_Eflow_ETravel where [Active]=1 or [Active]=2 "; if (!string.IsNullOrEmpty(txtNo.Text)) { string rem = dbc.ConvertString(txtNo.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtNo.Text) + "%'") : (dbc.ConvertString(txtNo.Text) + @"%' escape '\'"); sql += "and ([No] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(cbxType.Text)) { sql += "and [Type]='" + cbxType.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount1.Text)) { sql += "and [Tamount]>='" + txtAmount1.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount2.Text)) { sql += "and [Tamount]<='" + txtAmount2.Text + "' "; } if (!string.IsNullOrEmpty(txtRemark.Text)) { string rem = dbc.ConvertString(txtRemark.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtRemark.Text) + "%'") : (dbc.ConvertString(txtRemark.Text) + @"%' escape '\'"); sql += "and ([Remark] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(dfTDate1.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)>='" + dfTDate1.RawText + "' "; } if (!string.IsNullOrEmpty(dfTDate2.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)<='" + dfTDate2.RawText + "' "; } if (!string.IsNullOrEmpty(cbxSubType.Text)) { sql += cbxSubType.Text == "0" ? "and [Step]!=0 " : "and [Step]=0 "; } if (!string.IsNullOrEmpty(cbxPerson.Text)) { sql += "and PersonID='" + cbxPerson.Text + "' "; } if (!string.IsNullOrEmpty(cbxCreatedBy.Text)) { sql += "and CreadedByID='" + cbxCreatedBy.Text + "' "; } if (!string.IsNullOrEmpty(cbxProcess.Text)) { sql += "and Status='" + cbxProcess.Text + "' "; //switch (cbxProcess.Text) //{ // case "待批": // sql += "and Status=1 "; // break; // case "Pending": // sql += "and Status=1 "; // break; // case "已批": // sql += "and Status=2 "; // break; // case "Approved": // sql += "and Status=2 "; // break; // case "已拒绝": // sql += "and Status=3 "; // break; // case "Rejected": // sql += "and Status=3 "; // break; // case "待申请": // sql += "and Status=0 "; // break; // case "Not Apply": // sql += "and Status=0 "; // break; // default: // break; //} } if (!string.IsNullOrEmpty(cbxStation.Text)) { sql += "and Station='" + cbxStation.Text + "' "; } else { string getright = "select * from StationRole where UserID='" + Request.Cookies.Get("eReimUserID").Value + "'"; DataTable dtright = dbc.GetData("eReimbursement", getright); DataTable dtStation = new DataTable(); dtStation.Columns.Add("Text", System.Type.GetType("System.String")); dtStation.Columns.Add("Value", System.Type.GetType("System.String")); for (int j = 0; j < dtright.Rows.Count; j++) { string[] dd = dtright.Rows[j]["Stations"].ToString().Split(','); for (int i = 0; i < dd.Length; i++) { if (!string.IsNullOrEmpty(dd[i].Trim())) { bool have = false; for (int g = 0; g < dtStation.Rows.Count; g++) { if (dtStation.Rows[g]["Text"].ToString() == dd[i].Trim()) { have = true; break; } } if (!have) { DataRow dr1 = dtStation.NewRow(); dr1["Text"] = dd[i]; dr1["Value"] = dd[i]; dtStation.Rows.Add(dr1); } } } } //获取被授权站点下的所有申请人 string station = ""; for (int i = 0; i < dtStation.Rows.Count; i++) { station += "'" + dtStation.Rows[i]["Text"].ToString() + "',"; } if (!string.IsNullOrEmpty(station)) { station = " and Station in (" + station.Substring(0, station.Length - 1) + ") "; sql += station; } else { sql += " and FlowID is null "; } } string sql1 = "select t1.*"; if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value.ToLower() == "zh-cn") { sql1 += ",[Status1]=TDicStatus.CText,[Type1]=TDicMainType.CText,[Draft1]=TDicType.CText"; } else { sql1 += ",[Status1]=TDicStatus.EText,[Type1]=TDicMainType.EText,[Draft1]=TDicType.EText"; } sql1 += " from (select [Draft]=case when [Status]=0 then 1 else 0 end,* from V_Eflow_ETravel where FlowID>16097 and (Active=1 or Active=2) " + sql + ") t1"; sql1 += " left join (select * from Edic where KeyValue='MainType') TDicMainType on TDicMainType.CValue=t1.Type"; sql1 += " left join (select * from Edic where KeyValue='Status') TDicStatus on TDicStatus.CValue=t1.Status"; sql1 += " left join (select * from Edic where KeyValue='Type') TDicType on TDicType.CValue=t1.Draft"; DataTable dtdetail = new DataTable(); dtdetail = dbc.GetData("eReimbursement", sql1); DataTable dtnew = new DataTable(); dtnew.Columns.Add("FlowID", System.Type.GetType("System.String")); dtnew.Columns.Add("No", System.Type.GetType("System.String")); dtnew.Columns.Add("Type", System.Type.GetType("System.String")); dtnew.Columns.Add("Station", System.Type.GetType("System.String")); dtnew.Columns.Add("Department", System.Type.GetType("System.String")); dtnew.Columns.Add("Person", System.Type.GetType("System.String")); dtnew.Columns.Add("CreadedBy", System.Type.GetType("System.String")); dtnew.Columns.Add("CreadedDate", System.Type.GetType("System.String")); dtnew.Columns.Add("Tamount", System.Type.GetType("System.String")); dtnew.Columns.Add("Step", System.Type.GetType("System.String")); dtnew.Columns.Add("Status", System.Type.GetType("System.String")); dtnew.Columns.Add("Approver", System.Type.GetType("System.String")); dtnew.Columns.Add("ApproveDate", System.Type.GetType("System.String")); dtnew.Columns.Add("Remark", System.Type.GetType("System.String")); dtnew.Columns.Add("ApproverID", System.Type.GetType("System.String")); dtnew.Columns.Add("Draft", System.Type.GetType("System.String")); dtnew.Columns.Add("RequestID", System.Type.GetType("System.String")); dtnew.Columns.Add("Status1", System.Type.GetType("System.String")); dtnew.Columns.Add("Type1", System.Type.GetType("System.String")); dtnew.Columns.Add("Draft1", System.Type.GetType("System.String")); //151010,解析申请人Cost Center by Andy Kang dtnew.Columns.Add("PersonID", System.Type.GetType("System.String")); dtnew.Columns.Add("CostCenter", System.Type.GetType("System.String")); dtnew.Columns.Add("CostCenterNew", System.Type.GetType("System.String")); for (int i = 0; i < dtdetail.Rows.Count; i++) { DataRow dr = dtnew.NewRow(); dr["FlowID"] = dtdetail.Rows[i]["FlowID"].ToString(); dr["No"] = dtdetail.Rows[i]["No"].ToString(); dr["Type"] = dtdetail.Rows[i]["Type"].ToString(); dr["Station"] = dtdetail.Rows[i]["Station"].ToString(); dr["Department"] = dtdetail.Rows[i]["Department"].ToString(); dr["Person"] = dtdetail.Rows[i]["Person"].ToString(); dr["CreadedBy"] = dtdetail.Rows[i]["CreadedBy"].ToString(); dr["CreadedDate"] = dtdetail.Rows[i]["CreadedDate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["CreadedDate"].ToString()).ToString("yyyy/MM/dd"); dr["Tamount"] = dtdetail.Rows[i]["Tamount"].ToString(); dr["Step"] = dtdetail.Rows[i]["Step"].ToString(); dr["Status"] = dtdetail.Rows[i]["Status"].ToString(); dr["Approver"] = dtdetail.Rows[i]["Approver"].ToString(); dr["ApproveDate"] = dtdetail.Rows[i]["ApproveDate"].ToString() == "" ? "" : Convert.ToDateTime(dtdetail.Rows[i]["ApproveDate"].ToString()).ToString("yyyy/MM/dd"); dr["Remark"] = dtdetail.Rows[i]["Remark"].ToString(); dr["ApproverID"] = dtdetail.Rows[i]["ApproverID"].ToString(); dr["Draft"] = dtdetail.Rows[i]["Draft"].ToString(); dr["RequestID"] = dtdetail.Rows[i]["RequestID"].ToString(); dr["Status1"] = dtdetail.Rows[i]["Status1"].ToString(); dr["Type1"] = dtdetail.Rows[i]["Type1"].ToString(); dr["Draft1"] = dtdetail.Rows[i]["Draft1"].ToString(); //151010,解析申请人Cost Center by Andy Kang dr["PersonID"] = dtdetail.Rows[i]["PersonID"].ToString(); dr["CostCenter"] = dtdetail.Rows[i]["CostCenter"].ToString(); DataSet ds1 = DIMERCO.SDK.Utilities.LSDK.getUserProfilebyUserList(dtdetail.Rows[i]["PersonID"].ToString()); if (ds1.Tables[0].Rows.Count == 1) { DataTable dt1 = ds1.Tables[0]; dr["CostCenterNew"] = dt1.Rows[0]["CostCenter"].ToString(); } else { dr["CostCenterNew"] = "N/A"; } dtnew.Rows.Add(dr); } Store1.DataSource = dtnew; Store1.DataBind(); }
protected void Search(object sender, DirectEventArgs e) { string sql = ""; cs.DBCommand dbc = new cs.DBCommand(); //string sql = "select * from V_Eflow_ETravel where [Active]=1 or [Active]=2 "; if (!string.IsNullOrEmpty(txtNo.Text)) { string rem = dbc.ConvertString(txtNo.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtNo.Text) + "%'") : (dbc.ConvertString(txtNo.Text) + @"%' escape '\'"); sql += "and ([No] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(cbxType.Text)) { sql += "and [Type]='" + cbxType.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount1.Text)) { sql += "and [Tamount]>='" + txtAmount1.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount2.Text)) { sql += "and [Tamount]<='" + txtAmount2.Text + "' "; } if (!string.IsNullOrEmpty(txtRemark.Text)) { string rem = dbc.ConvertString(txtRemark.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtRemark.Text) + "%'") : (dbc.ConvertString(txtRemark.Text) + @"%' escape '\'"); sql += "and ([Remark] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(dfTDate1.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)>='" + dfTDate1.RawText + "' "; } if (!string.IsNullOrEmpty(dfTDate2.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)<='" + dfTDate2.RawText + "' "; } if (!string.IsNullOrEmpty(cbxSubType.Text)) { sql += cbxSubType.Text == "0" ? "and [Step]!=0 " : "and [Step]=0 "; } if (!string.IsNullOrEmpty(cbxPerson.Text)) { sql += "and PersonID='" + cbxPerson.Text + "' "; } BindData(sql); }
protected void button1_Search(object sender, DirectEventArgs e) { //string sql = "select * from V_Eflow_ETravel where ApproverID='A0360' ";//Session string sql = ""; cs.DBCommand dbc = new cs.DBCommand(); if (Request.QueryString["Status"] != null) { string Status = Request.QueryString["Status"].ToString(); System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^\d*$"); if (reg1.IsMatch(Status)) { if (Request.QueryString["Status"].ToString() == "1") { sql += "and Active=1 "; } else { sql += "and Status=" + Request.QueryString["Status"].ToString() + " "; } } else { ErrorHandle(); } } else { sql += "and Active=1 "; } if (!string.IsNullOrEmpty(txtNo.Text)) { string rem = dbc.ConvertString(txtNo.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtNo.Text) + "%'") : (dbc.ConvertString(txtNo.Text) + @"%' escape '\'"); sql += "and ([No] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(cbxType.Text)) { sql += "and [Type]='" + cbxType.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount1.Text)) { sql += "and [Tamount]>='" + txtAmount1.Text + "' "; } if (!string.IsNullOrEmpty(txtAmount2.Text)) { sql += "and [Tamount]<='" + txtAmount2.Text + "' "; } if (!string.IsNullOrEmpty(txtRemark.Text)) { string rem = dbc.ConvertString(txtRemark.Text).IndexOf('\\') == -1 ? (dbc.ConvertString(txtRemark.Text) + "%'") : (dbc.ConvertString(txtRemark.Text) + @"%' escape '\'"); sql += "and ([Remark] like '%" + rem + ") "; } if (!string.IsNullOrEmpty(dfTDate1.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)>='" + dfTDate1.RawText + "' "; } if (!string.IsNullOrEmpty(dfTDate2.RawText)) { sql += "and convert(varchar(10),CreadedDate,111)<='" + dfTDate2.RawText + "' "; } if (!string.IsNullOrEmpty(cbxTstation.Text)) { sql += "and [Station]='" + cbxTstation.Text + "' "; } if (!string.IsNullOrEmpty(cbxPerson.Text)) { sql += "and [PersonID]='" + cbxPerson.Text + "' "; } if (!string.IsNullOrEmpty(cbxCreatedBy.Text)) { sql += "and [CreadedByID]='" + cbxCreatedBy.Text + "' "; } BindData(sql); }