Пример #1
0
 public void ProcessProfessionalPoster(ClosedProject cp)
 {
     if (cp.PosterID != 0)
     {
         InsertEvents(cp.PosterID, PosterLCID, "P");
         InsertMessage(cp.PosterID, PosterUsername, Phasetitle, Postermessage, PosterLCID, "P");
         InsertProfessionalMessageInbox(cp.PosterID, PosterUsername, Phasetitle, Postermessage);
         InsertProfessionalEvent(cp.PosterID);
     }
 }
Пример #2
0
    public void ProcessProjectAction(int projectId, int action, ClosedProject cp)
    {
        /////////////////////The time of the Project is finished/////////////////
        if (action == 0)
        {
            var context = new SidejobEntities();
            var numberofbids = (from c in context.Bids
                                where c.ProjectID == projectId
                                select c).Count();
            if (numberofbids == 0)
            {
                Postermessage = Resources.Resource.ProjectExpiration + " " + projectId
                    + Resources.Resource.zerobids + Resources.Resource.ProjectExtention;
                //  No One had any bids on the project
                Phasetitle = Resources.Resource.ProjectExpirationPhase;
                //  No One had any bids on the project
            }
            else
            {
                //There is Bids on the project
                Postermessage = Resources.Resource.PosterProjectCongratulation + " " + projectId;
                Postermessage += Resources.Resource.PosterProjectBidReach;

                if (cp.CurrencyID != null)
                    Postermessage += "<b>" + cp.HighestBid +
                    ScheduleMySide.Helpers.Utility.GetCurrencyCode((int)cp.CurrencyID) + "</b>";
                Postermessage += Resources.Resource.TeamContactBidder;

                Biddermessage = Resources.Resource.BidderCongratulation;
                if (cp.CurrencyID != null)
                    Biddermessage += "<b>" + cp.HighestBid + ScheduleMySide.Helpers.Utility.GetCurrencyCode((int)cp.CurrencyID) + "</b>";
                Biddermessage += Resources.Resource.ForProject + " " + projectId;
                Biddermessage += Resources.Resource.BidderRequestPayment;

                Phasetitle = Resources.Resource.BidWonPhase;

                switch (action)
                {
                    case 0:
                        //  ---------------------------------Action 0:--------------------------------------
                        //------------------------The time of the Project is finished---------------------

                        if (cp.PosterRole == "CUS")
                        {
                            CustomerPayment(cp);
                        }
                        if (cp.PosterRole == "PRO")
                        {
                            ProfessionalPayment(cp);
                        }
                        break;

                    case 2:
                        // ---------------------------------Action 2:--------------------------------------
                        //----------------------------Bidder Pay Fees-------------------------------------
                        BidderPayFees(cp);
                        break;
                    case 4:
                        // ---------------------------------Action 4:--------------------------------------
                        //----------------------------Poster Pay Fees-------------------------------------
                        PosterPayFees(projectId, cp);
                        GenerateContract(cp);
                        break;
                }

                if (action == 0 || action == 2 || action == 4)
                {
                    ProcessAction(cp);
                    AutomatedMessage();
                }

                //There is Bids on the project
            }
        }
        /////////////////////The time of the Project is finished/////////////////
    }
Пример #3
0
    public static void BidderPosterContract(ClosedProject cp, SidejobEntities context)
    {
        ProfessionalGeneral professional;
        if (cp.PosterRole == "CUS" & cp.BidderRole == "PRO")
        {
            var customer = (from c in context.CustomerGenerals
                                        where c.CustomerID == cp.PosterID
                                        select c).FirstOrDefault();
            professional = (from c in context.ProfessionalGenerals
                            where c.ProID == cp.BidderID
                            select c).FirstOrDefault();
            CustomerContract(customer, professional, cp);
            ProfessionalContract(customer, professional, cp);
            Contract(customer, professional, cp);
        }

        if (cp.PosterRole == "PRO" & cp.BidderRole == "PRO")
        {
            var professionalbidder = (from c in context.ProfessionalGenerals
                                      where c.ProID == cp.BidderID
                                      select c).FirstOrDefault();
            professional = (from c in context.ProfessionalGenerals
                            where c.ProID == cp.PosterID
                            select c).FirstOrDefault();
            //both contract to Professionals
            ProfessionalContract(professional, professionalbidder, cp);
            Contract(professional, professionalbidder, cp);
        }
    }
Пример #4
0
 public void ProcessProfessionalBidder(ClosedProject cp)
 {
     if (cp.BidderID != null)
     {
         InsertEvents((int)cp.BidderID, BidderLCID, "P");
         InsertMessage((int)cp.BidderID, BidderUsername, Phasetitle, Biddermessage, BidderLCID, "P");
         InsertProfessionalMessageInbox((int)cp.BidderID, BidderUsername, Phasetitle, Biddermessage);
         InsertProfessionalEvent((int)cp.BidderID);
     }
 }
Пример #5
0
    public void BidderPayFees(ClosedProject cp)
    {
        //        ----------------------------Bidder Pay Fees-------------------------------------

        var context = new SidejobEntities();
        cp.Status = 4;
        context.SaveChanges();

        Postermessage = Resources.Resource.PosterBidCongratulation;

        if (cp.CurrencyID != null)
            Postermessage += "<b>" + cp.HighestBid + ScheduleMySide.Helpers.Utility.GetCurrencyCode((int)cp.CurrencyID) + "</b>";
        Postermessage += Resources.Resource.PosterRequestPayment;

        Biddermessage = Resources.Resource.BidderPaymentConfirmation;

        Phasetitle = Resources.Resource.BidConfirmationPhase;

        //---------------------------------Action 2:--------------------------------------
    }
Пример #6
0
    public void GenerateContract(ClosedProject cp)
    {
        //   ProjectRequirement projectrequirement;
        //Project Requirement:

        using (var context = new SidejobEntities())
        {
            //projectrequirement = (from c in context.ProjectRequirements
            //                         where c.ProjectID == cp.PosterID
            //                         select c).FirstOrDefault();

            CustomerGeneral customer;
            ProfessionalGeneral professional;
            if (cp.BidderRole == "CUS")
            {
                customer = (from c in context.CustomerGenerals
                            where c.CustomerID == cp.BidderID
                            select c).FirstOrDefault();
                professional = (from c in context.ProfessionalGenerals
                                where c.ProID == cp.PosterID
                                select c).FirstOrDefault();
                CustomerContract(customer, professional, cp);
            }
            ProfessionalGeneral professionalbidder;
            if (cp.BidderRole == "PRO")
            {
                professionalbidder = (from c in context.ProfessionalGenerals
                                      where c.ProID == cp.BidderID
                                      select c).FirstOrDefault();
                professional = (from c in context.ProfessionalGenerals
                                where c.ProID == cp.PosterID
                                select c).FirstOrDefault();
                ProfessionalContract(professional, professionalbidder, cp);
            }

            CustomerGeneral customerposter;
            if (cp.PosterRole == "CUS")
            {
                customer = (from c in context.CustomerGenerals
                            where c.CustomerID == cp.BidderID
                            select c).FirstOrDefault();
                customerposter = (from c in context.CustomerGenerals
                                  where c.CustomerID == cp.PosterID
                                  select c).FirstOrDefault();
                CustomerContract(customer, customerposter, cp);
            }
            if (cp.PosterRole == "PRO")
            {
                customer = (from c in context.CustomerGenerals
                            where c.CustomerID == cp.BidderID
                            select c).FirstOrDefault();
                professional = (from c in context.ProfessionalGenerals
                                where c.ProID == cp.PosterID
                                select c).FirstOrDefault();
                ProfessionalContract(customer, professional, cp);
            }

            //INSERT INTO CONTRACT
            if ((cp.BidderRole != null && cp.BidderRole == "CUS") && (cp.PosterRole != null && cp.PosterRole == "PRO"))
            {
                customer = (from c in context.CustomerGenerals
                            where c.CustomerID == cp.BidderID
                            select c).FirstOrDefault();
                professional = (from c in context.ProfessionalGenerals
                                where c.ProID == cp.PosterID
                                select c).FirstOrDefault();
                Contract(customer, professional, cp);
            }
            if ((cp.BidderRole != null && cp.BidderRole == "CUS") && (cp.PosterRole != null && cp.PosterRole == "CUS"))
            {
                customer = (from c in context.CustomerGenerals
                            where c.CustomerID == cp.BidderID
                            select c).FirstOrDefault();
                customerposter = (from c in context.CustomerGenerals
                                  where c.CustomerID == cp.PosterID
                                  select c).FirstOrDefault();
                Contract(customer, customerposter, cp);
            }
            if ((cp.BidderRole != null && cp.BidderRole == "PRO") && (cp.PosterRole != null && cp.PosterRole == "CUS"))
            {
                professionalbidder = (from c in context.ProfessionalGenerals
                                      where c.ProID == cp.BidderID
                                      select c).FirstOrDefault();
                customerposter = (from c in context.CustomerGenerals
                                  where c.CustomerID == cp.PosterID
                                  select c).FirstOrDefault();
                Contract(professionalbidder, customerposter, cp);
            }
            if ((cp.BidderRole != null && cp.BidderRole == "PRO") && (cp.PosterRole != null && cp.PosterRole == "PRO"))
            {
                professionalbidder = (from c in context.ProfessionalGenerals
                                      where c.ProID == cp.BidderID
                                      select c).FirstOrDefault();
                professional = (from c in context.ProfessionalGenerals
                                where c.ProID == cp.PosterID
                                select c).FirstOrDefault();
                Contract(professionalbidder, professional, cp);
            }
        }
    }
Пример #7
0
 public TimeUp(int projectId, int action, ClosedProject cp)
 {
     ProcessProjectAction(projectId, action, cp);
 }
Пример #8
0
 public static void CustomerContract(CustomerGeneral customer, CustomerGeneral customerposter, ClosedProject cp)
 {
     if (customer == null) return;
     if (cp.HighestBid == null) return;
     var context = new SidejobEntities();
     if (cp.CurrencyID == null) return;
     var customercontract = new CustomerContract
     {
         ContractID = GetNextContractID(),
         BidderID = customer.CustomerID,
         BidderFirstName = customer.FirstName,
         BidderLastName = customer.LastName,
         BidderUsername = customer.UserName,
         ContractDate = DateTime.Now,
         ProjectID = cp.ProjectID,
         CurrencyID = (int)cp.CurrencyID,
         CustomerID = customer.CustomerID,
         HighestBid = (double)cp.HighestBid,
         PosterID = customerposter.CustomerID,
         PosterUsername = customerposter.UserName,
         PosterFirstName = customerposter.FirstName,
         PosterLastName = customerposter.LastName
     };
     context.AddToCustomerContracts(customercontract);
 }
Пример #9
0
 public void GenerateContract(ClosedProject cp)
 {
     using (var context = new SidejobEntities())
     {
         BidderPosterContract(cp, context);
     }
 }
Пример #10
0
    public void UpdateResponseDelay(int action, ClosedProject cp, SidejobEntities context)
    {
        if (action == 0) return;
        switch (action)
        {
            case 1:
                var rd = new ResponseDelay
                             {
                                 BidderID = BidderID,
                                 CurrencyID = cp.CurrencyID,
                                 BidderRole = BidderRole,
                                 DateFinished = DateTime.UtcNow.Date,
                                 HighestBid = cp.HighestBid,
                                 PosterID = PosterID,
                                 ReminderLevel = 1,
                                 Status = 3
                             };
                context.AddToResponseDelays(rd);
                context.SaveChanges();
                break;

            case 2:
                var rd2 = (from c in context.ResponseDelays
                           where c.BidderID == BidderID
                                 && c.PosterID == PosterID && c.Status == 3
                           select c).FirstOrDefault();
                if (rd2 != null)
                {
                    rd2.Status = 4;
                    context.SaveChanges();
                }
                break;

            case 3:
                ArchiveProject(context);
                var rd3 = (from c in context.ResponseDelays
                           where c.BidderID == BidderID
                                 && c.PosterID == PosterID
                           select c).FirstOrDefault();
                if (rd3 != null)
                {
                    context.DeleteObject(rd3);
                    context.DeleteObject(cp);
                    var p = (from c in context.Projects
                             where c.ProjectID == ProjectID
                             select c).FirstOrDefault();
                    if (p != null)
                    {
                        p.StatusInt = 6;
                        context.SaveChanges();
                    }

                }
                break;
        }
    }
Пример #11
0
    public void CustomerPayment(ClosedProject cp, string role)
    {
        var phase = "";
        int payerId = 0;
        if(role == "Poster")
        {
            payerId = PosterID;
            phase = Resources.Resource.Phase2;
        }
        if(role == "Bidder")
        {
            payerId = BidderID;
            phase = Resources.Resource.Phase1;
        }
        if (cp.HighestBid != null)
        {
            var projectPaymentDue = Math.Round((double)(GetPercentage((double)cp.HighestBid) * cp.HighestBid), 2);
            var phasemessage = "<b><font color='red'>" + phase+ ":</font></b><br>" +
                               Resources.Resource.Project + " = "
                               + cp.ProjectID + "<br/>" + Resources.Resource.PaymentDue + " = " + projectPaymentDue;

            var context = new SidejobEntities();
            if (cp.BidderID != null)
            {
                if (cp.CurrencyID != null)
                {
                    var customerpaymentdue = new CustomerPaymentDue
                                                 {
                                                     CustomerID = payerId,
                                                     ProjectID = cp.ProjectID,
                                                     ProjectAmount = (double)cp.HighestBid,
                                                     Date = DateTime.UtcNow.Date,
                                                     CurrencyCode = ScheduleUtility.GetCurrencyCode((int)cp.CurrencyID),
                                                     PaymentDue = projectPaymentDue,
                                                     PhaseStatus = phasemessage,
                                                     PaymentProcess = false
                                                 };
                    context.AddToCustomerPaymentDues(customerpaymentdue);
                }
                context.SaveChanges();
            }
        }
    }
Пример #12
0
    /////////////////////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);
                }
            }
        }
    }
Пример #13
0
 public TimeUp(int projectId, int action, ClosedProject cp)
 {
     //ProcessProjectAction(projectId, action, cp);
     GetBidderPosterProjectProperties(projectId, action, cp);
 }
Пример #14
0
    public void ProfessionalPayment(ClosedProject cp)
    {
        if (cp.Status == 3)
        {
            ProcessProfessionalPayment(Resources.Resource.Phase1, cp);
        }

        //IF @ProjectStatus = 4
        //--Another Professional was the Poster--
        //--The current Professional is the Bidder

        if (cp.Status == 4)
        {
            ProcessProfessionalPayment(Resources.Resource.Phase2, cp);
        }
    }
Пример #15
0
    public void PosterPayFees(int projectId, ClosedProject cp)
    {
        //        ---------------------------------Action 4:--------------------------------------
        //----------------------------Poster Pay Fees-------------------------------------
        var context = new SidejobEntities();
        cp.Status = 4;
        context.SaveChanges();

        Postermessage = Resources.Resource.PosterProjectCongratulation;
        Postermessage += Resources.Resource.ForProject + " " + projectId;
        Postermessage += Resources.Resource.WithTheBidOf;

        if (cp.CurrencyID != null)
            Postermessage += "<b>" + cp.HighestBid + ScheduleMySide.Helpers.Utility.GetCurrencyCode((int)cp.CurrencyID) + "</b>";
        Postermessage += Resources.Resource.PosterPrintContract;

        Biddermessage = Resources.Resource.BidderProjectBidReach;
        Biddermessage += Resources.Resource.ForProject + " " + projectId;
        Biddermessage += Resources.Resource.WithTheBidOf;
        Biddermessage += Resources.Resource.BidderCongratulation;

        if (cp.CurrencyID != null)
            Biddermessage += "<b>" + cp.HighestBid + ScheduleMySide.Helpers.Utility.GetCurrencyCode((int)cp.CurrencyID) + "</b>";
        Biddermessage += Resources.Resource.BidderPrintContract;
        Phasetitle = Resources.Resource.ProjectContractPhase;

        //---------------------------------Action 4:--------------------------------------
        //----------------------------Poster Pay Fees-------------------------------------
    }
Пример #16
0
    public static void Contract(ProfessionalGeneral professionalbidder, CustomerGeneral customerposter, ClosedProject cp)
    {
        var context = new SidejobEntities();
        var project = (from c in context.ProjectRequirements
                       where c.ProjectID == cp.ProjectID
                       select c).FirstOrDefault();

        if (project != null)
        {
            var contract = new Contract
            {
                ContractID = GetNextContractID(),
                ProjectID = cp.ProjectID,
                ContractDate = DateTime.Now.Date,
                BidderID = customerposter.CustomerID,
                BidderRole = "CUS",
                BidderUsername = customerposter.UserName,
                BidderFirstName = customerposter.FirstName,
                BidderLastName = customerposter.LastName,
                BidderAddress = customerposter.Address,
                BidderCountryID = customerposter.CountryID,
                BidderCountryName = customerposter.CountryName,
                BidderRegionID = customerposter.RegionID,
                BidderRegionName = customerposter.RegionName,
                BidderHomePhoneNumber = customerposter.HomePhoneNumber,
                PosterID = professionalbidder.ProID,
                PosterRole = "PRO",
                PosterUsername = professionalbidder.UserName,
                PosterFirstName = professionalbidder.FirstName,
                PosterLastName = professionalbidder.LastName,
                PosterAddress = professionalbidder.Address,
                PosterCountryID = professionalbidder.CountryID,
                PosterCountryName = professionalbidder.CountryName,
                PosterRegionID = professionalbidder.RegionID,
                PosterRegionName = professionalbidder.RegionName,
                PosterZipcode = professionalbidder.Zipcode,
                LCID = project.LCID,
                ProjectCategoryID = project.CategoryID,
                ProjectCategoryName = project.CategoryName,
                ProjectJobID = project.JobID,
                ProjectExperienceID = project.ExperienceID,
                ProjectCrewNumberID = project.CrewNumberID,
                ProjectLicensedID = project.LicensedID,
                ProjectInsuredID = project.InsuredID,
                ProjectRelocationID = project.RelocationID,
                ProjectStartDate = project.StartDate,
                ProjectEndDate = project.EndDate,
                ProjectAddress = project.Address,
                ProjectCountryID = project.CountryID,
                ProjectCountryName = project.CountryName,
                ProjectRegionID = project.RegionID,
                ProjectRegionName = project.RegionName,
            };
            context.AddToContracts(contract);
        }
    }
Пример #17
0
 public void ProcessAction(ClosedProject cp)
 {
     if (cp.BidderRole == "CUS")
     {
         ProcessCustomerBidder(cp);
     }
     if (cp.BidderRole == "PRO")
     {
         ProcessProfessionalBidder(cp);
     }
     if (cp.PosterRole == "CUS")
     {
         ProcessCustomerPoster(cp);
     }
     if (cp.PosterRole == "PRO")
     {
         ProcessProfessionalPoster(cp);
     }
 }
Пример #18
0
 public static void ProfessionalContract(ProfessionalGeneral professionalposter, ProfessionalGeneral professionalbidder, ClosedProject cp)
 {
     if (professionalbidder == null) return;
     if (cp.HighestBid == null) return;
     var context = new SidejobEntities();
     if (cp.CurrencyID == null) return;
     var professionalcontract = new ProfessionalContract
     {
         BidderID = professionalbidder.ProID,
         BidderFirstName = professionalbidder.FirstName,
         BidderLastName = professionalbidder.LastName,
         BidderUsername = professionalbidder.UserName,
         ContractDate = DateTime.Now,
         ProjectID = cp.ProjectID,
         ContractID = GetNextContractID(),
         CurrencyID = (int)cp.CurrencyID,
         HighestBid = (double)cp.HighestBid,
         PosterID = professionalposter.ProID,
         PosterUsername = professionalposter.UserName,
         PosterFirstName = professionalposter.FirstName,
         PosterLastName = professionalposter.LastName
     };
     context.AddToProfessionalContracts(professionalcontract);
 }
Пример #19
0
 public void ProcessCustomerBidder(ClosedProject cp)
 {
     if (cp.BidderID != null)
     {
         InsertEvents((int)cp.BidderID, BidderLCID, "C");
         InsertMessage((int)cp.BidderID, BidderUsername, Phasetitle, Biddermessage, BidderLCID, "C");
         InsertCustomerMessageInbox((int)cp.BidderID, BidderUsername, Phasetitle, Biddermessage);
         InsertCustomerEvent((int)cp.BidderID);
     }
 }
Пример #20
0
    public void CustomerPayment(ClosedProject cp)
    {
        if (cp.HighestBid != null)
        {
            var projectPaymentDue = Math.Round((double)(GetPercentage((double)cp.HighestBid) * cp.HighestBid), 2);
            var phasemessage = "<b><font color='red'>" + Resources.Resource.Phase2 + ":</font></b><br>'" +
                               Resources.Resource.Project + " = "
                               + cp.HighestBid + "<br/>" + Resources.Resource.Fees + " = " + projectPaymentDue;

            var context = new SidejobEntities();
            if (cp.BidderID != null)
            {
                if (cp.CurrencyID != null)
                {
                    var customerpaymentdue = new CustomerPaymentDue
                    {
                        CustomerID = (int)cp.BidderID,
                        ProjectID = cp.ProjectID,
                        ProjectAmount = (double)cp.HighestBid,
                        Date = DateTime.Now.Date,
                        CurrencyCode = ScheduleMySide.Helpers.Utility.GetCurrencyCode((int)cp.CurrencyID),
                        PaymentDue = projectPaymentDue,
                        PhaseStatus = phasemessage
                    };
                    context.AddToCustomerPaymentDues(customerpaymentdue);
                }
                context.SaveChanges();
            }
        }
    }
Пример #21
0
 public void ProcessCustomerPoster(ClosedProject cp)
 {
     if (cp.PosterID != 0)
     {
         InsertEvents(cp.PosterID, BidderLCID, "C");
         InsertMessage(cp.PosterID, BidderUsername, Phasetitle, Biddermessage, BidderLCID, "C");
         InsertCustomerMessageInbox(cp.PosterID, BidderUsername, Phasetitle, Biddermessage);
         InsertCustomerEvent(cp.PosterID);
     }
 }
Пример #22
0
    public void GetBidderPosterProjectProperties(int projectId, int action, ClosedProject cp)
    {
        if (cp.BidderID != null) BidderID = (int)cp.BidderID;
        PosterID = cp.PosterID;
        ProjectID = cp.ProjectID;
        ////////////////////////POSTER BIDDER PROJECT LCID//////////////////////////
        using (var context = new SidejobEntities())
        {
            if (cp.BidderRole == "CUS")
            {
                BidderRole = "CUS";
                var c1 = (from c in context.Customers
                          where c.CustomerID == (int)cp.BidderID
                          select c).FirstOrDefault();
                if (c1 != null)
                {
                    BidderLCID = c1.LCID;
                    BidderUsername = c1.UserName;
                    var cg = (from c in context.CustomerGenerals
                              where c.CustomerID == (int)cp.BidderID
                              select c).FirstOrDefault();
                    if (cg != null)
                    {
                        BidderEmailAddress = cg.EmailAddress;
                    }
                }
            }

            if (cp.BidderRole == "PRO")
            {
                BidderRole = "PRO";
                var c1 = (from c in context.Professionals
                          where c.ProID == (int)cp.BidderID
                          select c).FirstOrDefault();
                if (c1 != null)
                {
                    BidderLCID = c1.LCID;
                    BidderUsername = c1.UserName;
                    var pg = (from c in context.ProfessionalGenerals
                              where c.ProID == (int)cp.BidderID
                              select c).FirstOrDefault();
                    if (pg != null)
                    {
                        BidderEmailAddress = pg.EmailAddress;
                    }
                }
            }

            if (cp.PosterRole == "CUS")
            {
                PosterRole = "CUS";
                var c1 = (from c in context.Customers
                          where c.CustomerID == PosterID
                          select c).FirstOrDefault();
                if (c1 != null)
                {
                    PosterLCID = c1.LCID;
                    PosterUsername = c1.UserName;
                    var cg = (from c in context.CustomerGenerals
                              where c.CustomerID == (int)cp.BidderID
                              select c).FirstOrDefault();
                    if (cg != null)
                    {
                        PosterEmailAddress = cg.EmailAddress;
                    }
                }
            }

            if (cp.PosterRole == "PRO")
            {
                PosterRole = "PRO";
                var c1 = (from c in context.Professionals
                          where c.ProID == PosterID
                          select c).FirstOrDefault();
                if (c1 != null)
                {
                    PosterLCID = c1.LCID;
                    PosterUsername = c1.UserName;
                    var pg = (from c in context.ProfessionalGenerals
                              where c.ProID == (int)cp.BidderID
                              select c).FirstOrDefault();
                    if (pg != null)
                    {
                        BidderEmailAddress = pg.EmailAddress;
                    }
                }
            }

            var p1 = (from c in context.ProjectRequirements
                      where c.ProjectID == ProjectID
                      select c).FirstOrDefault();
            if (p1 != null) ProjectLCID = p1.LCID;
        }
        ////////////////////////POSTER BIDDER PROJECT LCID//////////////////////////

        ProcessProjectAction(projectId, action, cp);
    }
Пример #23
0
    /////////////////////ADD TO CLOSED PROJECT/////////////////////////
    /////////////////////ADD TO RESPONSE DELAY/////////////////////////
    public void AddToResponseDelay(int projectId, ClosedProject cp)
    {
        //Added the new record with status = 3
        //because the first time it will be for bidder

        //Check if exist already in the tables
        using (var context = new SidejobEntities())
        {
            var rd = (from c in context.ResponseDelays
                      where c.ProjectID == projectId
                      select c).FirstOrDefault();
            if (rd == null)
            {
                var newResponseDelay = new  SidejobModel.ResponseDelay
                                           {
                                               ProjectID = projectId,
                                               DateFinished = DateTime.Now.Date,
                                               PosterID = cp.PosterID,
                                               PosterRole = cp.PosterRole,
                                               BidderID = cp.BidderID,
                                               BidderRole = cp.BidderRole,
                                               HighestBid = cp.HighestBid,
                                               CurrencyID = cp.CurrencyID,
                                               Status = 3
                                           };
                context.AddToResponseDelays(newResponseDelay);
                context.SaveChanges();
            }
        }
    }