public JsonResult GigOffer(int GigSubscriptionId, string Status) { GigSubscription _GigSubscription = new GigSubscription(); GigSubscriptionModel _GigSubscriptionModel = new GigSubscriptionModel(); Gig _Gig = new Gig(); GigModel _GigModel = new GigModel(); _GigSubscription = _GigSubscriptionModel.GetARecord(GigSubscriptionId); _GigSubscription.Status = Status; _Gig = _GigModel.GetARecord(_GigSubscription.GigId); int UserId = _Gig.UserId; string GigTitle = _Gig.GigTitle; if (_GigSubscriptionModel.GigOfferAcceptorDecline(_GigSubscription).FirstOrDefault().JobId > 0) { _GigSubscription.JobId = _GigSubscriptionModel.GigOfferAcceptorDecline(_GigSubscription).FirstOrDefault().JobId; //objNotification.ReceiverId = UserId; //objNotification.SenderId = Convert.ToInt32(Session["UserId"]); //objNotification.ReadStatus = 0; //if (Status == "A") //{ // objNotification.Notification = "@" + Session["UserName"] + " has accepted your bid for job: " + JobTitle; // objNotification.Header = "Bid accepted"; //} //else //{ // objNotification.Notification = "Your job has been cancelled as it went against the terms of this jobsite"; // objNotification.Header = "Bid cancelled"; //} //objNotiMod.Save(objNotification); if (MatchBxCommon.checkuseremailpreferences("2,4", UserId) == true) { Users objUser = new Users(); objUser = objUsersMod.GetList("*", " UserId = '" + UserId + "'").FirstOrDefault(); string seekeremail = objUser.Email; string posterusername = "******" + Session["UserName"].ToString(); string seekerfullname = objUser.FullName != null ? objUser.FullName : objUser.UserName; if (Status == "A") { //MatchBxCommon.sendBidAcceptanceEmail(fullname, username, JobTitle, JobId, email, objJobbidding.BidAmount, false); } else { MatchBxCommon.sendGigDeclineEmail(seekerfullname, posterusername, GigTitle, seekeremail, false); } } } else { _GigSubscription.JobId = 0; } return(Json(_GigSubscription, JsonRequestBehavior.AllowGet)); }
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)); }