Пример #1
0
        public void SaveResponse()
        {
            AssessmentResponse Response = new AssessmentResponse();
            // Response = rc_services.GetResponse(Guid.Parse(ItemKey), MilestoneID);
            Guid ResponseID = Guid.Parse(Response.ResponseID.ToString());

            if (AllowAssessment == true)
            {
                if (AssessmentValue == Response.Assesment)
                {
                    // rc_services.SaveResponse(ResponseID, txResponse.Html, AssessmentValue, MilestoneID);
                }
                else
                {
                    //rc_services.InsertNewResponse(ItemKey, txResponse.Html, AssessmentValue, MilestoneID);
                }
            }
            else
            {
                if (Response.ItemKey == Guid.Parse(ItemKey) && Response.MilestoneID == Guid.Parse(MilestoneID))
                {
                    //rc_services.SaveResponse(ResponseID, txResponse.Html, AssessmentValue, MilestoneID);
                }
                else
                {
                    // rc_services.InsertNewResponse(ItemKey, txResponse.Html, AssessmentValue, MilestoneID);
                }
            }
            // AssessmentValue = (string)dropAssessment.SelectedItem.Value;

            BindForm();
            IsSaved = true;
        }
Пример #2
0
        protected void gridResponse_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            // String MilestoneID = Session["MilestoneID"].ToString();
            String       ItemID       = Session["ItemKey"].ToString();
            ASPxGridView gridResponse = (ASPxGridView)sender;

            ASPxHtmlEditor txResponse = (ASPxHtmlEditor)gridResponse.FindEditFormLayoutItemTemplateControl("txResponse");

            AssessmentResponse UpdateResponse = new AssessmentResponse
            {
                ResponseID    = Guid.Parse(e.Keys["ResponseID"].ToString()),
                MilestoneName = e.NewValues["MilestoneName"].ToString(),
                ItemKey       = Guid.Parse(ItemID),
                // MilestoneID = Guid.Parse(""),

                Response = txResponse.Html
            };

            rc_services.SaveResponse(UpdateResponse);

            e.Cancel = true;
            gridResponse.DataSource = rc_services.GetResponse(Guid.Parse(ItemID));
            gridResponse.DataBind();
            gridResponse.CancelEdit();

            BindMainGrids();
        }
        public void Post(AssessmentResponse response)
        {
            AssessmentBus business;

            try
            {
                business = new AssessmentBus();
                business.UpdateResponse(response);
            }
            catch (Exception ex)
            {
                throw new Exception("MSI.CCAT.API.Controller.AssessmentController:" + ex.Message);
            }
        }
Пример #4
0
        public AssessmentResponse UpdateResponse(AssessmentResponse assessmentResponse)
        {
            ResponseBus          responseBus;
            Tbl_QuestionResponse response = null;

            try
            {
                responseBus = new ResponseBus();
                response    = responseBus.UpdateResponse(assessmentResponse.UserId, assessmentResponse.Response, assessmentResponse.ResponseId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(assessmentResponse);
        }
Пример #5
0
        public async Task <IActionResult> Post([FromBody] AssessmentRequest model)
        {
            var assessment = await _context.Assessment.Where(x => x.Year.Equals(model.SADAssessmentYear) && x.AssessmentSerial.Equals(model.SADAssessmentSerial) && x.AssessmentNumber.Equals(model.SADAssessmentNumber)).ToListAsync();

            var currentVerson = assessment.LastOrDefault();

            if (currentVerson != null)
            {
                AssessmentResponse response = _mapper.Map <AssessmentResponse>(currentVerson);
                response.Taxes = await _context.Tax.Where(x => x.AssessmentId.Equals(currentVerson.Id)).ToListAsync();

                return(Ok(new { status = HttpStatusCode.OK, Message = "Request completed", Data = response }));
            }

            return(NotFound(new { status = HttpStatusCode.NotFound, Message = "Resource not found" }));
        }
Пример #6
0
        protected override void Initialize()
        {
            base.Initialize();
            try
            {
                gAssessmentID = Convert.ToInt32(this.DecryptQueryString(Request.QueryString["value"], "AssessmentID"));
            }
            catch (Exception)
            {
                gAssessmentID = -1;
                return;
            }

            try
            {
                gAssessmentRespID = Convert.ToInt32(this.DecryptQueryString(Request.QueryString["value"], "AssessmentRespID"));
            }
            catch (Exception)
            {
                gAssessmentRespID = -1;
            }


            gAssessment_br = new BusinessRules.OP_Assessment(BSWSession.SessionID, BSWSession.UserID);
            gLookUp        = new BusinessRules.OP_LookUp(BSWSession.SessionID, BSWSession.UserID);


            listResponses = new List <AssessmentItemResponse>();
            if (gAssessmentRespID > 0)
            {
                //load old responses
                AssessmentResponse objResp = gAssessment_br.GetAssessmentResponse(BSWSession.UserID, gAssessmentRespID, null);

                listResponses       = OP_Assessment.GetItemResponsesByAssessmentRespID(gAssessmentRespID);
                gIsAssessmentClosed = !objResp.IsCurent;

                if (gIsAssessmentClosed)
                {
                    btnDeleteAssessmentResponse.Visible = true;
                }
            }
            else
            {
                gIsAssessmentClosed = false;
            }
        }
Пример #7
0
        public async Task <IActionResult> thisAss(Guid assessmentId)
        {
            try
            {
                Assessment getAss = await _context.Assessment
                                    .Include(r => r.AssessmentType)
                                    .FirstOrDefaultAsync(x => x.Id.Equals(assessmentId));

                if (getAss != null)
                {
                    PaymentLog getPaymentLog = await _context.Payment.Where(x => x.AssessmentId == getAss.Id.ToString()).FirstOrDefaultAsync();

                    if (getPaymentLog == null)
                    {
                        return(NotFound(new { status = HttpStatusCode.NotFound, Message = $"No payment generated for assesment {assessmentId}" }));
                    }

                    AssessmentResponse response = _mapper.Map <AssessmentResponse>(getAss);
                    Log.Information($"Processstatus id: {getPaymentLog.StatusId} and transactio reference {getPaymentLog.PaymentReference}");
                    return(Ok(new
                    {
                        status = HttpStatusCode.OK,
                        Message = "Request Successful",
                        data = new
                        {
                            Details = response,
                            PaymentReference = getPaymentLog.PaymentReference,
                            ProcessStatus = Enum.GetName(typeof(TransactionStatus), getPaymentLog.StatusId),
                            TransactionStatus = Enum.GetName(typeof(TransactionStatus), getPaymentLog.TransactionStatusId),
                            Comment = getPaymentLog.Comment
                        }
                    }));
                }
                return(NotFound(new { status = HttpStatusCode.NotFound, Message = "Request Successful", data = "Resource not found" }));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { status = HttpStatusCode.InternalServerError, Message = "An error occured", data = ex }));
            }
        }
Пример #8
0
        protected void gridResponse_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            String       MilestoneID  = Session["MilestoneID"].ToString();
            String       ItemID       = Session["CriteriaId"].ToString();
            ASPxGridView gridResponse = (ASPxGridView)sender;
            //ASPxComboBox AssessmentValue = (ASPxComboBox)gridResponse.FindEditFormLayoutItemTemplateControl("dropAssessment");
            ASPxHtmlEditor txResponse = (ASPxHtmlEditor)gridResponse.FindEditFormLayoutItemTemplateControl("txResponse");

            AssessmentResponse NewResponse = new AssessmentResponse
            {
                MilestoneID = Guid.Parse(Session["MilestoneID"].ToString()),
                ItemKey     = Guid.Parse(ItemID),
                Assesment   = e.NewValues["Assesment"].ToString(),
                Response    = txResponse.Html
            };

            rc_services.InsertNewResponse(NewResponse);
            e.Cancel = true;
            gridResponse.DataSource = rc_services.GetResponse(Guid.Parse(ItemID), MilestoneID);
            gridResponse.DataBind();
            gridResponse.CancelEdit();
        }
Пример #9
0
        public void BindForm()
        {
            //bind the dropdown
            if (AllowAssessment == true)
            {
                dropAssessment.DataSource = common_services.GetCustomDropDown("response");
                dropAssessment.DataBind();
            }



            //First check to see if MIlestones are allowed/needed in the first place, if not, just set it null
            //If widget is set to static milestones, hide dropdown and set MIlestoneID property based on rootParameter given by Root.Master.
            // If the parameter is not given, then this is a page that does not require milestones
            //If it is fluid, then make the dropdown visible, select the last value selected if available, and set MIlestoneID=dro
            if (AllowMilestone == true)
            {
                if (StaticMilestone == true)
                {
                    dropMilestone.Visible = false;
                    if (Session["MilestoneID"] != null)
                    {
                        MilestoneID = Session["MilestoneID"].ToString();
                    }
                    //else // If it hasn't been set, it means this page does not use MIlestones - set null
                    //{
                    //    MilestoneID = null;
                    //}
                }
                else
                {
                    dropMilestone.DataSource = common_services.GetFluidMilestones();
                    dropMilestone.DataBind();

                    dropMilestone.Visible = true;
                    if (rootParameters.Contains("SelectedMilestone"))
                    {
                        try {
                            dropMilestone.SelectedIndex = Convert.ToInt32(rootParameters["SelectedMilestone"]);
                            MilestoneID = (string)dropMilestone.SelectedItem.Value;
                        }
                        catch { }
                    }
                    else
                    {
                        //at this point we know the page needs a milestone, and it is fluid, yet there is no value.
                        // this means the user has not picked one yet, so we just pick the first milestone because
                        // the Stored Procedure inserts if it select returns null, and we don't want to insert with MIlestoneID=null if MIlestone is required..
                        try
                        {
                            MilestoneID = (string)dropMilestone.Items[0].Value;
                        }
                        catch { }
                    }
                }
            }
            else
            {
                MilestoneID = null;
            }


            //Now bind that response based on milestone

            AssessmentResponse Response = new AssessmentResponse();

            // Response = rc_services.GetResponse(Guid.Parse(ItemKey), MilestoneID);
            txResponse.Html      = Response.Response;
            dropAssessment.Value = Response.Assesment;
            AssessmentValue      = Response.Assesment;
            ResponseID           = Response.ResponseID.ToString();

            dropMilestone.SelectedItem  = dropMilestone.Items.FindByValue(MilestoneID);
            dropAssessment.SelectedItem = dropAssessment.Items.FindByValue(Response.Assesment);
        }