小编Ahm*_*laa的帖子

实体框架选择上个月的记录

我有员工薪水表,其中包含:

public partial class S_EmployeeSalary
    {
        public int SalaryId { get; set; }
        public int TypeId { get; set; }
        public int UserId { get; set; }
        public double Salary { get; set; }
        public Nullable<double> ExtraSalary { get; set; }
        public Nullable<double> Insurance { get; set; }
        public Nullable<double> Sanctions { get; set; }
        public System.DateTime SalaryDate { get; set; }

        public virtual C_UserItems C_UserItems { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

当用户点击它时我有一个按钮,它会自动创建上个月记录的副本,只更新创建的新月记录:

public ActionResult CreateNewRows(int typeId)
{
    IQueryable<S_EmployeeSalary> moduleItems = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc entity-framework

3
推荐指数
1
解决办法
4620
查看次数

使用 SyndicateItem 类在 RSS 提要中显示图像

我使用 System.ServiceModel.Syndicate 创建 RSS 提要

public ActionResult RSS()
{
    List<C_Node> rssNodes = GetNodeList(takeNum: 20).ToList();
    var syndItems = new List<SyndicationItem>();
    foreach (var item in rssNodes)
    {
        var syndItem = new SyndicationItem()
        {
            Id = item.NodeId.ToString(),
            Title = SyndicationContent.CreatePlaintextContent(String.Format("{0}", item.Title)),
            Summary = SyndicationContent.CreateHtmlContent(HelperMethods.Truncate(item.Details, 400)),
            Content = SyndicationContent.CreateHtmlContent(item.Details),
            PublishDate = item.PostDate
        };
        //syndItem.ElementExtensions.Add("content:encoded", "", SyndicationContent.CreateHtmlContent(item.Details));
        syndItem.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(ConfigurationManager.AppSettings["SiteUrl"] + Url.Action("Details", "Node", new { id = item.NodeId }))));//Nothing alternate about it. It is the MAIN link for the item.
        syndItems.Add(syndItem);
    }

    return new RssFeed(title: Resources.Site.Title, …
Run Code Online (Sandbox Code Playgroud)

c# asp.net rss asp.net-mvc syndication

3
推荐指数
1
解决办法
2379
查看次数

Facebook.Client包安装错误

我试图在我的Visual Studio项目中安装Facebook.Client包,但它失败了这条消息:

安装包:无法安装包'Facebook.Client 1.0.4'.您正在尝试将此软件包安装到以".NETFramework,Version = v4.5"为目标的项目中,但该软件包不包含与该框架兼容的任何程序集引用或内容文件.有关更多信息,请与软件包作者联系.

c# sdk facebook visual-studio nuget

2
推荐指数
1
解决办法
949
查看次数