Beispiel #1
0
        public ActionResult SaveGig(Gig gig)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                //job.JobTitle = ToCamelCase(job.JobTitle);
                if (Convert.ToInt32(gig.GigTrendingTagsMappingList.Count) == 0)
                {
                    if (Session["TrendingTagsList"] != null)
                    {
                        gig.GigTrendingTagsMappingList = (List <GigTrendingTagsMapping>)Session["TrendingTagsList"];
                    }
                }

                if (Convert.ToInt32(gig.GigSkillsMappingList.Count) == 0)
                {
                    if (Session["SkillsList"] != null)
                    {
                        gig.GigSkillsMappingList = (List <GigSkillsMapping>)Session["SkillsList"];
                    }
                }


                gig.UserId = Convert.ToInt32(Session["UserId"]);


                List <GigDocuments> fileList = new List <GigDocuments>();

                if (TempData["fileList"] != null)
                {
                    fileList = (List <GigDocuments>)TempData.Peek("fileList");
                }

                if (gig != null)
                {
                    if (Convert.ToInt32(gig.GigDocumentsList.Count) == 0)
                    {
                        if (fileList != null)
                        {
                            foreach (var file in fileList)
                            {
                                gig.GigDocumentsList.Add(new GigDocuments()
                                {
                                    DocumentName = file.DocumentName.ToString(), IsActive = "Y", FileSize = file.FileSize
                                });
                            }
                        }
                    }
                }

                var _tagsObjModel = new TrendingTagsModel();
                foreach (var item in gig.GigTrendingTagsMappingList)
                {
                    if (item.TrendingTagsId == 0)
                    {
                        var _trendingTag = new TrendingTags()
                        {
                            Description    = item.Description,
                            TrendingTagsId = item.TrendingTagsId,
                            JobCategoryId  = gig.JobCategoryId,
                            TagType        = "U"
                        };
                        item.TrendingTagsId = objTrendingMod.Save(_trendingTag);
                    }
                }
                var gigId = 0;
                if ((gigId = objGigMod.SaveWithTransaction(gig)) > 0)
                {
                    if (Session["UserType"] != null && Session["UserType"].ToString() == "2")
                    {
                        Session["UserType"] = "3";
                        UsersModel _Model   = new UsersModel();
                        Users      _userobj = new Users();
                        _userobj.UserId   = Convert.ToInt32(Session["UserId"]);
                        _userobj.UserType = Session["UserType"].ToString();
                        int k = _Model.ChangeUserRole(_userobj);
                    }
                    if (gig.GigId > 0)
                    {
                        message = "Your service has been edited and is now pending for approval";
                        MatchBxCommon.sendGigPostedEmailToAdmin(2, gig.GigTitle, gig.GigId);
                        TempData["CreateGig"] = gig.GigId;
                        TempData["DeleteGig"] = 0;
                    }
                    else
                    {
                        message = "Your service has been created and is now pending for approval";
                        MatchBxCommon.sendGigPostedEmailToAdmin(1, gig.GigTitle, gigId);
                        TempData["CreateGig"] = 0;
                        TempData["DeleteGig"] = 0;
                    }

                    TempData.Remove("fileList");
                    Session["FileList"]   = null;
                    Session["GigCreated"] = "Y";
                }
                else
                {
                    if (gig.GigId > 0)
                    {
                        message = "Failed to edit service";
                    }
                    else
                    {
                        message = "Failed to create service";
                    }

                    TempData.Remove("fileList");
                    Session["FileList"] = null;

                    Session["GigCreated"] = "N";
                }
                if (Convert.ToInt32(Session["UserType"]) != 3)
                {
                    Session["FirstLogin"] = "******";
                }
            }
            else
            {
                message = "Failed to create service";

                TempData.Remove("fileList");
                Session["FileList"]   = null;
                Session["GigCreated"] = "N";
                Session["FirstLogin"] = "******";
            }

            return(Json(message, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult SaveGigSubscription(int GigId, int JobPosterId, string Description, string JobCompletionDate, string Title, int GigSubscriptionId)
        {
            GigSubscription      _GigSubscription      = new GigSubscription();
            GigSubscriptionModel _GigSubscriptionModel = new GigSubscriptionModel();
            string message = "failed";

            _GigSubscription.GigId             = GigId;
            _GigSubscription.JobPosterId       = JobPosterId;
            _GigSubscription.Description       = Description;
            _GigSubscription.GigSubscriptionId = GigSubscriptionId;
            //CultureInfo culture = new CultureInfo("en-US");
            //DateTime tempDate = Convert.ToDateTime(JobCompletionDate, culture);
            DateTime tempDate = DateTime.ParseExact(JobCompletionDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            _GigSubscription.JobCompletionDate     = tempDate;
            _GigSubscription.IsActive              = "Y";
            _GigSubscription.GigSubscriptionStatus = "S";
            _GigSubscription.Title = Title;



            List <GigSubscriptionDocument> fileList        = new List <GigSubscriptionDocument>();
            List <GigSubscriptionDocument> fileUpdatedList = new List <GigSubscriptionDocument>();

            if (TempData["fileList"] != null)
            {
                fileList = (List <GigSubscriptionDocument>)TempData.Peek("fileList");
            }

            if (Session["GigSubDocMasterList"] != null)
            {
                fileUpdatedList = (List <GigSubscriptionDocument>)Session["GigSubDocMasterList"];
            }

            if (GigId != 0)
            {
                if (Convert.ToInt32(_GigSubscription.GigSubscriptionDocumentList.Count) == 0)
                {
                    if (fileList != null)
                    {
                        foreach (var file in fileList)
                        {
                            _GigSubscription.GigSubscriptionDocumentList.Add(new GigSubscriptionDocument()
                            {
                                DocumentName = file.DocumentName.ToString(), IsActive = "Y", FileSize = file.FileSize
                            });
                        }
                    }
                    if (fileUpdatedList != null)
                    {
                        foreach (var file in fileUpdatedList)
                        {
                            _GigSubscription.GigSubscriptionDocumentList.Add(new GigSubscriptionDocument()
                            {
                                DocumentName = file.DocumentName.ToString(), IsActive = file.IsActive, FileSize = file.FileSize, GigSubscriptionDocumentId = file.GigSubscriptionDocumentId, GigSubscriptionId = file.GigSubscriptionId, CreatedDate = file.CreatedDate
                            });
                        }
                    }
                }
            }

            var gigId = 0;

            if ((gigId = _GigSubscriptionModel.SaveWithTransaction(_GigSubscription)) > 0)
            {
                Users      _objuser    = new Users();
                UsersModel objUsersMod = new UsersModel();
                if (Convert.ToInt32(Session["UserType"]) == 1)
                {
                    _objuser.UserId   = Convert.ToInt32(Session["UserId"]);
                    _objuser.UserType = "3";
                    int returnvalue = objUsersMod.ChangeUserRole(_objuser);
                    if (returnvalue > 0)
                    {
                        Session["UserType"] = "3";
                    }
                }
                message = "success";
                if (MatchBxCommon.checkuseremailpreferences("4,5", Convert.ToInt32(Session["UserId"])) == true)
                {
                    try
                    {
                        Gig      _objGig      = new Gig();
                        GigModel _objGigModel = new GigModel();
                        _objGig  = _objGigModel.GetARecord(GigId);
                        _objuser = objUsersMod.GetList("*", " UserId = '" + _objGig.UserId + "'").FirstOrDefault();
                        string email    = _objuser.Email;
                        string fullname = _objuser.FullName != null ? _objuser.FullName : _objuser.UserName;
                        MatchBxCommon.sendGigOfferEmail(email, false, Session["UserName"].ToString(), Title, fullname);
                    }
                    catch (Exception e)
                    {
                    }
                }

                Session["GigSubDocMasterList"] = null;
                Session["GigSubDocList"]       = null;
            }

            return(Json(message, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult SaveJob(Job job)
        {
            string message = "";

            if (ModelState.IsValid)
            {
                //job.JobTitle = ToCamelCase(job.JobTitle);
                if (Convert.ToInt32(job.JobTrendingTagsMappingList.Count) == 0)
                {
                    if (Session["TrendingTagsList"] != null)
                    {
                        job.JobTrendingTagsMappingList = (List <JobTrendingTagsMapping>)Session["TrendingTagsList"];
                    }
                }

                if (Convert.ToInt32(job.JobSkillsMappingList.Count) == 0)
                {
                    if (Session["SkillsList"] != null)
                    {
                        job.JobSkillsMappingList = (List <JobSkillsMapping>)Session["SkillsList"];
                    }
                }


                job.UserId = Convert.ToInt32(Session["UserId"]);


                List <JobDocuments> fileList = new List <JobDocuments>();

                if (TempData["fileList"] != null)
                {
                    fileList = (List <JobDocuments>)TempData.Peek("fileList");
                }

                if (job != null)
                {
                    if (Convert.ToInt32(job.JobDocumentsList.Count) == 0)
                    {
                        if (fileList != null)
                        {
                            foreach (var file in fileList)
                            {
                                job.JobDocumentsList.Add(new JobDocuments()
                                {
                                    DocumentName = file.DocumentName.ToString(), IsActive = "Y", Filesize = file.Filesize
                                });
                            }
                        }
                    }
                }

                var _tagsObjModel = new TrendingTagsModel();
                foreach (var item in job.JobTrendingTagsMappingList)
                {
                    if (item.TrendingTagsId == 0)
                    {
                        var _trendingTag = new TrendingTags()
                        {
                            Description    = item.Description,
                            TrendingTagsId = item.TrendingTagsId,
                            JobCategoryId  = job.JobCategoryId,
                            TagType        = "U"
                        };
                        item.TrendingTagsId = objTrendingMod.Save(_trendingTag);
                    }
                }
                var jobId = 0;
                if ((jobId = objJobMod.SaveWithTransaction(job)) > 0)
                {
                    if (Session["UserType"] != null && Session["UserType"].ToString() == "1")
                    {
                        Session["UserType"] = "3";
                        UsersModel _Model   = new UsersModel();
                        Users      _userobj = new Users();
                        _userobj.UserId   = Convert.ToInt32(Session["UserId"]);
                        _userobj.UserType = Session["UserType"].ToString();
                        int k = _Model.ChangeUserRole(_userobj);
                    }
                    if (job.JobId > 0)
                    {
                        message = "Your job has been edited and is now pending for approval";
                        MatchBxCommon.sendJobPostedEmailToAdmin(2, job.JobTitle, job.JobId);
                        TempData["postJob"]   = job.JobId;
                        TempData["DeleteJob"] = 0;
                    }
                    else
                    {
                        // message = "Your job has been posted and is now live";
                        message = "Your job has been posted and is now pending for approval";
                        MatchBxCommon.sendJobPostedEmailToAdmin(1, job.JobTitle, jobId);
                        TempData["postJob"]   = 0;
                        TempData["DeleteJob"] = 0;
                    }

                    TempData.Remove("fileList");
                    Session["FileList"]  = null;
                    Session["JobPosted"] = "Y";
                }
                else
                {
                    if (job.JobId > 0)
                    {
                        message = "Failed to edit job";
                    }
                    else
                    {
                        message = "Failed to post job";
                    }

                    TempData.Remove("fileList");
                    Session["FileList"] = null;

                    Session["JobPosted"] = "N";
                }
                if (Convert.ToInt32(Session["UserType"]) != 3)
                {
                    Session["FirstLogin"] = "******";
                }
            }
            else
            {
                message = "Failed to post job";

                TempData.Remove("fileList");
                Session["FileList"]   = null;
                Session["JobPosted"]  = "N";
                Session["FirstLogin"] = "******";
            }

            return(Json(message, JsonRequestBehavior.AllowGet));
        }