Esempio n. 1
0
        /// <summary>
        /// This method is used to Get SDV Details By SDV Id
        /// </summary>
        /// <param name="SDVDetailsId"></param>
        /// <returns></returns>
        public List <DCSDVDetails> GetSDVDetailsBySDVId(int SDVDetailsId)
        {
            try
            {
                objDatabaseHelper = new DatabaseHelper();
                lstDCSDVDetails   = new List <DCSDVDetails>();
                objDatabaseHelper.AddParameter("pSDVDetailsId", SDVDetailsId == 0 ? DBNull.Value : (object)SDVDetailsId);

                DbDataReader reader = objDatabaseHelper.ExecuteReader(BLDBRoutines.SP_GETQUESTIONSBYSDVDETAILSID, CommandType.StoredProcedure);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        objDCSDVDetails = new DCSDVDetails();
                        objDCSDVDetails.SDVDetailsId = reader.IsDBNull(reader.GetOrdinal("SDVDetailsId")) ? 0 : reader.GetInt32(reader.GetOrdinal("SDVDetailsId"));
                        objDCSDVDetails.Description  = reader.IsDBNull(reader.GetOrdinal("Description")) ? string.Empty : reader.GetString(reader.GetOrdinal("Description"));
                        objDCSDVDetails.SectionId    = reader.IsDBNull(reader.GetOrdinal("SectionId")) ? 0 : reader.GetInt32(reader.GetOrdinal("SectionId"));
                        lstDCSDVDetails.Add(objDCSDVDetails);
                    }
                }
                return(lstDCSDVDetails);
            }
            catch (Exception exec)
            {
                throw exec;
            }
            finally
            {
                if (objDatabaseHelper != null)
                {
                    objDatabaseHelper.Dispose();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This method is used to Get SDV Details
        /// </summary>
        /// <param name="SectionId"></param>
        /// <param name="RiskScoreId"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public List <DCSDVDetails> GetSDVDetails(int SectionId, int UserId, int intRefKey)
        {
            try
            {
                objDatabaseHelper = new DatabaseHelper();
                lstDCSDVDetails   = new List <DCSDVDetails>();
                objDatabaseHelper.AddParameter("pSectionId", SectionId == 0 ? DBNull.Value : (object)SectionId);
                objDatabaseHelper.AddParameter("pUserID", UserId == 0 ? DBNull.Value : (object)UserId);
                objDatabaseHelper.AddParameter("pRefKey", intRefKey == 0 ? DBNull.Value : (object)intRefKey);

                DbDataReader reader = objDatabaseHelper.ExecuteReader(BLDBRoutines.SP_GETSDVDETAILS, CommandType.StoredProcedure);
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        objDCSDVDetails = new DCSDVDetails();
                        objDCSDVDetails.SDVDetailsId = reader.IsDBNull(reader.GetOrdinal("SDVDetailsId")) ? 0 : reader.GetInt32(reader.GetOrdinal("SDVDetailsId"));
                        objDCSDVDetails.SectionId    = reader.IsDBNull(reader.GetOrdinal("SectionId")) ? 0 : reader.GetInt32(reader.GetOrdinal("SectionId"));
                        objDCSDVDetails.RiskScoreId  = reader.IsDBNull(reader.GetOrdinal("RiskScoreId")) ? string.Empty : reader.GetString(reader.GetOrdinal("RiskScoreId"));
                        objDCSDVDetails.RefKey       = reader.IsDBNull(reader.GetOrdinal("RefKey")) ? 0 : reader.GetInt32(reader.GetOrdinal("RefKey"));
                        objDCSDVDetails.SectionName  = reader.IsDBNull(reader.GetOrdinal("SectionName")) ? string.Empty : reader.GetString(reader.GetOrdinal("SectionName"));
                        //objDCSDVDetails.DOCReview = reader.IsDBNull(reader.GetOrdinal("DOCReview")) ? string.Empty : reader.GetString(reader.GetOrdinal("DOCReview"));
                        //objDCSDVDetails.MAT = reader.IsDBNull(reader.GetOrdinal("MAT")) ? 0 : reader.GetInt32(reader.GetOrdinal("MAT"));
                        objDCSDVDetails.RiskSerialId     = reader.IsDBNull(reader.GetOrdinal("RiskSerialId")) ? 0 : reader.GetInt32(reader.GetOrdinal("RiskSerialId"));
                        objDCSDVDetails.UserId           = reader.IsDBNull(reader.GetOrdinal("UserId")) ? 0 : reader.GetInt32(reader.GetOrdinal("UserId"));
                        objDCSDVDetails.AssessmentType   = reader.IsDBNull(reader.GetOrdinal("AssessmentType")) ? string.Empty : reader.GetString(reader.GetOrdinal("AssessmentType"));
                        objDCSDVDetails.AssessmentTypeId = reader.IsDBNull(reader.GetOrdinal("AssessmentTypeId")) ? 0 : reader.GetInt32(reader.GetOrdinal("AssessmentTypeId"));
                        lstDCSDVDetails.Add(objDCSDVDetails);
                    }
                }
                return(lstDCSDVDetails);
            }
            catch (Exception exec)
            {
                throw exec;
            }
            finally
            {
                if (objDatabaseHelper != null)
                {
                    objDatabaseHelper.Dispose();
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// This method is used to Add Update SDV Details
 /// </summary>
 /// <param name="objDCSDVDetails"></param>
 /// <param name="XMLDate"></param>
 /// <returns></returns>
 public DataOperationResponse AddUpdateSDVDetails(string XMLData, int intUserId)
 {
     objDatabaseHelper        = new DatabaseHelper();
     objDataOperationResponse = new DataOperationResponse();
     try
     {
         objDatabaseHelper        = new DatabaseHelper();
         objDataOperationResponse = new DataOperationResponse();
         objDatabaseHelper.AddParameter("pUserId", intUserId == 0 ? DBNull.Value : (object)intUserId);
         objDatabaseHelper.AddParameter("pSDVXMLData", XMLData == string.Empty ? DBNull.Value : (object)XMLData);
         objDatabaseHelper.AddParameter("oRegisterMessage", string.Empty, ParameterDirection.Output);
         int    result     = objDatabaseHelper.ExecuteNonQuery(BLDBRoutines.SP_ADDUPDATESDVDETAILS, CommandType.StoredProcedure);
         string strMessage = Convert.ToString(objDatabaseHelper.Command.Parameters["oRegisterMessage"].Value);
         if (result >= 0)
         {
             objDCSDVDetails = new DCSDVDetails();
             objDataOperationResponse.Code    = GetSuccessCode;
             objDataOperationResponse.Message = strMessage;
         }
         else
         {
             objDataOperationResponse.Code    = GetErrorCode;
             objDataOperationResponse.Message = "Unable to add";
         }
         return(objDataOperationResponse);
     }
     catch (Exception exc)
     {
         throw exc;
     }
     finally
     {
         if (objDatabaseHelper != null)
         {
             objDatabaseHelper.Dispose();
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// This method is used for Add Update SDV Details
        /// </summary>
        /// <param name="objDCSDVDetails"></param>
        /// <param name="frmColl"></param>
        /// <returns></returns>
        public ActionResult AddUpdateSDVDetails(FormCollection frmColl)
        {
            objDCUsers = (DCUsers)Session["UserLogon"];
            objDataOperationResponse = new DataOperationResponse();
            objDCSDVDetails          = new DCSDVDetails();

            if (Session["UserLogon"] != null)
            {
                objBLSDVDetails = new BLSDVDetails();

                StringBuilder strBuilder = new StringBuilder();
                strBuilder.Append("<SDVDetails>");


                //if (!string.IsNullOrEmpty(frmColl["hdnRiskScoreId"]))
                //{
                strBuilder.Append("<RiskLevels>");
                if (frmColl["hdnRisk_0_ScoreId"] == "0")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_0_ScoreId"] + "</RiskId>");
                    //strBuilder.Append("<WAC>" + frmColl["txtWAC"] + "</WAC>");
                    //strBuilder.Append("<DOCReview>" + frmColl["txtDocReview"] + "</DOCReview>");
                    //strBuilder.Append("<MAT>" + frmColl["ddlRisk0MAT"] + "</MAT>");
                    //strBuilder.Append("<SDV>" + frmColl["ddlRisk0SDRSDV"] + "</SDV>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_0_Id"] + "</SDVDetailsId>");

                    string[] questionIds = frmColl["hdn_risk0_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }


                if (frmColl["hdnRisk_1_ScoreId"] == "1")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_1_ScoreId"] + "</RiskId>");
                    //strBuilder.Append("<WAC>" + frmColl["txtWAC"] + "</WAC>");
                    //strBuilder.Append("<DOCReview>" + frmColl["txtDocReview"] + "</DOCReview>");
                    //strBuilder.Append("<MAT>" + frmColl["ddlRisk1MAT"] + "</MAT>");
                    //strBuilder.Append("<SDV>" + frmColl["ddlRisk1SDRSDV"] + "</SDV>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_1_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk1_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                if (frmColl["hdnRisk_2_ScoreId"] == "2")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_2_ScoreId"] + "</RiskId>");
                    //strBuilder.Append("<WAC>" + frmColl["txtWAC"] + "</WAC>");
                    //strBuilder.Append("<DOCReview>" + frmColl["txtDocReview"] + "</DOCReview>");
                    //strBuilder.Append("<MAT>" + frmColl["ddlRisk2MAT"] + "</MAT>");
                    //strBuilder.Append("<SDV>" + frmColl["ddlRisk2SDRSDV"] + "</SDV>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_2_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk2_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                if (frmColl["hdnRisk_3_ScoreId"] == "3")
                {
                    strBuilder.Append("<Risk>");

                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_3_ScoreId"] + "</RiskId>");
                    //strBuilder.Append("<WAC>" + frmColl["txtWAC"] + "</WAC>");
                    //strBuilder.Append("<DOCReview>" + frmColl["txtDocReview"] + "</DOCReview>");
                    //strBuilder.Append("<MAT>" + frmColl["ddlRisk3MAT"] + "</MAT>");
                    //strBuilder.Append("<SDV>" + frmColl["ddlRisk3SDRSDV"] + "</SDV>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_3_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk3_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                if (frmColl["hdnRisk_4_ScoreId"] == "4")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_4_ScoreId"] + "</RiskId>");
                    //strBuilder.Append("<WAC>" + frmColl["txtWAC"] + "</WAC>");
                    //strBuilder.Append("<DOCReview>" + frmColl["txtDocReview"] + "</DOCReview>");
                    //strBuilder.Append("<MAT>" + frmColl["ddlRisk4MAT"] + "</MAT>");
                    //strBuilder.Append("<SDV>" + frmColl["ddlRisk4SDRSDV"] + "</SDV>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_4_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk4_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                if (frmColl["hdnRisk_5_ScoreId"] == "5")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_5_ScoreId"] + "</RiskId>");
                    //strBuilder.Append("<WAC>" + frmColl["txtWAC"] + "</WAC>");
                    //strBuilder.Append("<DOCReview>" + frmColl["txtDocReview"] + "</DOCReview>");
                    //strBuilder.Append("<MAT>" + frmColl["ddlRisk5MAT"] + "</MAT>");
                    //strBuilder.Append("<SDV>" + frmColl["ddlRisk5SDRSDV"] + "</SDV>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_5_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk5_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }
                //22/03/2018 start
                //First visit
                if (frmColl["hdnRisk_6_ScoreId"] == "First Visit")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_6_ScoreId"] + "</RiskId>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_6_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk6_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                //Last Visit
                if (frmColl["hdnRisk_7_ScoreId"] == "Last Visit")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_7_ScoreId"] + "</RiskId>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_7_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk7_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                //QUA
                if (frmColl["hdnRisk_8_ScoreId"] == "QUA")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_8_ScoreId"] + "</RiskId>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_8_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk8_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }

                //QOV
                if (frmColl["hdnRisk_9_ScoreId"] == "QOV")
                {
                    strBuilder.Append("<Risk>");
                    strBuilder.Append("<SectionId>" + Convert.ToInt32(frmColl["hdnSectionId"]) + "</SectionId>");
                    strBuilder.Append("<AssessmentTypeId>" + frmColl["ddlAssessmentType"] + "</AssessmentTypeId>");
                    strBuilder.Append("<RiskId>" + frmColl["hdnRisk_9_ScoreId"] + "</RiskId>");
                    strBuilder.Append("<SDVDetailsId>" + frmColl["hdnSDVDetails_9_Id"] + "</SDVDetailsId>");
                    string[] questionIds = frmColl["hdn_risk9_QustIds[]"].Split(',');
                    strBuilder.Append("<Questions>");
                    foreach (var questionId in questionIds)
                    {
                        strBuilder.Append("<QuestionId>" + questionId + "</QuestionId>");
                    }
                    strBuilder.Append("</Questions>");
                    strBuilder.Append("</Risk>");
                }
                //22/03/2018 end
                strBuilder.Append("</RiskLevels>");
                //}
                strBuilder.Append("</SDVDetails>");

                string XMLData = strBuilder.ToString();

                objDataOperationResponse = objBLSDVDetails.AddUpdateSDVDetails(XMLData, objDCUsers.UserId);
                if (objDataOperationResponse.Code > 0)
                {
                    TempData["successMessage"] = objDataOperationResponse.Message;
                    //return View("ViewSDVDetails");
                    return(Redirect("~/SDVDetails/ViewSDVDetails"));
                }
                else
                {
                    TempData["errorMessage"] = objDataOperationResponse.Message;
                    //return View("ViewSDVDetails");
                    return(Redirect("~/SDVDetails/ViewSDVDetails"));
                }
            }
            return(Redirect("~/SDVDetails/ViewSDVDetails"));
        }