Server/_Task.asmx.cs

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Web;
using System.Web.Services;
using TeamTask.Model;

namespace TeamTask.Server
{
    /// <summary>
    /// _Task 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 
    [System.Web.Script.Services.ScriptService]
    public class _Task : System.Web.Services.WebService
    {
        public _Task() 
        {
            Common.Helper.Validate(Context);
        }

        [WebMethod(true)]
        public dynamic search(int rows, int page, string sidx, string sord, string title, string type, string status,int[] tags, bool onlyMy)
        {
            dynamic result = null;
            using (var db = new DBContext())
            {
                var objContext = ((IObjectContextAdapter)db).ObjectContext;
                var all = objContext.CreateObjectSet<Task>();
                //排序
                var whereList = all.OrderBy(string.Format("it.{0} {1}", sidx, sord)).AsQueryable();
                //条件
                if (!string.IsNullOrEmpty(title))
                    whereList = whereList.Where(m => m.Title.Contains(title));
                if (!string.IsNullOrEmpty(type))
                    whereList = whereList.Where(m => m.Type == type);
                if (!string.IsNullOrEmpty(status))
                    whereList = whereList.Where(m => m.Status == status);
                if (onlyMy)
                    whereList = whereList.Where(m => m.UserID == Common.Helper.UserID);
                
                foreach (var item in tags)
                    whereList = whereList.Where(m => m.Task_Tag.Count(t => t.TagID == item) > 0);

                //结果
                var records = whereList.Count();
                result = new
                {
                    rows =
                    (from i in whereList.Skip((page - 1) * rows).Take(rows).AsEnumerable()
                     select new
                     {
                         i.ID,
                         i.Title,
                         Type = Common.Helper.TaskType.First(m => m.Key.ToString() == i.Type).Value,
                         i.Status,
后面还有 217 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。