Пример #1
0
        public int ReferralUpdateInsert(ReferralRequest payload)
        {
            int id = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.ReferralRequestInternal_UpdateInsert"
                                         , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@ReferrerId", payload.ReferrerId);
                paramCollection.AddWithValue("@CandidateId", payload.CandidateId);
                paramCollection.AddWithValue("@JobId", payload.JobId);
                paramCollection.AddWithValue("@Message", payload.Message);
                //If Accepted is not equal to true, must set accepted to false so that it
                //is in pending status
                if (payload.Accepted != true)
                {
                    payload.Accepted = false;
                }
                ;
                paramCollection.AddWithValue("Accepted", payload.Accepted);
                paramCollection.AddWithValue("@Favorite", payload.Favorite);
                paramCollection.AddWithValue("@Hidden", payload.Hidden);
                paramCollection.AddWithValue("@UserNotified", payload.UserNotified);

                SqlParameter c = new SqlParameter("@Id", SqlDbType.Int);
                c.Direction    = ParameterDirection.Output;
                paramCollection.Add(c);
            }, returnParameters : delegate(SqlParameterCollection param)
            {
                int.TryParse(param["@Id"].Value.ToString(), out id);
            });
            return(id);
        }
 public string SaveReferralRequest(ReferralRequest rrDetails)
 {
     //RestService restSevice = new RestService ();
     string postData = Newtonsoft.Json.JsonConvert.SerializeObject(rrDetails);
     string response = RestService.Instance.PostData (Constants.ReferralRequests, postData);
     return response;
 }
        public HttpResponseMessage CreateUpdateReferral([FromBody] ReferralRequest payload)
        {
            try
            {
                ItemResponse <int> response = new ItemResponse <int>();

                response.Item = _referralService.ReferralUpdateInsert(payload);

                if (payload.Accepted == true)
                {
                    //add new message to the database that will notfiy user that their referral request was completed
                    ConversationMsgAddRequest convo = new ConversationMsgAddRequest();
                    convo.SenderId   = HttpContext.Current.User.Identity.GetUserId();
                    convo.ReceiverId = payload.CandidateGuid;
                    convo.Subject    = "Referral Request Accepted!";
                    var request = HttpContext.Current.Request;
                    var address = string.Format("{0}://{1}", request.Url.Scheme, request.Url.Authority);
                    convo.Content = "Check your 'My Referrals' page to see your updated referral requests here: " + address + "/Jobs/MyReferrals/";
                    _messagingService.CreateConversationMsg(convo);
                }

                return(Request.CreateResponse(response));
            }
            catch (System.Exception ex)
            {
                //add to error log
                ErrorLogService    svc   = new ErrorLogService();
                ErrorLogAddRequest error = new ErrorLogAddRequest();
                error.ErrorFunction = "Sabio.Web.Controllers.Api.CreateReferral";
                error.ErrorMessage  = ModelState.ToString();
                error.UserId        = UserService.UserSelect().PersonId;
                svc.ErrorLogInsert(error);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
 public string UpdateReferralRequest(int requestID,int Status)
 {
     ReferralRequest rrDetails = new ReferralRequest ();
     rrDetails.ID = requestID;
     rrDetails.Status = Status;
     //RestService restSevice = new RestService ();
     string postData = Newtonsoft.Json.JsonConvert.SerializeObject(rrDetails);
     string response = RestService.Instance.PostData(Constants.ReferralRequestsUpdate, postData);
     return response;
 }
Пример #5
0
        /// <summary>
        /// Async AddReferral Bussiness. it add new player and add actions for all referral challenges.
        /// </summary>
        /// <exception cref="GameballException">Thrown if the request fails..</exception>
        public async Task <bool> CreateReferralAsync(ReferralRequest referral)
        {
            referral.Validate();
            var response = await this.Client.PostAsync(ApiBase + GameballConstants.Referral, new StringContent(referral.Serialize(), Encoding.UTF8, "application/json"));

            if (!response.IsSuccessStatusCode)
            {
                throw (BuildGameballException(response));
            }
            else
            {
                return(response.IsSuccessStatusCode);
            }
        }
 public void UpdateCell(ReferralRequest obj)
 {
     LabelLeadName.Text = obj.SellerName;
     LabelCompanyName.Text = obj.CompanyName;
     //LabelHourText.Text = DateTime.Parse(obj.CreatedOn).ToString("MMM dd");
 }
        public void UpdateCell(ReferralRequest rrObj)
        {
            if(rrObj.Status != 1)
            LabelSellerName.Text = "Seller: " + rrObj.SellerName;

            LabelSellerCompany.Text = rrObj.CompanyName;
            LabelSellerTitle.Text = rrObj.SellerTitle;
            LabelProspectName.Text = "Prospect: "+ rrObj.Prospect;
            LabelProspectTitle.Text = rrObj.LEAD_TITLE;
            LabelProspectCompany.Text = rrObj.COMPANY_NAME;
            //			if (rrObj.Status == 1)
            //				LabelNewRequest.Hidden = false;
            //			else
            //				LabelNewRequest.Hidden = true;
        }