本文整理汇总了C#中QueryField.BeginsWith方法的典型用法代码示例。如果您正苦于以下问题:C# QueryField.BeginsWith方法的具体用法?C# QueryField.BeginsWith怎么用?C# QueryField.BeginsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryField
的用法示例。
在下文中一共展示了QueryField.BeginsWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPOItemCollection
/**
* 查询当前帐号对应的已产生PO的且为未收货状态的Item
*/
private SPListItemCollection GetPOItemCollection(string sPONumber,string sPRNumber)
{
var qIsReceived = new QueryField("IsReceived", false);
QueryField qCostCenter = new QueryField("CostCenter", false);
QueryField qCreated = new QueryField("Created", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qIsReceived.NotEqual(true));
string sUserName = SPContext.Current.Web.CurrentUser.LoginName;
if (PurchaseRequestCommon.IsInGroups(sUserName, new string[] { "wf_Store" }))
{
List<string> costCenters = GetOwnCostCenters(SPContext.Current.Web.CurrentUser.LoginName);
if (costCenters.Count == 0)
{
return null;
}
CamlExpression ceOR = null;
foreach (var costCenter in costCenters)
{
ceOR = WorkFlowUtil.LinkOr(ceOR, qCostCenter.Equal(costCenter));
}
exp = WorkFlowUtil.LinkAnd(exp, ceOR);
}
else if (PurchaseRequestCommon.IsInGroups(sUserName, new string[] { "wf_HO" }))//如果是wf_HO
{
QueryField qAuthor = new QueryField("Author", false);
exp = WorkFlowUtil.LinkAnd(exp, qAuthor.Equal(SPContext.Current.Web.CurrentUser.Name));
HFIsHO.Value = "True";
}
else if (PurchaseRequestCommon.IsInGroups(sUserName, new string[] { "w_PMGR" }))
{
QueryField qfTitle = new QueryField("Title", false);
exp = WorkFlowUtil.LinkAnd(exp, qfTitle.BeginsWith("H"));
}
int iPO = sPONumber.Length;
int iPR = sPRNumber.Length;
if (iPO > 0)//按PONumber查询
{
QueryField qTitle = new QueryField("Title", false);
exp = WorkFlowUtil.LinkAnd(exp, qTitle.Equal(sPONumber));
}
if (iPR > 0)
{
QueryField qPRNO = new QueryField("PRNumber", false);
exp = WorkFlowUtil.LinkAnd(exp, qPRNO.Equal(sPRNumber));
}
if (iPO > 0 || iPR > 0)
{
QueryField qTitle = new QueryField("Title", false);
CamlExpression ce = null;
ce = WorkFlowUtil.LinkAnd(ce,qIsReceived.NotEqual(true));
ce = WorkFlowUtil.LinkAnd(ce, qTitle.Contains("R"));
exp = WorkFlowUtil.LinkOr(ce, exp);
}
SPListItemCollection lc = ListQuery.Select()
.From(SPContext.Current.Web.Lists["PurchaseOrderItems"])
.Where(exp)
.GetItems();
return lc;
}
示例2: BindCostCenter
void BindCostCenter()
{
DataTable dt = new DataTable();
CamlExpression ceIsActive = null;
CamlExpression ceTitle = null;
CamlExpression ce = null;
QueryField qfIsActive = new QueryField("IsActive");
ceIsActive = WorkFlowUtil.LinkAnd(ceIsActive, qfIsActive.Equal(true));
QueryField qfTitle = new QueryField("Title");
ceTitle = WorkFlowUtil.LinkOr(ceTitle, qfTitle.BeginsWith("S"));
ceTitle = WorkFlowUtil.LinkOr(ceTitle, qfTitle.BeginsWith("H10S"));
ce = WorkFlowUtil.LinkAnd(ceIsActive, ceTitle);
dt = ListQuery.Select().From(SPContext.Current.Web.Lists["Cost Centers"]).Where(ce).GetItems().GetDataTable();
DDLCostCenter.DataSource = dt;
DDLCostCenter.DataTextField = "Display";
DDLCostCenter.DataValueField = "ID";
DDLCostCenter.DataBind();
DDLCostCenter.Items.Insert(0,new ListItem("--Please select CostCenter--",""));
}