国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

關(guān)于完整解答Leo C.W博客中名為“我們公司的ASP.NET 筆試題,你覺得難度如何”的所有題目

2019-11-17 01:53:12
字體:
供稿:網(wǎng)友

關(guān)于完整解答Leo C.W博客中名為“我們公司的asp.net 筆試題,你覺得難度如何”的所有題目

關(guān)于完整解答Leo C.W博客中名為“我們公司的ASP.NET 筆試題,你覺得難度如何”的所有題目,請大家鑒定,不足之處,敬請指教!

第1到3題解答如下:

    public enum QuestionType    {        Text = 0,        MultipleChoice = 1    }    public interface IQuestion    {        string Title { get; set; }        QuestionType Category { get; }        string GetAnswer();    }    public abstract class QuestionBase : IQuestion    {        public string Title { get; set; }        public abstract QuestionType Category { get; }        public virtual string GetAnswer()        {            return "默認(rèn)答案";        }    }    public class TextQuestion : QuestionBase    {        public override QuestionType Category { get { return QuestionType.Text; } }        public override string GetAnswer()        {            return "文本答案";        }    }    public class MultipleChoiceQuestion : QuestionBase    {        public override QuestionType Category { get { return QuestionType.MultipleChoice; } }        public override string GetAnswer()        {            return "單選答案";        }    }

第4題:

    public class PRoduct    {        public string Name { get; set; }        public string IsDeleted { get; set; }    }    public static class ProductExtension    {        public static IQueryable<Product> WhereNotDeleted(this IQueryable<Product> query)        {            return query.Where(p => p.IsDeleted != "是");        }    }    public class ProductService    {        public List<Product> GetActiveProducts(IQueryable<Product> query)        {            return query.WhereNotDeleted().ToList();        }    }

第5

select T1.Name,T2.[Year],T2.[Month],T2.InCome from [User] as T1 inner join(select UserId,[Year],[Month],COUNT(Amount) AS InCome from InCome group by UserId,[Year],[Month]) as T2on T1.Id=T2.UserIdorder by T2.UserId,T2.[Year],T2.[Month]
select T1.Name,T2.[Year],T2.[Month],COUNT(T2.Amount) AS InCome from [User] as T1 inner join InCome as T2 on T1.Id=T2.UserIdgroup by T1.Name,T2.[Year],T2.[Month] order by T1.Name,T2.[Year],T2.[Month]

第6題:

    public class User    {        public int Id { get; set; }        public string Name { get; set; }    }    public class Income    {        public int Id { get; set; }        public int UserId { get; set; }        public decimal Amount { get; set; }        public int Year { get; set; }        public int Month { get; set; }    }    public class UserIncomeDto    {        public string Name { get; set; }        public int Year { get; set; }        public int Month { get; set; }        public decimal Income { get; set; }    }    public class UserIncomeService    {        public List<UserIncomeDto> GetUserIncomeDtos(IQueryable<User> users, IQueryable<Income> incomes)        {            var resultList = (from u in users                          join newic in                              (from ic in incomes                               group ic by new { ic.UserId, ic.Year, ic.Month } into gp                               select new { gp.Key, InCome = gp.Sum(g => g.Amount) })                              on u.Id equals newic.Key.UserId                    orderby newic.Key                    select new UserIncomeDto() { Name = u.Name, Year = newic.Key.Year, Month = newic.Key.Month, Income = newic.InCome }).ToList();            return resultList;                                     }    }

第7

改HTML:

<form action="/admin/mobile/user/login" method="POST">    <input type="text" placeholder="username" name="username" />    <input type="passWord" placeholder="password" name="password" />    <input type="submit" value="login" /></form>

改路由:

            routes.MapRoute("UserLogin",                            "~/admin/mobile/{controller}/{action}",                            new { controller = "User", action = "Login" });

第8題:

    public class Product1    {        public string Name { get; set; }        public string Description { get; set; }        public void Validate1()        {            if (string.IsNullOrEmpty(this.Name))            {                throw new Exception("please enter a name for the product");            }            if (string.IsNullOrEmpty(this.Description))            {                throw new Exception("product description is required");            }        }        public void Validate2()        {            this.Require(x => x.Name, "please enter a name for the product");            this.Require(x => x.Description, "product description is required");        }        public void Require(Expression<Func<Product1, string>> expression, string errorMessage)        {            Func<Product1, string> func = expression.Compile();            if (string.IsNullOrEmpty(func(this)))            {                throw new Exception(errorMessage);            }        }    }    public class TestProgram    {        public static void Main()        {            Product1 product1 = new Product1();            try            {                product1.Validate2();            }            catch (Exception ex)            {                Console.WriteLine(ex.Message);            }            Console.Read();        }    }

更多IT相關(guān)的文章,歡迎光臨我的個人網(wǎng)站:http://www.zuowenjun.cn/


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 通化县| 嘉鱼县| 福安市| 察哈| 清徐县| 区。| 周宁县| 安多县| 阜平县| 敖汉旗| 屯留县| 乌审旗| 嘉义县| 峨山| 南华县| 江津市| 金山区| 高尔夫| 华容县| 瓦房店市| 聂拉木县| 融水| 辉县市| 侯马市| 广南县| 德化县| 临沂市| 苏尼特右旗| 桐乡市| 黄山市| 丰县| 南皮县| 通海县| 贡觉县| 合阳县| 三门县| 万源市| 吉木萨尔县| 桓台县| 永顺县| 丘北县|