• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# QueryField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中QueryField的典型用法代码示例。如果您正苦于以下问题:C# QueryField类的具体用法?C# QueryField怎么用?C# QueryField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QueryField类属于命名空间,在下文中一共展示了QueryField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:23,代码来源:InternalOrderUserControl.cs


示例2: 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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:35,代码来源:TravelRequest2Control.cs


示例3: 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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:30,代码来源:CALeaveData.ascx.cs


示例4: 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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:35,代码来源:TravelRequest2Common.cs


示例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);
        }
开发者ID:porter1130,项目名称:Analogic,代码行数:32,代码来源:Utility.cs


示例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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:57,代码来源:NonTradeSupplierSetupMaintenanceControl.cs


示例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;
 }
开发者ID:porter1130,项目名称:C-A,代码行数:14,代码来源:TravelRequest2Control.cs


示例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;
        }
开发者ID:porter1130,项目名称:Medalsoft,代码行数:14,代码来源:SharepointEntry.cs


示例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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:15,代码来源:CreateOrderUserControl.cs


示例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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:17,代码来源:TravelRequest2Control.cs


示例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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:21,代码来源:CAAddItemWebPart.cs


示例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);
        }
开发者ID:porter1130,项目名称:C-A,代码行数:40,代码来源:ApplicantEditForm.aspx.cs


示例13: CreateWorkFlowNumber2

        public int CreateWorkFlowNumber2(string workflowName)
        {
            int nNum = 1;
            //CA.SharePoint.ISharePointService sps = ServiceFactory.GetSharePointService(true);
            //SPList list = sps.GetList(CAWorkFlowConstants.ListName.WorkFlowNumber.ToString());

            var list = SPContext.Current.Web.Lists[CAWorkFlowConstants.ListName.WorkFlowNumber.ToString()];
            QueryField field = new QueryField("Title");

            //SPListItemCollection items = sps.Query(list, field.Equal(workflowName), 1, null);
            SPQuery query = new SPQuery();
            var querystr = @"<Where>
                                <Eq>
                                   <FieldRef Name='Title' />
                                   <Value Type='Text'>{0}</Value>
                                </Eq>
                             </Where>";

            query.Query = string.Format(querystr, workflowName);
            var items = list.GetItems(query);

            if (items != null && items.Count > 0)
            {
                SPListItem item = items[0];//list.GetItemById(items[0].ID);
                nNum = Convert.ToInt32(item["Number"]) + 1;//Convert.ToInt32(items[0]["Number"]) + 1;
                item["Number"] = Convert.ToDouble(nNum);
                item.Web.AllowUnsafeUpdates = true;
                item.Update();
            }
            else
            {
                SPListItem item = list.Items.Add();
                item["WorkFlowName"] = workflowName;
                item["Number"] = nNum;
                item.Web.AllowUnsafeUpdates = true;
                item.Update();
            }

            return nNum;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:40,代码来源:NewForm.aspx.cs


示例14: 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();
        }
开发者ID:porter1130,项目名称:C-A,代码行数:27,代码来源:WorkflowListData.cs


示例15: 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;
        }
开发者ID:porter1130,项目名称:C-A,代码行数:24,代码来源:PaymentRequestComm.cs


示例16: QueryFieldGetOperatorTest1

 public void QueryFieldGetOperatorTest1()
 {
     var field = new QueryField();
      Assert.AreEqual("=", field.Operator);
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:5,代码来源:QueryParametersTests.cs


示例17: FillBalanceData

        /// <summary>
        /// 给页面赋值
        /// </summary>
        private void FillBalanceData()
        {
            //得到sharepointservice 用来进行sharepoint API操作
             ISharePointService sps = ServiceFactory.GetSharePointService(true);

            //获取列表
            SPList listBalance = sps.GetList(CAWorkFlowConstants.ListName.LeaveBalance.ToString());

            //根据field来查询
            QueryField field=new QueryField("Employee");
            QueryField field2 =new QueryField("Year");
            SPListItemCollection items = sps.Query(listBalance, field.Equal(this.ApplicantName) && field2.Equal(DateTime.Now.Year), 1);

            //如果有值
            if (items.Count > 0)
            {
                this.labAnnulLeave.Text = items[0]["AnnualBalance"] + "";
                this.labSickLeave.Text = items[0]["SickBalance"] + "";
                this.labAnnualEntitlement.Text = items[0]["AnnualEntitlement"] + "";
                this.labSickEntitlement.Text = items[0]["SickEntitlement"] + "";

                this.Balance =  Convert.ToDouble(items[0]["AnnualBalance"]);
                this.SickBalance =  Convert.ToDouble(items[0]["SickBalance"]);
            }
            else
            {
                this.labAnnulLeave.Text = "0";
                this.labSickLeave.Text = "0";
                this.labAnnualEntitlement.Text = "0";
                this.labSickEntitlement.Text = "0";
            }
        }
开发者ID:porter1130,项目名称:C-A,代码行数:35,代码来源:DataFormNew.ascx.cs


示例18: GetEmailTemplateByTitle

        //Get the list item that contains email subject and body
        public static SPListItem GetEmailTemplateByTitle(string title)
        {
            var qTitle = new QueryField("Title", false);
            CamlExpression exp = null;
            exp = WorkFlowUtil.LinkAnd(exp, qTitle.Equal(title));
            SPListItemCollection lc = ListQuery.Select()
                .From(GetWorkflowList("EmailTemplate"))
                .Where(exp)
                .GetItems();

            return lc.Count == 0 ? null : lc[0];
        }
开发者ID:porter1130,项目名称:C-A,代码行数:13,代码来源:WorkFlowUtil.cs


示例19: QueryFieldValueTest3

 public void QueryFieldValueTest3()
 {
     var field = new QueryField();
      field.Value = 6900;
      Assert.AreEqual("6900", field.Value);
      field.Value = null;
      Assert.IsNull(field.Value);
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:8,代码来源:QueryParametersTests.cs


示例20: QueryFieldValueTest2

 public void QueryFieldValueTest2()
 {
     var field = new QueryField();
      field.Value = new DateTime(2000, 1, 1);
      Assert.AreEqual(new DateTime(2000, 1, 1), field.Value);
      field.Value = null;
      Assert.IsNull(field.Value);
 }
开发者ID:kszysiu,项目名称:hfm-net,代码行数:8,代码来源:QueryParametersTests.cs



注:本文中的QueryField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# QueryFilter类代码示例发布时间:2022-05-24
下一篇:
C# QueryExpression类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap