Beispiel #1
0
        public ActionResult LoadProjectMessages(int prmReceiverId)
        {
            MatchBXMessageModel   _objModel = new MatchBXMessageModel();
            List <MatchBXMessage> _list     = new List <MatchBXMessage>();

            _list = _objModel.GetProjectMessages(prmReceiverId);
            if (_list.Where(m => m.ReadStatus == 0 && m.JobId != 0).ToList().Count == 0)
            {
                Session["ProjectMsgStatus"] = "N";
            }
            return(Json(_list, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult LoadChatLandingDetails(int prmReceiverId)
        {
            MatchBXMessageModel   _objModel = new MatchBXMessageModel();
            List <MatchBXMessage> _list     = new List <MatchBXMessage>();

            _list = _objModel.GetAllChatMessage(prmReceiverId);
            if (_list.Where(m => m.ReadStatus == 0 && m.JobId == 0).ToList().Count == 0)
            {
                Session["MessageStatus"] = "N";
            }
            return(Json(_list, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult CheckAllMsgRead(int prmReceiverId)
        {
            MatchBXMessageModel _objModel = new MatchBXMessageModel();
            //List<MatchBXMessage> _list = new List<MatchBXMessage>();
            var msgStatus = _objModel.GetMessageStatus(prmReceiverId);

            if (msgStatus.MessageStatus == "N")
            {
                Session["MessageStatus"] = "N";
            }
            if (msgStatus.ProjectMsgStatus == "N")
            {
                Session["ProjectMsgStatus"] = "N";
            }
            return(Json(msgStatus, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public ActionResult LoadProjectMessageForJob(int _prmSendUserId, int _prmJobID)
        {
            var userId       = Convert.ToInt32(Session["UserId"]);
            int messageJobId = _prmJobID;
            MatchBXMessageModel   _objModel = new MatchBXMessageModel();
            List <MatchBXMessage> _list     = new List <MatchBXMessage>();

            _list = _objModel.GetChatMessage(userId, _prmSendUserId, _prmJobID);

            if (_list.Where(m => m.ReadStatus == 0).ToList().Count > 0 && _prmSendUserId != userId)
            {
                var _objMsg = new MatchBXMessage();
                _objMsg.ReceiverId = _prmSendUserId;
                _objMsg.SendUserId = userId;
                _objMsg.ReadStatus = 1;
                _objMsg.JobId      = _prmJobID;
                _objModel.ChangeReadStatus(_objMsg);
            }
            Session["messageJobId"] = _prmJobID;
            return(Json(_list, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public ActionResult LoadAllChat(int prmReceiverId, int prmSendUserId)
        {
            var userId = Convert.ToInt32(Session["UserId"]);
            //int messageJobId = Convert.ToInt32(Session["messageJobId"]);
            int messageJobId = 0;
            MatchBXMessageModel   _objModel = new MatchBXMessageModel();
            List <MatchBXMessage> _list     = new List <MatchBXMessage>();

            _list = _objModel.GetChatMessage(prmReceiverId, prmSendUserId, messageJobId);

            if (_list.Where(m => m.ReadStatus == 0).ToList().Count > 0 && prmSendUserId != userId)
            {
                var _obj = new MatchBXMessage();
                _obj.ReceiverId = prmReceiverId;
                _obj.SendUserId = prmSendUserId;
                _obj.ReadStatus = 1;
                _obj.JobId      = 0;
                _objModel.ChangeReadStatus(_obj);
            }
            Session["messageJobId"] = 0;
            return(Json(_list, JsonRequestBehavior.AllowGet));
        }
Beispiel #6
0
        public ActionResult BidJob(decimal bidamount, int bidDuration, string bidmessage, int jobid, int bidid, int jobposterid, string jobtitle, int _TokenDistributionId, string _AccountInfo)
        {
            Users _objuser = new Users();

            objBidding.UserId       = Convert.ToInt32(Session["UserId"]);
            objBidding.BidAmount    = bidamount;
            objBidding.BidDuration  = bidDuration;
            objBidding.BidMessage   = bidmessage;
            objBidding.JobId        = jobid;
            objBidding.JobBiddingId = bidid;
            objBidding.IsAccepted   = "N";
            objBidding.IsActive     = "Y";
            string  BidUserName = "******" + Session["UserName"].ToString();
            decimal bidAmount   = bidamount;
            string  message     = "";

            if (objBiddingMod.Save(objBidding) > 0)
            {
                if (bidmessage != string.Empty)
                {
                    MatchBXMessage      _objMessage      = new MatchBXMessage();
                    MatchBXMessageModel _objMessageModel = new MatchBXMessageModel();

                    _objMessage.SendUserId  = Convert.ToInt32(Session["UserId"]);
                    _objMessage.Message     = bidmessage;
                    _objMessage.ReceiverId  = jobposterid;
                    _objMessage.ReadStatus  = 0;
                    _objMessage.MessageType = "J";
                    _objMessage.FileSize    = 0;
                    _objMessage.FileName    = "";
                    _objMessage.JobId       = jobid;

                    _objMessageModel.Save(_objMessage);
                }


                if (MatchBxCommon.checkuseremailpreferences("4,5", Convert.ToInt32(Session["UserId"])) == true)
                {
                    _objuser = objUsersMod.GetList("*", " UserId = '" + jobposterid + "'").FirstOrDefault();
                    string email = _objuser.Email;

                    string fullname = _objuser.FullName != null ? _objuser.FullName : _objuser.UserName;
                    //string fullname = objUsersMod.FullName != null ? objUser.FullName : objUser.UserName;
                    MatchBxCommon.sendBidOfferEmail(email, false, BidUserName, jobtitle, bidAmount, fullname);
                }
                objJob           = objJobMod.GetList("*", " JobId = '" + jobid + "'").FirstOrDefault();
                objJob.JobStatus = "B";
                if (objJobMod.Save(objJob) > 0)
                {
                    TokenDistributionModel _TokenDistributionModel = new TokenDistributionModel();
                    TokenDistribution      _TokenDistribution      = new TokenDistribution();

                    if (_TokenDistributionId > 0)
                    {
                        _TokenDistribution = _TokenDistributionModel.GetList("*", " TokenDistributionId = '" + _TokenDistributionId + "'").FirstOrDefault();
                        _TokenDistribution.TokenAddress = _AccountInfo;
                    }
                    else
                    {
                        _TokenDistribution.TokenDistributionId = 0;
                        _TokenDistribution.JobBiddingId        = objBiddingMod.Id;
                        _TokenDistribution.TokenAddress        = _AccountInfo;
                        _TokenDistribution.UserId     = Convert.ToInt32(Session["UserId"]);
                        _TokenDistribution.IsApproved = "N";
                    }
                    if (_TokenDistributionModel.Save(_TokenDistribution) > 0)
                    {
                        message = "Success";
                    }
                    else
                    {
                        message = "Failed";
                    }
                }
                else
                {
                    message = "Failed";
                }
            }
            else
            {
                message = "Failed";
            }
            return(Json(message, JsonRequestBehavior.AllowGet));
        }