本文整理汇总了C#中QueryField.Equal方法的典型用法代码示例。如果您正苦于以下问题:C# QueryField.Equal方法的具体用法?C# QueryField.Equal怎么用?C# QueryField.Equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryField
的用法示例。
在下文中一共展示了QueryField.Equal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrderInfo
protected SPListItem GetOrderInfo(string orderNumber, string department)
{
SPListItem item = null;
var qOrderNumber = new QueryField("Order_x0020_Number", false);
var qDepartment = new QueryField("Department", false);
var qStatus = new QueryField("Status", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qOrderNumber.Equal(orderNumber));
exp = WorkFlowUtil.LinkAnd(exp, qDepartment.Equal(department));
var status = CAWorkflowStatus.Completed;
exp = WorkFlowUtil.LinkAnd(exp, qStatus.Equal(status));
SPListItemCollection lc = ListQuery.Select()
.From(WorkFlowUtil.GetWorkflowList("CreationOrder"))
.Where(exp)
.GetItems();
if (lc.Count > 0)
{
item = lc[0];
}
return item;
}
示例2: Query
public DataTable Query(string selectedMonth)
{
if (string.IsNullOrEmpty(selectedMonth))
{
return null;
}
var dt = new DataTable();
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (var site = new SPSite(SPContext.Current.Site.ID))
{
using (var web = site.OpenWeb("workflowcenter"))
{
var monthField = new QueryField("StatMon", false);
CamlExpression exp = monthField.Equal(selectedMonth + "-1");
dt = ListQuery.Select()
.From(web.Lists[LeaveDataListName])
.Where(exp)
.OrderBy(new QueryField("EmployeeName", false), false)
.OrderBy(new QueryField("TimeWageType", false), true)
.OrderBy(new QueryField("Date", false), true)
.GetDataTable();
}
}
});
return dt;
}
示例3: GetMailMembers
/*
*
*/
public static List<string> GetMailMembers(params string[] personTypes)
{
List<string> members = new List<string>();
var qType = new QueryField("PersonType", false);
CamlExpression exp = null;
foreach (var type in personTypes)
{
exp = WorkFlowUtil.LinkOr(exp, qType.Equal(type));
}
SPListItemCollection lc = null;
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
lc = ListQuery.Select()
.From(web.Lists["MailMember"])
.Where(exp)
.GetItems();
}
}
});
foreach (SPListItem item in lc)
{
members.Add(item["Account"].AsString());
}
return members;
}
示例4: GetFlightPriceItem
/*
* Return list item according to from value and to value
*/
protected SPListItem GetFlightPriceItem(string from, string to)
{
var qFromCN = new QueryField("FromCN", false);
var qFromEN = new QueryField("FromEN", false);
var qToEN = new QueryField("ToEN", false);
var qToCN = new QueryField("ToCN", false);
//From->To
CamlExpression exp = null;
exp = WorkFlowUtil.LinkOr(exp, qFromEN.Equal(from));
exp = WorkFlowUtil.LinkOr(exp, qFromCN.Equal(from));
CamlExpression exp1 = null;
exp1 = WorkFlowUtil.LinkOr(exp1, qToEN.Equal(to));
exp1 = WorkFlowUtil.LinkOr(exp1, qToCN.Equal(to));
CamlExpression exp2 = WorkFlowUtil.LinkAnd(exp, exp1);
//To->From
exp = WorkFlowUtil.LinkOr(exp, qFromEN.Equal(to));
exp = WorkFlowUtil.LinkOr(exp, qFromCN.Equal(to));
exp1 = WorkFlowUtil.LinkOr(exp1, qToEN.Equal(from));
exp1 = WorkFlowUtil.LinkOr(exp1, qToCN.Equal(from));
CamlExpression exp3 = WorkFlowUtil.LinkAnd(exp, exp1);
//From<->To
CamlExpression exp4 = WorkFlowUtil.LinkOr(exp2, exp3);
SPListItemCollection lc = ListQuery.Select()
.From(WorkFlowUtil.GetWorkflowList("Flight Price"))
.Where(exp4)
.GetItems();
return lc.Count > 0 ? lc[0] : null;
}
示例5: GenerateID
internal static object GenerateID(string preFix, string listName)
{
int nNum = 1;
SPList list = SPContext.Current.Web.Lists[AnalogicConstant.TMSNumberListName];
QueryField field = new QueryField("Title");
CAMLExpression<object> exp = field.Equal(listName);
SPListItemCollection items = ListQuery.Select().From(list).Where(exp).GetItems();
if (items != null && items.Count > 0)
{
SPListItem item = list.GetItemById(items[0].ID);
nNum = Convert.ToInt32(items[0][AnalogicConstant.TMSNumber]) + 1;
item[AnalogicConstant.TMSNumber] = Convert.ToDouble(nNum);
item.Web.AllowUnsafeUpdates = true;
item.Update();
item.Web.AllowUnsafeUpdates = false;
}
else
{
SPListItem item = list.Items.Add();
item[SPBuiltInFieldId.Title] = listName;
item[AnalogicConstant.TMSNumber] = nNum;
item.Web.AllowUnsafeUpdates = true;
item.Update();
item.Web.AllowUnsafeUpdates = false;
}
return string.Format("{0}{1:000000}", preFix, nNum);
}
示例6: FilterVendor
protected SPListItemCollection FilterVendor(string workflowNumber, string vendId, string enName, string cnName, string status, string applicantAccount, string department)
{
var qWorkflowNumber = new QueryField("Title", false);
var qENName = new QueryField("EN_x0020_Name_x0020_of_x0020_Ven", false);
var qCNName = new QueryField("CN_x0020_Name_x0020_of_x0020_Ven", false);
var qRecordType = new QueryField("Record_x0020_Type", false);
var qStatus = new QueryField("Status", false);
var qVendId = new QueryField("Vendor_x0020_ID", false);
var qApplicantAccount = new QueryField("Applicant", false);
var qDepartmentVal = new QueryField("DepartmentVal", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qRecordType.Equal("New"));
if (!string.IsNullOrEmpty(status))
{
exp = WorkFlowUtil.LinkAnd(exp, qStatus.Equal(status));
}
if (!string.IsNullOrEmpty(workflowNumber))
{
exp = WorkFlowUtil.LinkAnd(exp, qWorkflowNumber.Equal(workflowNumber));
}
if (!string.IsNullOrEmpty(vendId))
{
exp = WorkFlowUtil.LinkAnd(exp, qVendId.Equal(vendId));
}
if (!string.IsNullOrEmpty(enName))
{
exp = WorkFlowUtil.LinkAnd(exp, qENName.Contains(enName));
}
if (!string.IsNullOrEmpty(cnName))
{
exp = WorkFlowUtil.LinkAnd(exp, qCNName.Contains(cnName));
}
if (!string.IsNullOrEmpty(applicantAccount))
{
//Applicant: Test1(CA\\test1)
//applicantAccount: CA\\test1
exp = WorkFlowUtil.LinkAnd(exp, qApplicantAccount.Contains(applicantAccount));
}
if (!string.IsNullOrEmpty(department))
{
exp = WorkFlowUtil.LinkAnd(exp, qDepartmentVal.Equal(department));
}
var result = ListQuery.Select().From(WorkFlowUtil.GetWorkflowList("Non Trade Supplier Setup Maintenance Workflow"))
.Where(exp)
.OrderBy(new QueryField("Title", false), true)
.GetItems();
return result;
}
示例7: GetDataCollection
/*
* Return data collection according to given REQUESTID and LISTNAME
*/
protected SPListItemCollection GetDataCollection(string requestId, string listName)
{
var qRequestId = new QueryField("Title", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qRequestId.Equal(requestId));
SPListItemCollection lc = ListQuery.Select()
.From(WorkFlowUtil.GetWorkflowList(listName))
.Where(exp)
.GetItems();
return lc;
}
示例8: GetApprovedItemCollection
public SPListItemCollection GetApprovedItemCollection(string listName)
{
SPContext context = SPContext.Current;
SPListItemCollection items = null;
SPList list = context.Web.Lists[listName];
QueryField outcomeField = new QueryField("Outcome");
CAMLExpression<object> exp = outcomeField.Equal("Approved");
items = ListQuery.Select().From(list).Where(exp).GetItems();
return items;
}
示例9: isExistOrder
protected bool isExistOrder(string orderNumber, string department)
{
var qOrderNumber = new QueryField("Order_x0020_Number", false);
var qDepartment = new QueryField("Department", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qOrderNumber.Equal(orderNumber));
exp = WorkFlowUtil.LinkAnd(exp, qDepartment.Equal(department));
SPListItemCollection lc = ListQuery.Select()
.From(WorkFlowUtil.GetWorkflowList("CreationOrder"))
.Where(exp)
.GetItems();
return lc.Count > 0;
}
示例10: GetExchangeRate
//Return the exchange rate item
protected SPListItem GetExchangeRate(string from, string to)
{
var qFrom = new QueryField("From", false);
var qTo = new QueryField("To", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qFrom.Equal(from));
exp = WorkFlowUtil.LinkAnd(exp, qTo.Equal(to));
SPListItemCollection lc = ListQuery.Select()
.From(WorkFlowUtil.GetWorkflowList("ExchangeRates"))
.Where(exp)
.GetItems();
return lc.Count > 0 ? lc[0] : null;
}
示例11: IsSubmiter
private bool IsSubmiter()
{
QueryField field = new QueryField("Title");
CA.SharePoint.ISharePointService sps = CA.SharePoint.ServiceFactory.GetSharePointService(true);
SPList list = sps.GetList("NewsApproveConfig");
SPListItemCollection items = sps.Query(list, field.Equal(SPContext.Current.List.Title), 1);
if (items != null && items.Count > 0)
{
string users = items[0]["Submitted"] + "";
string strCurrentUser = string.Empty;
if (SPContext.Current.Web.CurrentUser.IsSiteAdmin)
strCurrentUser = HttpContext.Current.User.Identity.Name;
else
strCurrentUser = SPContext.Current.Web.CurrentUser.LoginName;
if (users.ToLower().Contains(strCurrentUser.ToLower()))
return true;
}
return false;
}
示例12: actions_ActionExecuting
void actions_ActionExecuting(object sender, QuickFlow.UI.Controls.ActionEventArgs e)
{
if (e.Action.Equals("End", StringComparison.CurrentCultureIgnoreCase))
{
WorkflowContext.Current.DataFields["Status"] = "Cancelled";
SPListItem item = SPContext.Current.ListItem;
ISharePointService sps = ServiceFactory.GetSharePointService(true);
SPList listBalance = sps.GetList(CAWorkFlowConstants.ListName.LeaveBalance.ToString());
QueryField field = new QueryField("Employee");
QueryField field2 = new QueryField("Year");
int year = DateTime.Parse(item["DateFrom"] + "").Year;
//根据field来查询
SPListItemCollection items = sps.Query(listBalance, field.Equal(this.DataForm1.ApplicantName) && field2.Equal(year), 1);
//审批submit后 在balance表中扣除所请的天数
SPListItem itemBalance = items[0];
return;
}
bool IsSick = this.DataForm1.IsSickLeave;
WorkflowContext.Current.UpdateWorkflowVariable("IsSickLeave", IsSick);
string deptHead = WorkFlowUtil.GetEmployeeApprover(this.CurrentEmployee).UserAccount;
WorkflowContext.Current.UpdateWorkflowVariable(CA.WorkFlow.UI.Constants.WorkFlowStep.TimeOffDepartmentHeadAccount, GetDelemanNameCollection(new NameCollection(deptHead), Constants.CAModules.LeaveApplication));
string strNextTaskUrl = @"_Layouts/CA/WorkFlows/TimeOff2/EditForm.aspx";
string strNextTaskTitle = string.Format("{0}'s leave application needs approval", SPContext.Current.Web.CurrentUser.Name);
WorkflowContext.Current.UpdateWorkflowVariable("NextTaskUrl", strNextTaskUrl);
WorkflowContext.Current.UpdateWorkflowVariable("NextTaskTitle", strNextTaskTitle);
WorkflowContext.Current.DataFields["IsSave"] = 0;
WorkflowContext.Current.DataFields["EmployeeID"] = this.DataForm1.EmployeeNo;
WorkflowContext.Current.DataFields["Status"] = "In Progress";
WorkFlowUtil.UpdateWorkflowPath(WorkflowContext.Current);
}
示例13: GetActiveItemCode
/**
* 获取有效的Item Code
*/
private static DataTable GetActiveItemCode()
{
var qIsActive = new QueryField("IsActive", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qIsActive.Equal(true));
SPListItemCollection lc = null;
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
lc = ListQuery.Select()
.From(web.Lists["Item Codes"])
.Where(exp)
.GetItems();
}
}
});
return lc.GetDataTable();
}
示例14: GetAllTasks
public static SPListItemCollection GetAllTasks(string listId, string itemId)
{
var qWorkflowListId = new QueryField("WorkflowListId", false);
var qWorkflowItemId = new QueryField("WorkflowItemId", false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qWorkflowListId.Equal(listId));
exp = WorkFlowUtil.LinkAnd(exp, qWorkflowItemId.Equal(itemId));
SPListItemCollection lc = null;
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
lc = ListQuery.Select()
.From(web.Lists["Tasks"])
.Where(exp)
.GetItems();
}
}
});
return lc;
}
示例15: GetCollectionByColumn
/*
* Return data collection according to given REQUESTID and LISTNAME
* 这个方法将是GetCollection(string requestId, string listName)的替代方法,以后尽量不要用上面那个,而换成用这个
*/
public static SPListItemCollection GetCollectionByColumn(string column, string value, string listName)
{
var qColumn = new QueryField(column, false);
CamlExpression exp = null;
exp = WorkFlowUtil.LinkAnd(exp, qColumn.Equal(value));
SPListItemCollection lc = null;
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
lc = ListQuery.Select()
.From(WorkFlowUtil.GetWorkflowList(listName))
.Where(exp)
.GetItems();
}
}
});
return lc;
}