当前位置: 首页>>代码示例>>C#>>正文


C# SidejobEntities.AddToClosedProjects方法代码示例

本文整理汇总了C#中SidejobModel.SidejobEntities.AddToClosedProjects方法的典型用法代码示例。如果您正苦于以下问题:C# SidejobEntities.AddToClosedProjects方法的具体用法?C# SidejobEntities.AddToClosedProjects怎么用?C# SidejobEntities.AddToClosedProjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SidejobModel.SidejobEntities的用法示例。


在下文中一共展示了SidejobEntities.AddToClosedProjects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddToClosedProject

    public void AddToClosedProject(int projectId)
    {
        int bidderid = 0;
        using (var context = new SidejobEntities())
        {
            var cp = (from c in context.ClosedProjects
                      where c.ProjectID == projectId
                      select c).FirstOrDefault();

            if (cp != null)
            {
                var bidder = (from p in context.Projects
                              where p.ProjectID == projectId
                              select p).FirstOrDefault();
                if (bidder != null)
                {
                    if (bidder.HighestBidderID != null)
                    {
                        bidderid = (int)bidder.HighestBidderID;
                    }
                }

                var newclosedproject = from p in context.Projects
                                       join b in context.Bids
                                           on p.ProjectID equals b.ProjectID
                                       where p.ProjectID == projectId &&
                                             b.BidderID == bidderid
                                       select new ClosedProject
                                       {
                                           ProjectID = projectId,
                                           DateFinished = DateTime.Now.Date,
                                           PosterID = p.PosterID,
                                           PosterRole = p.PosterRole,
                                           BidderID = p.HighestBidderID,
                                           BidderRole = b.BidderRole,
                                           HighestBid = p.HighestBid,
                                           CurrencyID = b.CurrencyID,
                                           Status = 3
                                       };
                context.AddToClosedProjects((ClosedProject)newclosedproject);
                context.SaveChanges();
                GetBidderPosterProjectProperties(projectId, 0, (ClosedProject)newclosedproject);
            }
        }
    }
开发者ID:haithemaraissia,项目名称:Export,代码行数:45,代码来源:TimeUpBase.cs

示例2: AddToClosedProject

    /////////////////////ADD TO CLOSED PROJECT/////////////////////////
    public void AddToClosedProject(int projectId)
    {
        int bidderid = 0;
        using (var context = new SidejobEntities())
        {
            var cp = (from c in context.ClosedProjects
                      where c.ProjectID == projectId
                      select c).FirstOrDefault();

            if (cp == null)
            {
                var bidder = (from p in context.Projects
                              where p.ProjectID == projectId
                              select p).FirstOrDefault();
                if (bidder != null)
                {
                    if (bidder.HighestBidderID != null)
                    {
                        bidderid = (int)bidder.HighestBidderID;
                    }
                }
                var chosenproject = (from p in context.Projects
                                     where p.ProjectID == projectId
                                     select p).FirstOrDefault();
                var chosenbid = (from p in context.Bids
                                 where p.BidderID == bidderid
                                 select p).FirstOrDefault();
                if (chosenproject != null && chosenbid != null)
                {
                    var newcp = new ClosedProject
                    {
                        ProjectID = projectId,
                        DateFinished = DateTime.UtcNow.Date,
                        PosterID = chosenproject.PosterID,
                        PosterRole = chosenproject.PosterRole,
                        BidderID = chosenproject.HighestBidderID,
                        BidderRole = chosenbid.BidderRole,
                        HighestBid = chosenproject.HighestBid,
                        CurrencyID = chosenbid.CurrencyID,
                        Status = 3
                    };
                    context.AddToClosedProjects(newcp);
                    context.SaveChanges();
                    GetBidderPosterProjectProperties(projectId, 0, newcp);
                }
            }
        }
    }
开发者ID:haithemaraissia,项目名称:SJSchedule,代码行数:49,代码来源:TimeUp.cs


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