Commit 527475416b0eb5a85abeba5bda4cfa4da70d97d6

Authored by Amrita Vishnoi
1 parent e6280cee

removed empty functions

400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs
@@ -7,8 +7,8 @@ using System.Web.Http; @@ -7,8 +7,8 @@ using System.Web.Http;
7 using AIAHTML5.API.Constants; 7 using AIAHTML5.API.Constants;
8 using AIAHTML5.API.Models; 8 using AIAHTML5.API.Models;
9 using AIAHTML5.API.Utility; 9 using AIAHTML5.API.Utility;
10 -using log4net;  
11 -using System.Collections; 10 +using log4net;
  11 +using System.Collections;
12 using System.Data.SqlClient; 12 using System.Data.SqlClient;
13 13
14 namespace AIAHTML5.API.Controllers 14 namespace AIAHTML5.API.Controllers
@@ -33,64 +33,55 @@ namespace AIAHTML5.API.Controllers @@ -33,64 +33,55 @@ namespace AIAHTML5.API.Controllers
33 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); 33 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
34 logger.Debug("inside POST in UnblockUserController for emailId = " + emailId); 34 logger.Debug("inside POST in UnblockUserController for emailId = " + emailId);
35 35
36 - HttpResponseMessage response = null;  
37 - Newtonsoft.Json.Linq.JObject userInfo = new Newtonsoft.Json.Linq.JObject();  
38 - userInfo.Add("emailId", emailId);  
39 -  
40 - try  
41 - {  
42 - User user = AIAHTML5.API.Models.DBModel.GetUserDetailsByEmailId(emailId);  
43 -  
44 - if (user!=null)  
45 - {  
46 - int result = 0;  
47 -  
48 - logger.Debug("1. inside if in UnblockUserController userDetails= " + user.ToString());  
49 -  
50 - result = AIAHTML5.API.Models.DBModel.UnblockUser(user.Id);  
51 -  
52 - if (result > 0)  
53 - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_UNBLOCK_SUCCESS) };  
54 - else  
55 - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.UNABLE_TO_UNBLOCK) };  
56 - }  
57 - return response;  
58 - }  
59 - catch (SqlException e)  
60 - {  
61 -  
62 - logger.Fatal("SqlException occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);  
63 -  
64 - ArrayList supportMailList = UserUtility.GetSupportMailList();  
65 - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT;  
66 - string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;  
67 - UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);  
68 -  
69 - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };  
70 - }  
71 - catch (Exception e)  
72 - {  
73 - // logger.Fatal("Exception occured for loginId =" + userInfo["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);  
74 - logger.Fatal("Exception occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);  
75 -  
76 - ArrayList supportMailList = UserUtility.GetSupportMailList();  
77 - string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;  
78 - string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;  
79 - UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);  
80 - response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) };  
81 - return response; 36 + HttpResponseMessage response = null;
  37 + Newtonsoft.Json.Linq.JObject userInfo = new Newtonsoft.Json.Linq.JObject();
  38 + userInfo.Add("emailId", emailId);
  39 +
  40 + try
  41 + {
  42 + User user = AIAHTML5.API.Models.DBModel.GetUserDetailsByEmailId(emailId);
  43 +
  44 + if (user!=null)
  45 + {
  46 + int result = 0;
  47 +
  48 + logger.Debug("1. inside if in UnblockUserController userDetails= " + user.ToString());
  49 +
  50 + result = AIAHTML5.API.Models.DBModel.UnblockUser(user.Id);
  51 +
  52 + if (result > 0)
  53 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.USER_UNBLOCK_SUCCESS) };
  54 + else
  55 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.UNABLE_TO_UNBLOCK) };
  56 + }
  57 + return response;
82 } 58 }
83 -  
84 - } 59 + catch (SqlException e)
  60 + {
85 61
86 - // PUT api/unblockuser/5  
87 - public void Put(int id, [FromBody]string value)  
88 - {  
89 - } 62 + logger.Fatal("SqlException occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
90 63
91 - // DELETE api/unblockuser/5  
92 - public void Delete(int id)  
93 - { 64 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  65 + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT;
  66 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  67 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  68 +
  69 + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.SQL_CONNECTION_ERROR) };
  70 + }
  71 + catch (Exception e)
  72 + {
  73 +
  74 + logger.Fatal("Exception occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace);
  75 +
  76 + ArrayList supportMailList = UserUtility.GetSupportMailList();
  77 + string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT;
  78 + string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace;
  79 + UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody);
  80 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) };
  81 + return response;
  82 + }
  83 +
94 } 84 }
  85 +
95 } 86 }
96 } 87 }
97 \ No newline at end of file 88 \ No newline at end of file