public IEnumerable BindSpecialityList(string lcid, string jobcategory)
        {
            try
            {
                using (var context = new SidejobEntities())
                {
                    switch (Convert.ToInt32(lcid))
                    {
                        case 1:
                            return (from c in context.Jobs
                                    where c.JobCategory == jobcategory && c.JobRank >= 1 && c.JobRank <= 13
                                    select c).ToList();
                        case 2:
                            return (from c in context.JobsFrs
                                    where c.JobCategory == jobcategory && c.JobRank >= 1 && c.JobRank <= 13
                                    select c).ToList();

                        default:
                            return (from c in context.Jobs
                                    where c.JobCategory == jobcategory && c.JobRank >= 1 && c.JobRank <= 13
                                    select c).ToList();
                    }
                }
            }
            catch (Exception)
            {
                using (var context = new SidejobEntities())
                {
                    return (from c in context.Jobs
                            where c.JobCategory == jobcategory && c.JobRank >= 1 && c.JobRank <= 13
                            select c).ToList();
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        using (var context = new SidejobEntities())
        {
            try
            {
                var CustomerContractID = 1;
                var customerID = 165;

                var customerContract = (from c in context.CustomerContracts
                                        where c.ContractID == CustomerContractID
                                        select c).FirstOrDefault();

                var projectrequirement = (from pr in context.ProjectRequirements
                                          where pr.ProjectID == customerContract.ProjectID
                                          select pr).FirstOrDefault();

                //LCID

                // Description have to be invoked by google translate

                //Only 5 photos max might be
                var s = from ph in context.ProjectPhotoes
                        where ph.ProjectID == customerContract.ProjectID
                        select ph;

                //var projectphoto = ( from ph in context.projects)
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
Ejemplo n.º 3
0
    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.Title, m.MessageID.ToString(CultureInfo.InvariantCulture));
                   // context.DeleteObject(m);
                    context.SaveChanges();
                }
                catch (Exception)
                {
                    CatchMessage(context, m);
                }
            }
        }
    }
Ejemplo n.º 4
0
    public void DeletePreviousBidderWin(SidejobEntities context, int projectId)
    {
        var previous = (from c in context.ClosedProjects
                        where c.ProjectID == projectId
                        select c.BidderID).FirstOrDefault();

        if (previous != null)
        {
            var bids = (from c in context.Bids
                        where c.ProjectID == projectId && c.BidderID == previous
                        orderby c.AmountOffered descending
                        select c).FirstOrDefault();

            if (bids != null)
            {
                int previousbidid = bids.BidID;
                context.DeleteObject(bids);
                var previouswinnerbid = (from c in context.ProfessionalWinBids
                                        where c.ProID == previous
                                        && c.BidID == previousbidid
                                        select c).FirstOrDefault();;
                if (previouswinnerbid != null)
                {
                     context.DeleteObject(previouswinnerbid);
                }

            }

            context.SaveChanges();
        }
    }
Ejemplo n.º 5
0
 protected void MessageProperties()
 {
     //GET THE PDTID FORM ARCHIVE REFUND
     const string singlespace = " ";
     const string startofBoldRed = "<span class='DarkRed'><strong>";
     const string lastofBoldRed = "</strong></span>";
     PDTID = Convert.ToInt32(Request.QueryString["pdtid"]);
     ProjectID = Convert.ToInt32(Request.QueryString["prid"]);
     CustomerID = Convert.ToInt32(Request.QueryString["cid"]);
     if (ProjectID == 0) return;
     ProjectNotification.Text = Resources.Resource.Project + singlespace + ProjectID + singlespace +
                                Resources.Resource.Notification;
     ConfirmationEmail.Text = Resources.Resource.RefundEmailMessage1 + singlespace
                                    + startofBoldRed + ProjectID + lastofBoldRed + singlespace +
                                    Resources.Resource.RefundEmailMessage2;
     using (var context = new SidejobEntities())
     {
         var archiveRefund = (from c in context.ArchivedRefundCustomerSuccessfulPDTs
                              where c.PDTID == PDTID
                              select c).FirstOrDefault();
         if (archiveRefund == null) return;
         Amount.Text = archiveRefund.GrossTotal.ToString(CultureInfo.InvariantCulture) +
                       singlespace + archiveRefund.CurrencyCode.ToString(CultureInfo.InvariantCulture) + singlespace;
         Transaction.Text = archiveRefund.TransactionId;
         NameLabel.Text = archiveRefund.FirstName + singlespace + archiveRefund.LastName;
     }
 }
Ejemplo n.º 6
0
 public void ProjectPhoto(TopProject[] results)
 {
     using (var context = new SidejobEntities())
     {
         for (var i = 0; i < 3; i++)
         {
             int projectID = results[i].ProjectID;
             var minimunPhotoRank = from ph in context.ProjectPhotoes
                                    where ph.PhotoRank != -1 && ph.ProjectID == projectID
                                    orderby ph.PhotoRank descending
                                    select ph;
             var photopath = from ph in context.ProjectPhotoes
                             where ph.PhotoRank == -1 && ph.ProjectID == projectID
                             select ph;
             if (minimunPhotoRank.Any())
             {
                 int rank = int.Parse(minimunPhotoRank.First().PhotoRank.ToString(CultureInfo.InvariantCulture));
                 photopath = from ph in context.ProjectPhotoes
                             where ph.PhotoRank == rank && ph.ProjectID == projectID
                             select ph;
             }
             var firstOrDefault = photopath.FirstOrDefault();
             if (firstOrDefault != null)
                 results[i].SetPath(firstOrDefault.PhotoPath.ToString(CultureInfo.InvariantCulture));
             else
             {
                 const string projectMissingPrimaryPicture = "http://www.haithem-araissia.com/WIP2/RightCleanSideJOB2008FromInetpub/CleanSIDEJOB2008/Images/NoWorkShopImage.jpg";
                 results[i].SetPath(projectMissingPrimaryPicture);
             }
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        using (var context = new SidejobEntities())
        {
            var projects = (from pr in context.ClosedProjects
                            select pr).ToList();

            foreach (var p in projects)
            {
                var p1 = p;
                var newopportunity = (from cp in context.ProjectSecondChances
                                      where p1 != null && cp.ProjectID == p1.ProjectID
                                      select cp);
                if (newopportunity.Count() == 2)
                {
                    ProjectID = p.ProjectID;

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

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

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

                    //update project
                    Updateproject(context);

                }
            }
        }
    }
        public IEnumerable BindIndusty(string lcid)
        {
            try
            {
                using (var context = new SidejobEntities())
                {
                    switch (Convert.ToInt32(lcid))
                    {
                        case 1:
                            return (from c in context.Categories
                                    select c).ToList();

                        case 2:
                            return (from c in context.CategoriesFrs
                                    select c).ToList();

                        default:
                            return (from c in context.Categories
                                    select c).ToList();

                    }
                }
            }
            catch (Exception)
            {
                using (var context = new SidejobEntities())
                {
                    return (from c in context.Categories
                            select c).ToList();
                }
            }
        }
Ejemplo n.º 9
0
 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();
     }
 }
Ejemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (var context = new SidejobEntities())
               {
                   ProjectID = 20;
                   CleanUpProjectReferences(context);
               }
 }
 public CustomerGeneral GetCustomer()
 {
     using (var context = new SidejobEntities())
     {
         return (from c in context.CustomerGenerals
                 where c.CustomerID == CustomerID
                 select c).FirstOrDefault();
     }
 }
 public Professional GetProfessional()
 {
     using (var context = new SidejobEntities())
     {
         return (Professional)(from c in context.ProfessionalGeneral2
                               where c.ProID == NewProID
                               select c);
     }
 }
Ejemplo n.º 13
0
 //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();
     }
 }
 public ProfessionalGeneral2 GetProfessional()
 {
     using (var context = new SidejobEntities())
     {
         return (from c in context.ProfessionalGeneral2
                 where c.ProID == ProfessionalID
                 select c).FirstOrDefault();
     }
 }
 public CustomerGeneral2 GetCustomer(int customerid)
 {
     using (var context = new SidejobEntities())
     {
         return (from c in context.CustomerGeneral2
                 where c.CustomerID == customerid
                 select c).FirstOrDefault();
     }
 }
 public static string GetExperience(int experienceID, int lcid)
 {
     using (var context = new SidejobEntities())
     {
         var result = from c in context.Experiences
                      where c.ExperienceID == experienceID && c.LCID == lcid
                      select c.ExperienceValue;
         return result.FirstOrDefault();
     }
 }
 public static string GetCurrency(int currencyID)
 {
     using (var context = new SidejobEntities())
     {
         var result = from c in context.Currencies
                      where c.CurrencyID == currencyID
                      select c.CurrencyValue;
         return result.FirstOrDefault();
     }
 }
 public static string GetRelocation(int relocationID, int lcid)
 {
     using (var context = new SidejobEntities())
     {
         var result = from c in context.Relocations
                      where c.RelocationID == relocationID && c.LCID == lcid
                      select c.RelocationValue;
         return result.FirstOrDefault();
     }
 }
Ejemplo n.º 19
0
 public static string GetFlagPath(int countryID)
 {
     using (var context = new SidejobEntities())
     {
         var result = from c in context.CountriesUpdates
                      where c.CountryId == countryID
                      select c.Path;
         return result.FirstOrDefault();
     }
 }
 public static string GetLicensed(int licensedID, int lcid)
 {
     using (var context = new SidejobEntities())
     {
         var result = from c in context.Licenseds
                      where c.LicensedID == licensedID && c.LCID == lcid
                      select c.LicensedValue;
         return result.FirstOrDefault();
     }
 }
 public static string GetCrewnumber(int crewnumberID, int lcid)
 {
     using (var context = new SidejobEntities())
     {
         var result = from c in context.CrewNumbers
                      where c.crewnumberID == crewnumberID && c.LCID == lcid
                      select c.crewnumberValue;
         return result.FirstOrDefault();
     }
 }
Ejemplo n.º 22
0
    protected void GetTopProject()
    {
        var results = new TopProject[3];
        using (var context = new SidejobEntities())
        {
            var currenttimequery = from pr in context.ProjectRequirements
                                   join p in context.Projects
                                       on pr.ProjectID equals p.ProjectID
                                   where (p.StatusInt == 0) && (pr.EndDate >= DateTime.Now)
                                   orderby p.ProjectID descending
                                   select new { p.ProjectID, ProjectTitle = pr.ProjectTitle.Substring(0, 6) };

            if (currenttimequery.Count() > 3)
            {
                var checkcurrentimequery = currenttimequery.ToList();
                var queryresults = checkcurrentimequery.Take(3).ToList();
                for (var i = 0; i < results.Length; ++i)
                    results[i] = new TopProject(int.Parse(queryresults[i].ProjectID.ToString(CultureInfo.InvariantCulture)), queryresults[i].ProjectTitle, "");
            }
            else
            {
                var notimequery = from pr in context.ProjectRequirements
                                  join p in context.Projects
                                      on pr.ProjectID equals p.ProjectID
                                  where (p.StatusInt == 0)
                                  orderby p.ProjectID descending
                                  select new { p.ProjectID, pr.ProjectTitle };

                if (notimequery.Count() > 3)
                {
                    var checknotimequery = notimequery.ToList();
                    var queryresults = checknotimequery.Take(3).ToList();
                    for (var i = 0; i < results.Length; ++i)
                        results[i] = new TopProject(int.Parse(queryresults[i].ProjectID.ToString(CultureInfo.InvariantCulture)), queryresults[i].ProjectTitle, "");
                }
                else
                {
                    var allprojects = from pr in context.ProjectRequirements
                                      join p in context.Projects
                                          on pr.ProjectID equals p.ProjectID
                                      orderby p.ProjectID descending
                                      select new { p.ProjectID, pr.ProjectTitle };
                    var allprojectquery = allprojects.ToList();
                    var queryresults = allprojectquery.Take(3).ToList();
                    for (var i = 0; i < results.Length; ++i)
                        results[i] = new TopProject(int.Parse(queryresults[i].ProjectID.ToString(CultureInfo.InvariantCulture)), queryresults[i].ProjectTitle, "");
                }
            }

            ProjectPhoto(results);
            //TopProjectDataList.DataSource = results;
            //TopProjectDataList.DataBind();
        }
    }
    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();
        }
    }
 public void AddNewBidderWin(SidejobEntities context, int projectId)
 {
     var newBid = GetCurrentNewBid(projectId, NewProID);
     var newwin = new ProfessionalWinBid
                      {
                          BidID = newBid.BidID,
                          ProID = NewProID,
                          NumberofBids = GetNumberofBids(context)
                      };
     context.AddToProfessionalWinBids(newwin);
     context.SaveChanges();
 }
Ejemplo n.º 25
0
        protected void CustomerPage()
        {
            ///////////////CLEAN THIS MORE///////////////

            //Example:
            //Authenticated
            //Customer Profile

            using (var context = new SidejobEntities())
            {
                var customer = (from c in context.CustomerGenerals
                                where c.CustomerID == 85
                                select c).FirstOrDefault();

                var customerportfolio = (from c in context.CustomerPortfolios
                                         where c.CustomerID == 85
                                         select c).FirstOrDefault();

                if (customer != null)
                {
                    var customertitle = customer.FirstName + " " + customer.LastName + " " + customer.CountryName + "," +
                                        customer.RegionName
                                        + "," + customer.CityName;

                    //Page Title  + Page Attributes like Profile, photo, add photo
                    Page.Title = customer.FirstName + " " + customer.LastName + "Profile or Images";
                    var nl1 = new System.Web.UI.WebControls.Literal {Text = Environment.NewLine};

                    //Title
                    var title = new HtmlMeta {Name = "title", Content = CrawlerStringLimit(customertitle)};
                    Page.Header.Controls.AddAt(1, title);

                    //Description
                    if (customerportfolio != null)
                    {
                        var customerdescription = customerportfolio.About;
                        var description = new HtmlMeta
                                              {Name = "description", Content = CrawlerStringLimit(customerdescription)};
                        Page.Header.Controls.AddAt(2, description);
                    }

                    //username +   + Page Attributes like Profile, photo, add photo
                    var keyword = customer.UserName + Resources.Resource.HomeKeywords;
                    var keywords = new HtmlMeta {Name = "keywords", Content = CrawlerStringLimit(keyword)};
                    Page.Header.Controls.AddAt(3, keywords);

                    //Author
                    var customerauthor = customer.FirstName + " " + customer.LastName;
                    var author = new HtmlMeta {Name = "auhtor", Content = CrawlerStringLimit(customerauthor)};
                    Page.Header.Controls.AddAt(4, author);
                }
            }
        }
Ejemplo n.º 26
0
 public void CatchMessage(SidejobEntities context, AutomatedMessage m)
 {
     var messageProblem = new AutomationEmailProblem
     {
         MessageID = m.MessageID,
         EmailAddress = m.EmailAddress,
         Title = m.Title,
         Message = m.Message
     };
     context.AddToAutomationEmailProblems(messageProblem);
     context.SaveChanges();
 }
    public Bid GetCurrentNewBid(int projectid, int professionalid)
    {
        using (var context = new SidejobEntities())
        {
            var newbid = (from c in context.Bids
                          where c.ProjectID == projectid && c.BidderID == professionalid
                          orderby c.AmountOffered
                          select c).FirstOrDefault();
            return newbid;

        }
    }
        private void TestPosterBidderMessage()
        {
            using (var context = new SidejobEntities())
            {
                var cp = (from c in context.ClosedProjects
                          where c.ProjectID == 105
                          select c).FirstOrDefault();

                var t = new TimeUp();
                if (cp != null) t.TestPosterPayFees(105,cp);
            }
        }
Ejemplo n.º 29
0
 public static void BidderTimeUpUpdate(int projectid, int actionid)
 {
     using (var context = new SidejobEntities())
     {
         var cp = (from c in context.ClosedProjects
                   where c.ProjectID == projectid
                   select c).FirstOrDefault();
         if (cp != null)
         {
             var timeupUpdate = new TimeUp(projectid, actionid, cp);
         }
     }
 }
Ejemplo n.º 30
0
 public static void BidderResponseDelayUpdate(int projectid)
 {
     using (var context = new SidejobEntities())
     {
         var rd = (from c in context.ResponseDelays
                   where c.ProjectID == projectid
                   select c).FirstOrDefault();
         if (rd != null)
         {
             rd.Status = 4;
             context.SaveChanges();
         }
     }
 }