Facebook
From easwar, 1 Week ago, written in C#.
Embed
Download Paste or View Raw
Hits: 232
  1. //Controller
  2.   [Route("~/api/REmaapClassicView/UpdateRecordFeedback")]
  3.         [HttpPost]
  4.         public string UpdateRecordFeedback(JObject RecordfdJsonvalue)
  5.         {
  6.             string StrResult = string.Empty;
  7.             strIPAddressError = IsallowedIPAddress();
  8.             try
  9.             {
  10.                 if (strIPAddressError.ToUpper() == "TRUE")
  11.                 {
  12.                     StrResult = _BLL.UpdateRecordFeedback(RecordfdJsonvalue);
  13.                 }
  14.                 else
  15.                 {
  16.                     return strIPAddressError;
  17.                 }
  18.             }
  19.             catch (Exception ex)
  20.             {
  21.                 Log.WriteLog(ex, _logdetails);
  22.             }
  23.             return StrResult;
  24.         }
  25.         [Route("~/api/REmaapClassicView/DeleteRecordFeedback")]
  26.         [HttpPost]
  27.         public string DeleteRecordFeedback(string Pkey)
  28.         {
  29.             string StrResult = string.Empty;
  30.             strIPAddressError = IsallowedIPAddress();
  31.             try
  32.             {
  33.                 if (strIPAddressError.ToUpper() == "TRUE")
  34.                 {
  35.                     StrResult = _BLL.DeleteRecordFeedback(Pkey);
  36.                 }
  37.                 else
  38.                 {
  39.                     return strIPAddressError;
  40.                 }
  41.             }
  42.             catch (Exception ex)
  43.             {
  44.                 Log.WriteLog(ex, _logdetails);
  45.             }
  46.             return StrResult;
  47.         }
  48.  
  49.  
  50.  
  51. //business layer
  52.  public string UpdateRecordFeedback(JObject RecordfdJsonvalue)
  53.         {
  54.             string Status = string.Empty;
  55.             string Msg = string.Empty;
  56.             string strResult = string.Empty;
  57.             string strProjectKey = string.Empty, strPkey = string.Empty, strSectionkey = string.Empty, strLeasekey = string.Empty, fkeyFeedbacksource = string.Empty,
  58.             strUserKey = string.Empty, fkeyFeedbacktype = string.Empty, feedbackDescription = string.Empty, feedbackResponsecomments = string.Empty,
  59.              strReporteddate = string.Empty;
  60.  
  61.             List<string> lstQuery = new List<string>();
  62.             try
  63.             {
  64.                 dynamic JSONValue = JArray.Parse("[" + RecordfdJsonvalue + "]");
  65.                 DBConnection dbcMaster = new DBConnection(_configuration.GetSection("REmaapSettings").GetSection("MasterConnectionString").Value);
  66.                 if (JSONValue.Count > 0)
  67.                 {
  68.                     strPkey = Convert.ToString(JSONValue[0].strPkey);
  69.                     //strProjectKey = Convert.ToString(JSONValue[0].strProjectKey);
  70.                     //strLeasekey = Convert.ToString(JSONValue[0].strLeasekey);
  71.                     strSectionkey = Convert.ToString(JSONValue[0].strSectionkey);                    
  72.                     fkeyFeedbacksource = Convert.ToString(JSONValue[0].fkeyFeedbacksource);
  73.                     fkeyFeedbacktype = Convert.ToString(JSONValue[0].fkeyFeedbacktype);
  74.                     strReporteddate = Convert.ToString(JSONValue[0].strReporteddate);
  75.                     feedbackDescription = Convert.ToString(JSONValue[0].feedbackDescription);
  76.                     feedbackResponsecomments = Convert.ToString(JSONValue[0].feedbackResponsecomments);
  77.                     strUserKey = Convert.ToString(JSONValue[0].modifiedby);
  78.                 }
  79.                 if (!string.IsNullOrEmpty(strPkey) && !string.IsNullOrEmpty(strSectionkey) && !string.IsNullOrEmpty(feedbackDescription)
  80.                     && !string.IsNullOrEmpty(strUserKey) && !string.IsNullOrEmpty(strReporteddate))
  81.                 {                    
  82.                     lstQuery.Add("UPDATE Report_Feedback_Details SET FKEY_SECTIONKEY = '" + strSectionkey + "',FKEY_FEEDBACK_SOURCE = '" + fkeyFeedbacksource + "',FKEY_FEEDBACK_TYPE = '" + fkeyFeedbacktype +
  83.                                     "',REPORTED_DATE = '" + strReporteddate + "',FEEDBACK_DESCRIPTION ='" + _DAL.stripQuotes(feedbackDescription) + "'," +
  84.                                     "FEEDBACK_RESPONSE_COMMENTS = '" + _DAL.stripQuotes(feedbackResponsecomments) + "',Modified_By = '" + strUserKey + "',Modified_On = NOW() WHERE PKEY = '" + strPkey + "'");
  85.                     if (lstQuery.Count > 0)
  86.                     {
  87.                         dbcMaster.executeNonQuery(lstQuery.ToArray());
  88.                         Status = "\"Status\" : " + "\"Success\"";
  89.                         Msg = "\"Message\" : \"Updated Succesfully\"";
  90.                     }
  91.                 }
  92.                 else
  93.                 {
  94.                     Status = "\"Status\" : " + "\"Error\"";
  95.                     Msg = "\"Message\" : \"Error on Updating the Values\"";
  96.                 }
  97.             }
  98.  
  99.             catch (Exception ex)
  100.             {
  101.                 _logDetails.strprojkey = strProjectKey;
  102.                 Log.WriteLog(ex, _logDetails);
  103.                 Status = "\"Status\" : " + "\"Error\"";
  104.                 Msg = "\"Message\" : \"" + ex.Message.ToString() + "\"";
  105.             }
  106.             strResult = "{" + Status + "," + Msg + "}";
  107.             return strResult;
  108.         }
  109.  
  110.         public string DeleteRecordFeedback(string Pkey)
  111.         {
  112.             string Status = string.Empty;
  113.             string Msg = string.Empty;
  114.             string strResult = string.Empty;
  115.             List<string> lstQuery = new List<string>();
  116.             DBConnection dbcMaster = new DBConnection(_configuration.GetSection("REmaapSettings").GetSection("MasterConnectionString").Value);
  117.             try
  118.             {
  119.                 string RecordPkey = Pkey;
  120.                 if (!string.IsNullOrEmpty(RecordPkey))
  121.                 {
  122.                     lstQuery.Add(" DELETE FROM report_feedback_details WHERE pkey ='" + RecordPkey + "' ");
  123.                     if (lstQuery.Count > 0)
  124.                     {
  125.                         dbcMaster.executeNonQuery(lstQuery.ToArray());
  126.                         Status = "\"Status\" : " + "\"Success\"";
  127.                         Msg = "\"Message\" : \"Deleted Succesfully\"";
  128.                     }
  129.                 }
  130.                 else
  131.                 {
  132.                     Status = "\"Status\" : " + "\"Error\"";
  133.                     Msg = "\"Message\" : \"Error on Deleting the records\"";
  134.                 }
  135.  
  136.  
  137.             }
  138.             catch(Exception ex)
  139.             {
  140.                 Log.WriteLog(ex, _logDetails);
  141.                 Status = "\"Status\" : " + "\"Error\"";
  142.                 Msg = "\"Message\" : \"" + ex.Message.ToString() + "\"";
  143.             }
  144.             strResult = "{" + Status + "," + Msg + "}";
  145.             return strResult;
  146.         }