private async Task <DialogTurnResult> ResolveMendingChoiceAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var result = ((FoundChoice)stepContext.Result).Value; var fixDetails = (FixDetails)stepContext.Options; switch (result) { case "I Can't Do This": var postingDetails = new PostingDetails { Posting = Posting.GetPerson, Item = fixDetails.Item, Problem = fixDetails.Problem }; return(await stepContext.BeginDialogAsync(nameof(CreatePostingDialog), postingDetails, cancellationToken)); case "I Need Materials": MaterialDetails matDeets = new MaterialDetails(fixDetails); return(await stepContext.BeginDialogAsync(nameof(GetMaterialsDialog), matDeets, cancellationToken)); case "Mending Complete": // TO DO: Give Feedback and level up! return(await stepContext.NextAsync(null, cancellationToken)); default: return(await stepContext.NextAsync(null, cancellationToken)); } }
private async Task <DialogTurnResult> ResolveWhoFixesAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var fixer = ((FoundChoice)stepContext.Result).Value; var fixDetails = (FixDetails)stepContext.Options; fixDetails.Fixer = fixer; switch (fixer) { case "Fix It Myself": // Run the BookingDialog giving it whatever details we have from the LUIS call, it will fill out the remainder. return(await stepContext.BeginDialogAsync(nameof(FixItYourselfDialog), fixDetails, cancellationToken)); case "Find an Expert": var postDeets = new PostingDetails() { Posting = Posting.GetPerson, Item = fixDetails.Item, Problem = fixDetails.Problem }; return(await stepContext.BeginDialogAsync(nameof(CreatePostingDialog), postDeets, cancellationToken)); default: var defaultText = $"TODO: another flow here for {fixer}"; var defaultMessage = MessageFactory.Text(defaultText, defaultText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(defaultMessage, cancellationToken); break; } return(await stepContext.NextAsync(fixDetails, cancellationToken)); }
public ResponseSingleModel <PostingDetails> PostingDetailCreation(PostingDetails postingDetails, out string message) { var result = new ResponseSingleModel <PostingDetails>(); long dtlpostingid; message = string.Empty; if (this.instance.InsertUpdatePostingDetails(postingDetails, out dtlpostingid, out message)) { var ds = this.instance.GetByPostingDetailsId(postingDetails.postingid, out message); var dsPhotos = this.instance.GetByPostingPhotosById(postingDetails.postingid, out message); var lstProfile = DataAccessUtility.ConvertToList <QTrans.Models.ViewModel.Posting.PostingProfileView>(ds.Tables[0]); var lstDetails = DataAccessUtility.ConvertToList <PostingDetails>(ds.Tables[1]); var lstPostingPhotos = DataAccessUtility.ConvertToList <PostingPhotos>(dsPhotos.Tables[0]); postingDetails = lstDetails.Count > 0 ? lstDetails[0] : null; postingDetails.postingProfile = lstProfile.Count > 0 ? lstProfile[0] : null; postingDetails.dtlpostingid = dtlpostingid; postingDetails.PostingPhotoList = lstPostingPhotos; result.Response = postingDetails; result.Status = Constants.WebApiStatusOk; result.Message = message; } else { result.Status = Constants.WebApiStatusFail; result.Message = message; } return(result); }
public IHttpActionResult SubmitPostingDetails(PostingDetails postingDetails) { string message = string.Empty; using (var repository = new PostingRepository(0)) { var result = repository.PostingDetailCreation(postingDetails, out message); if (!string.IsNullOrEmpty(message)) { log.Info(message); } return(Ok(new { result.Status, data = result })); } }
public bool InsertUpdatePostingDetails(PostingDetails postingDetails, out long identity, out string message) { int rowEffected = 0; using (DBConnector connector = new DBConnector("Usp_InsertUpdatePostingDetails", true)) { connector.AddInParameterWithValue("@dtlpostingid", postingDetails.dtlpostingid); connector.AddInParameterWithValue("@postingid", postingDetails.postingid); connector.AddInParameterWithValue("@materialweight", postingDetails.materialweight); connector.AddInParameterWithValue("@materialphotos", postingDetails.materialphotos); connector.AddInParameterWithValue("@packingdimension", postingDetails.packingdimension); connector.AddInParameterWithValue("@numberpackets", postingDetails.numberpackets); connector.AddInParameterWithValue("@vehicletype", postingDetails.vehicletype); connector.AddInParameterWithValue("@novehicle", postingDetails.novehicle); connector.AddInParameterWithValue("@deliveryperiodday", postingDetails.deliveryperiodday); connector.AddInParameterWithValue("@pickupdatetime", postingDetails.pickupdatetime); connector.AddInParameterWithValue("@postamount", postingDetails.postamount); connector.AddInParameterWithValue("@onpickuppercentage", postingDetails.onpickuppercentage); connector.AddInParameterWithValue("@onunloadingpercentage", postingDetails.onunloadingpercentage); connector.AddInParameterWithValue("@creditday", postingDetails.creditday); connector.AddInParameterWithValue("@contractstartdatetime", postingDetails.contractstartdatetime); connector.AddInParameterWithValue("@contractenddatetime", postingDetails.contractenddatetime); connector.AddInParameterWithValue("@ordertype", postingDetails.ordertype); connector.AddInParameterWithValue("@biddingactivatedatetime", postingDetails.biddingactivatedatetime); connector.AddInParameterWithValue("@biddingclosedatetime", postingDetails.biddingclosedatetime); connector.AddInParameterWithValue("@poststatus", postingDetails.poststatus); connector.AddInParameterWithValue("@gprs", postingDetails.gprs); connector.AddInParameterWithValue("@menpowerloading", postingDetails.menpowerloading); connector.AddInParameterWithValue("@menpowerunloading", postingDetails.menpowerunloading); connector.AddInParameterWithValue("@transporterinsurance", postingDetails.transporterinsurance); connector.AddInParameterWithValue("@tolltaxinclude", postingDetails.tolltaxinclude); connector.AddInParameterWithValue("@remark", postingDetails.remark); connector.AddInParameterWithValue("@loadingtype", postingDetails.loadingtype); connector.AddOutParameterWithType("@Message", SqlDbType.VarChar); connector.AddOutParameterWithType("@identity", SqlDbType.BigInt); rowEffected = connector.ExceuteNonQuery(); message = connector.GetParamaeterValue("@Message").ToString(); identity = postingDetails.dtlpostingid == 0 ? Convert.ToInt64(connector.GetParamaeterValue("@identity")) : postingDetails.dtlpostingid; } return(rowEffected > 0); }
public ResponseSingleModel <PostingDetails> GetPostingDetailById(long postingId, out string message) { var result = new ResponseSingleModel <PostingDetails>(); message = string.Empty; PostingDetails postingDetails = null; var ds = this.instance.GetByPostingDetailsId(postingId, out message); var dsPhotos = this.instance.GetByPostingPhotosById(postingId, out message); var lstProfile = DataAccessUtility.ConvertToList <QTrans.Models.ViewModel.Posting.PostingProfileView>(ds.Tables[0]); var lstDetails = DataAccessUtility.ConvertToList <PostingDetails>(ds.Tables[1]); var lstPostingPhotos = DataAccessUtility.ConvertToList <PostingPhotos>(dsPhotos.Tables[0]); postingDetails = lstDetails.Count > 0 ? lstDetails[0] : null; postingDetails.postingProfile = lstProfile.Count > 0 ? lstProfile[0] : null; postingDetails.PostingPhotoList = lstPostingPhotos; result.Response = postingDetails; result.Status = Constants.WebApiStatusOk; result.Message = message; return(result); }
private async Task <DialogTurnResult> ResolveGetMaterialsAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var matDeets = (MaterialDetails)stepContext.Options; var getMatsFrom = ((FoundChoice)stepContext.Result).Value; switch (getMatsFrom) { case "From a Shop": // adaptive card with where to get materials var resourceCard = CreateMaterialsAttachment(matDeets); var attachment = MessageFactory.Attachment(resourceCard, ssml: "Here are some resources"); var resourceResponse = await stepContext.Context.SendActivityAsync(attachment, cancellationToken); break; case "Community": var postingDetails = new PostingDetails { Posting = Posting.GetMaterials, Item = matDeets.Item, Problem = matDeets.Problem, Material = matDeets.Material ?? "orange thread" }; return(await stepContext.BeginDialogAsync(nameof(CreatePostingDialog), postingDetails, cancellationToken)); default: var defaultText = $"TODO: another flow here for {getMatsFrom}"; var defaultMessage = MessageFactory.Text(defaultText, defaultText, InputHints.IgnoringInput); await stepContext.Context.SendActivityAsync(defaultMessage, cancellationToken); break; } return(await stepContext.NextAsync(true, cancellationToken)); }