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


C# SidejobEntities.DeleteObject方法代码示例

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


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

示例1: EmailAutomation

 public void EmailAutomation()
 {
     using (var context = new SidejobEntities())
     {
         var message = (from c in context.AutomatedMessages
                        select c).ToList();
         if (message.Count != 0)
         {
             foreach (var e in message)
             {
                 try
                 {
                     SendEmail(e.EmailAddress, e.Title, e.MessageID.ToString(CultureInfo.InvariantCulture), Server.MapPath("~/EmailTemplates/AutomatedMessage.aspx"), Message.Automated);
                 }
                 catch (Exception emailexception)
                 {
                     var emailProblem = new AutomationEmailProblem
                                            {
                                                MessageID = e.MessageID,
                                                EmailAddress = e.EmailAddress,
                                                Title = e.Title,
                                                Message = e.Message
                                            };
                     context.AddToAutomationEmailProblems(emailProblem);
                 }
             }
         }
         context.DeleteObject(message);
         context.SaveChanges();
     }
 }
开发者ID:haithemaraissia,项目名称:Export,代码行数:31,代码来源:TimeUpProcess.aspx.cs

示例2: GetValue

 //private void GetValue(SidejobEntities context)
 //{
 //    var projectsecondchance = (from c in context.ProjectSecondChances
 //                               where c.ProjectID == ProjectID
 //                               select c).ToList();
 //    if (projectsecondchance.Count != 0)
 //    {
 //        foreach (var psc in projectsecondchance)
 //        {
 //            context.DeleteObject(psc);
 //            context.SaveChanges();
 //        }
 //    }
 //}
 private void GetValue(SidejobEntities context, ICollection somelist)
 {
     if (somelist.Count <= 0) return;
     foreach (var item in somelist)
     {
         context.DeleteObject(item);
         context.SaveChanges();
     }
 }
开发者ID:haithemaraissia,项目名称:SJSchedule,代码行数:23,代码来源:GenericTest.aspx.cs

示例3: DeleteFromResponseDelay

    public void DeleteFromResponseDelay(SidejobEntities context)
    {
        var rd = (from c in context.ResponseDelays
                  where c.ProjectID == ProjectID
                  select c).FirstOrDefault();

        if ( rd != null)
        {
            context.DeleteObject(rd);
            context.SaveChanges();
        }
    }
开发者ID:haithemaraissia,项目名称:Export,代码行数:12,代码来源:NewProjectBidProcess.cs

示例4: DeleteAllBids

    public void DeleteAllBids(SidejobEntities context, int projectId, int bidderid)
    {
        var bids = (from c in context.Bids
                    where c.ProjectID == projectId
                    orderby c.AmountOffered descending
                    select c).ToList();
        if (bids.Count != 0)
        {
            foreach (var b in bids)
            {
                context.DeleteObject(b);
            }
        }

        context.SaveChanges();
    }
开发者ID:haithemaraissia,项目名称:SJSchedule,代码行数:16,代码来源:NewProjectBidProcess.cs

示例5: AutomatedEmailProblemGridViewSelectedIndexChanged

    protected void AutomatedEmailProblemGridViewSelectedIndexChanged(object sender, EventArgs e)
    {
        //Issue is fixed, then delete it
        if (AutomatedEmailProblemGridView.SelectedDataKey == null) return;
        var selected = (int)AutomatedEmailProblemGridView.SelectedDataKey.Value;

        using (var context = new SidejobEntities())
        {
            var current = (from c in context.AutomationEmailProblems
                           where c.MessageID == selected
                           select c).FirstOrDefault();
            if (current != null)
            {
                context.DeleteObject(current);
                context.SaveChanges();
            }

        }
    }
开发者ID:haithemaraissia,项目名称:Export,代码行数:19,代码来源:AutomatedEmailProblem.aspx.cs

示例6: EmailSentExceptionGridViewSelectedIndexChanged

        protected void EmailSentExceptionGridViewSelectedIndexChanged(object sender, EventArgs e)
        {
            //Issue is fixed, then delete it
            if (EmailSentExceptionGridView.SelectedDataKey == null) return;
            var selected = (int)EmailSentExceptionGridView.SelectedDataKey.Value;

            using (var context = new SidejobEntities())
            {
                var current = (from c in context.EmailSentExceptions
                               where c.ID == selected
                               select c).FirstOrDefault();
                if (current != null)
                {
                    context.DeleteObject(current);
                    context.SaveChanges();
                    Response.Redirect(Context.Request.Url.ToString());
                }

            }
        }
开发者ID:haithemaraissia,项目名称:SJManage,代码行数:20,代码来源:ManagementEmailProblem.aspx.cs

示例7: ArchiveRefund

 protected void ArchiveRefund(int pdtid)
 {
     using (var context = new SidejobEntities())
     {
         var currentrefund = (from c in context.RefundCustomerSuccessfulPDTs
                              where c.PDTID == pdtid
                              select c).FirstOrDefault();
         if(currentrefund != null)
         {
             var archivedrefund = new ArchivedRefundCustomerSuccessfulPDT
                                      {
                                          PDTID = currentrefund.PDTID,
                                          GrossTotal = currentrefund.GrossTotal,
                                          Invoice = currentrefund.Invoice,
                                          PaymentStatus = currentrefund.PaymentStatus,
                                          FirstName = currentrefund.FirstName,
                                          LastName = currentrefund.LastName,
                                          PaymentFee = currentrefund.PaymentFee,
                                          BusinessEmail = currentrefund.BusinessEmail,
                                          TxToken = currentrefund.TxToken,
                                          ReceiverEmail = currentrefund.ReceiverEmail,
                                          ItemName = currentrefund.ItemName,
                                          CurrencyCode = currentrefund.CurrencyCode,
                                          TransactionId = currentrefund.TransactionId,
                                          Custom = currentrefund.Custom,
                                          subscriberId = currentrefund.subscriberId,
                                          CustomerID = currentrefund.CustomerID,
                                          ProjectID = currentrefund.ProjectID
                                      };
             context.AddToArchivedRefundCustomerSuccessfulPDTs(archivedrefund);
             context.DeleteObject(currentrefund);
             context.SaveChanges();
             Response.Redirect(Context.Request.Url.ToString());
         }
     }
 }
开发者ID:haithemaraissia,项目名称:Export,代码行数:36,代码来源:RefundCustomer.aspx.cs

示例8: AutomatedMessageProcessStart

    public void AutomatedMessageProcessStart()
    {
        using (var context = new SidejobEntities())
        {
            var message = (from c in context.AutomatedMessages
                           select c).ToList();

            if (message.Count == 0) return;
            foreach (var m in message)
            {
                try
                {
                    SendEmail(m.EmailAddress,
                              "http://www.my-side-job.com/Schedule/MySideJob/EmailTemplates/AutomatedMessage.aspx",
                              m.MessageID.ToString(CultureInfo.InvariantCulture));
                    context.DeleteObject(m);
                }
                catch (Exception)
                {
                    CatchMessage(context, m);
                }
            }
        }
    }
开发者ID:haithemaraissia,项目名称:Export,代码行数:24,代码来源:AutomatedEmail.cs

示例9: RefundCustomer

 public void RefundCustomer(int customerId)
 {
     //Check Successful PDT and Check ArchivedSuccessful PDT
     using (var context = new SidejobEntities())
     {
         //Check Successful PDT
         var e = (from c in context.CustomerSuccessfulPDTs
                  where c.CustomerID == customerId && c.ProjectID == ProjectID
                  select c).FirstOrDefault();
         if (e == null)
         {
             CheckCustomerArchivedPDT(customerId, context);
         }
         else
         {
             CheckRefundedCustomerPDT(customerId, e, context);
             context.DeleteObject(e);
             context.SaveChanges();
         }
     }
 }
开发者ID:haithemaraissia,项目名称:SJSchedule,代码行数:21,代码来源:ResponseDelay.aspx.cs

示例10: CustomerWin

 public void CustomerWin(Bid bidder)
 {
     var context = new SidejobEntities();
     var customerwinbid = new CustomerWinBid
     {
         BidID = bidder.BidID,
         CustomerID = bidder.BidderID,
         NumberofBids = GetCustomerNumberofBids(bidder.BidderID)
     };
     context.AddToCustomerWinBids(customerwinbid);
     context.DeleteObject(bidder);
     context.SaveChanges();
 }
开发者ID:haithemaraissia,项目名称:Export,代码行数:13,代码来源:TimeUpBase.cs

示例11: ProWin

 public void ProWin(Bid bidder)
 {
     var context = new SidejobEntities();
     var professionalwinbid = new ProfessionalWinBid
     {
         BidID = bidder.BidID,
         ProID = bidder.BidderID,
         NumberofBids = GetProfessionalNumberofBids(bidder.BidderID)
     };
     context.AddToProfessionalWinBids(professionalwinbid);
     context.DeleteObject(bidder);
     context.SaveChanges();
 }
开发者ID:haithemaraissia,项目名称:Export,代码行数:13,代码来源:TimeUpBase.cs

示例12: PosterResponseDelayUpdate

 public static void PosterResponseDelayUpdate(int projectid)
 {
     using (var context = new SidejobEntities())
     {
         var rd = (from c in context.ResponseDelays
                   where c.ProjectID == projectid
                   select c).FirstOrDefault();
         context.DeleteObject(rd);
     }
 }
开发者ID:haithemaraissia,项目名称:Export,代码行数:10,代码来源:PaymentProcessUpdate.cs

示例13: Process

    private void Process()
    {
        using (var context = new SidejobEntities())
        {

            var newopportunity = (from cp in context.ProjectSecondChances
                                  where cp.ProjectID == ProjectID
                                  select cp);
            if (newopportunity.Count() == 2)
            {

                //Save to ArchivedProjectSecondChance
                SavedToArchivedProjectSecondChance(context, newopportunity);

                //Delete Previous BidderWin and Bids
                DeletePreviousBidderWin(context, ProjectID);

                //Add Current BidderWin
                AddNewBidderWin(context, ProjectID);

                //update project
                Updateproject(context);

                //delete from Response Delay
                DeleteFromResponseDelay(context);

                foreach (ProjectSecondChance o in newopportunity.ToList())
                {
                    context.DeleteObject(o);
                }
            }

            context.SaveChanges();
        }
    }
开发者ID:haithemaraissia,项目名称:SJSchedule,代码行数:35,代码来源:NewProjectBidProcess.cs

示例14: ExtendProject

        private static void ExtendProject(int projectid)
        {
            using (var context = new SidejobEntities())
            {

                //Extend Project ( Make statusInt = 0 and ouput message)

                // Delete the previous bidder in Project
                var newBidProcess = new NewProjectBidProcess(PreviousBidderID, ProjectID);
                newBidProcess.DeleteAllBids(context, ProjectID, PreviousBidderID);

                //Delete From ClosedProject
                var closedproject = (from c in context.ClosedProjects
                                     where c.ProjectID == projectid
                                     select c).FirstOrDefault();
                if (closedproject != null)
                {
                    context.DeleteObject(closedproject);
                }

                //Delete From ResponseDelay
                var rd = (from c in context.ResponseDelays
                          where c.ProjectID == projectid
                          select c).FirstOrDefault();
                if (rd != null)
                {
                    context.DeleteObject(rd);
                    context.SaveChanges();
                }

                //Update Project Requirement End Date to Today + 7 days
                var projectrequirement = (from c in context.ProjectRequirements
                                          where c.ProjectID == projectid
                                          select c).FirstOrDefault();
                if (projectrequirement != null)
                {
                    projectrequirement.DatePosted = DateTime.UtcNow.Date.AddDays(7);
                    context.SaveChanges();
                }

                //Clear Project Winning Bid
                var project = (from c in context.Projects
                               where c.ProjectID == projectid
                               select c).FirstOrDefault();
                if (project == null) return;
                project.StatusInt = 0;
                project.Status = Resources.Resource.OPEN;
                project.HighestBid = null;
                project.HighestBidderID = null;
                project.HighestBidUsername = null;
                project.NumberofBids = 0;
                context.SaveChanges();
            }
        }
开发者ID:haithemaraissia,项目名称:SJSchedule,代码行数:54,代码来源:ProfessionalNewOption.aspx.cs

示例15: ArchiveCancelledProject


//.........这里部分代码省略.........
                        };
                        context.AddToArchievedCancelledProjects(acp);
                    }
                }
            }

            //for each record
            foreach (var cp in currentprojectphoto)
            {
                if ((from c in context.ArchievedCancelledProjectPhotoes
                     where c.PhotoID == cp.PhotoID
                     select c).FirstOrDefault() == null)
                {
                    var ac = new ArchievedCancelledProjectPhoto
                    {
                        PhotoID = cp.PhotoID,
                        ProjectID = cp.ProjectID,
                        PhotoPath = cp.PhotoPath,
                        Caption = cp.Caption,
                        AlbumID = cp.AlbumID,
                        PhotoRank = cp.PhotoRank
                    };
                    context.AddToArchievedCancelledProjectPhotoes(ac);
                }
            }

            if (currentprojectpicture != null)
            {
                if ((from c in context.ArchievedCancelledProjectPictures
                     where c.AlbumID == currentprojectpicture.AlbumID
                     select c).FirstOrDefault() == null)
                {
                    var acpi = new ArchievedCancelledProjectPicture
                    {
                        AlbumID = currentprojectpicture.AlbumID,
                        AlbumCaption = currentprojectpicture.AlbumCaption,
                        Numberofimages = currentprojectpicture.Numberofimages,
                        ProjectID = currentprojectpicture.ProjectID
                    };
                    context.AddToArchievedCancelledProjectPictures(acpi);
                }
            }

            if (currentprojectrequirement != null)
            {
                if ((from c in context.ArchievedCancelledProjectRequirements
                     where c.ProjectID == currentprojectpicture.AlbumID
                     select c).FirstOrDefault() == null)
                {
                    var acpr = new ArchievedCancelledProjectRequirement
                    {
                        ProjectID = currentprojectrequirement.ProjectID,
                        LCID = currentprojectrequirement.LCID,
                        CategoryID = currentprojectrequirement.CategoryID,
                        CategoryName = currentprojectrequirement.CategoryName,
                        JobID = currentprojectrequirement.JobID,
                        JobTitle = currentprojectrequirement.JobTitle,
                        ExperienceID = currentprojectrequirement.ExperienceID,
                        CrewNumberID = currentprojectrequirement.CrewNumberID,
                        LicensedID = currentprojectrequirement.LicensedID,
                        InsuredID = currentprojectrequirement.InsuredID,
                        RelocationID = currentprojectrequirement.RelocationID,
                        ProjectTitle = currentprojectrequirement.ProjectTitle,
                        StartDate = currentprojectrequirement.StartDate,
                        EndDate = currentprojectrequirement.EndDate,
                        AmountOffered = currentprojectrequirement.AmountOffered,
                        CurrencyID = currentprojectrequirement.CurrencyID,
                        Description = currentprojectrequirement.Description,
                        SpecialNotes = currentprojectrequirement.SpecialNotes,
                        Address = currentprojectrequirement.Address,
                        CountryID = currentprojectrequirement.CountryID,
                        CountryName = currentprojectrequirement.CountryName,
                        RegionID = currentprojectrequirement.RegionID,
                        RegionName = currentprojectrequirement.RegionName,
                        CityID = currentprojectrequirement.CityID,
                        CityName = currentprojectrequirement.CityName,
                        Zipcode = currentprojectrequirement.Zipcode,
                        DatePosted = currentprojectrequirement.DatePosted,
                        TimeLeft = currentprojectrequirement.TimeLeft
                    };

                    context.AddToArchievedCancelledProjectRequirements(acpr);
                }
            }
            context.SaveChanges();

            //delete from current project
            if (currentprojectrequirement != null) context.DeleteObject(currentproject);
            if (currentprojectphoto.Count != 0)
            {
                foreach (var cp in currentprojectphoto)
                {
                    context.DeleteObject(cp);
                }

            }
            if (currentprojectpicture != null) context.DeleteObject(currentprojectpicture);
            if (currentprojectrequirement != null) context.DeleteObject(currentprojectrequirement);
            context.SaveChanges();
        }
开发者ID:haithemaraissia,项目名称:SJMain,代码行数:101,代码来源:ProfessionalNewOpportunity.aspx.cs


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