Exemplo n.º 1
0
        //[SessionExpire]
        public ActionResult Details(int?id, string type = "")
        {
            TempData["TrendingTagsFooter"] = MatchBxCommon.GetTrendingTagsFooter();
            TempData["BidMessage"]         = "";
            TempData["BidAmount"]          = "";
            TempData["AXPRFeeAmt"]         = "0.00";
            TempData["AXPRFeeTotAmt"]      = "";
            TempData["BidAmountinDollar"]  = "";
            TempData["JobBiddingId"]       = "";
            Session["Expired"]             = "N";
            Session["FromDetails"]         = "Y";
            //if(Session["JobCategoryName"]==null || Session["JobCategoryName"].ToString()=="")
            //{
            //    Session["JobCategoryName"] = "";
            //}
            dynamic model = new ExpandoObject();
            //Session["ProfilePic"] = "/Content/images/client_pic_1.png";

            int jobid = id.GetValueOrDefault();

            Session["JobId"] = jobid;
            if (jobid != 0)
            {
                objJobList = MatchBxCommon.GenerateBadge(objJobMod.GetJobPost(jobid));
                if (objJobList.Count() > 0)
                {
                    ViewBag.MetaTag = HomeMetaTags(objJobList[0].JobTitle.ToString(), objJobList[0].JobDescription.ToString());

                    objJobList.FirstOrDefault().JobSkillsMappingList       = objJobMod.GetSkillsByJobId(jobid);
                    objJobList.FirstOrDefault().JobTrendingTagsMappingList = objJobMod.GetTagsByJobId(jobid);
                    objJob = objJobList.FirstOrDefault();
                    JobModel _ObjModel     = new JobModel();
                    decimal  exchangerate1 = MatchBxCommon.GetExchangeRate();
                    if (type == "A")
                    {
                        objJob.CurrentOffersList = _ObjModel.GetCurrentBidsForJob(new Job {
                            JobId = jobid
                        });
                        objJob.CurrentOffersList.ForEach(x => x.DollarCount = Math.Round(exchangerate1 * (x.BidAmount), 2));
                    }
                    else if (type == "C")
                    {
                        objJob.DeclinedOffersList = _ObjModel.GetDeclinedBidsForJob(new Job {
                            JobId = jobid
                        });
                        objJob.DeclinedOffersList.ForEach(x => x.DollarCount = Math.Round(exchangerate1 * (x.BidAmount), 2));
                    }
                    Session["JobPoster"] = objJob.UserId;

                    Session["JobCategory"]       = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(objJob.Category.ToLower());
                    Session["JobCategoryHeader"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(objJob.Category.ToLower());

                    if (Session["JobCategoryId"].ToString() == "0")
                    {
                        Session["JobCategoryName"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase("ALL JOBS".ToLower());
                    }
                    else
                    {
                        Session["JobCategoryName"] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(objJob.Category.ToLower());
                    }

                    TimeSpan span     = objJob.JobCompletionDate.Subtract(DateTime.Now);
                    string   EndingIn = (span.Days + 1) + " DAYS, " + (span.Hours + 1) + " HOURS, " + span.Minutes + " MINS";
                    if (span.Days == 0 || objJob.JobStatus == "P")
                    {
                        Session["Expired"] = "N";
                        EndingIn           = (span.Days + 1) + " DAYS, " + Math.Abs(span.Hours + 1) + " HOURS, " + Math.Abs(span.Minutes) + " MINS";
                    }
                    else if (span.Days < 0 || span.Hours < 0 || span.Minutes < 0 || objJob.JobStatus == "A" || objJob.JobStatus == "C" || objJob.JobStatusSeeker == "C")
                    {
                        Session["Expired"] = "Y";
                    }
                    TempData["EndingIn"] = EndingIn;
                    if (Convert.ToInt32(Session["UserId"]) != objJob.UserId)
                    {
                        JobBidding _JobBidding = new JobBidding();
                        _JobBidding.UserId = Convert.ToInt32(Session["UserId"]);
                        _JobBidding.JobId  = objJob.JobId;

                        objBiddingList = objBiddingMod.LoadJobBiddingDetails(_JobBidding);
                        if (objBiddingList.Count() > 0)
                        {
                            decimal exchangerate = MatchBxCommon.GetExchangeRate();
                            TempData["BidMessage"]  = objBiddingList.FirstOrDefault().BidMessage;
                            TempData["BidAmount"]   = "$ " + (objBiddingList.FirstOrDefault().BidAmount *exchangerate).ToString("#,##0.00");
                            TempData["BidDuration"] = objBiddingList.FirstOrDefault().BidDuration;
                            decimal bid  = Convert.ToDecimal(objBiddingList.FirstOrDefault().BidAmount);
                            decimal perc = (Convert.ToDecimal(bid) * 3) / 100;
                            TempData["AXPRFeeAmt"] = perc.ToString("#,##0.00");

                            string totalfees = (bid - perc).ToString("#,##0.00");
                            TempData["AXPRFeeTotAmt"] = totalfees;

                            TempData["BidAmountinDollar"]   = objBiddingList.FirstOrDefault().BidAmount.ToString("#,##0.00");
                            TempData["JobBiddingId"]        = objBiddingList.FirstOrDefault().JobBiddingId;
                            TempData["TokenDistributionId"] = objBiddingList.FirstOrDefault().TokenDistributionId;
                            TempData["IsPendingStatus"]     = objBiddingList.FirstOrDefault().IsPending;
                        }
                        else
                        {
                            decimal exchangerate = MatchBxCommon.GetExchangeRate();
                            TempData["IsPendingStatus"] = "N";
                            TempData["BidAmount"]       = "$ " + (objJob.BudgetASP * exchangerate).ToString("#,##0.00");
                            TempData["BidDuration"]     = 0;
                            decimal bid  = Convert.ToDecimal(objJob.BudgetASP);
                            decimal perc = (Convert.ToDecimal(bid) * 3) / 100;
                            TempData["AXPRFeeAmt"] = perc.ToString("#,##0.00");

                            string totalfees = (bid - perc).ToString("#,##0.00");
                            TempData["AXPRFeeTotAmt"]     = totalfees;
                            TempData["BidAmountinDollar"] = objJob.BudgetASP.ToString("#,##0.00");
                        }
                    }

                    //objJob.ShareJob = shareJobObj.GetShareDetails(jobid, Convert.ToInt32(Session["UserId"]));
                    //if(objJob.ShareJob == null)
                    //{
                    //    objJob.ShareJob = new SocialMediaShare();
                    //    objJob.ShareJob.JobId = jobid;
                    //    objJob.ShareJob.UserId = Convert.ToInt32(Session["UserId"]);
                    //    objJob.ShareJob.FBShare = null;
                    //    objJob.ShareJob.TwitterShare = null;
                    //}
                }
            }
            return(View("Details", objJob));
        }