Commit 5b6f7c60aa410fb631478de5a7619e4b12913912
1 parent
832feceb
Committing updated files
Showing
14 changed files
with
547 additions
and
77 deletions
150-DOCUMENTATION/002-DBScripts/AddSlugColumnInResourceModuleTable.sql
0 โ 100644
1 | +USE AIADATABASEV5LIVE | |
2 | +ALTER TABLE ResourceModule | |
3 | + ADD Slug varchar(100); | |
4 | + | |
5 | +UPDATE ResourceModule SET SLUG= 'da-view-list' WHERE ID=1 | |
6 | +UPDATE ResourceModule SET SLUG= 'tile-view-list' WHERE ID=2 | |
7 | +UPDATE ResourceModule SET SLUG= '3d-anatomy-list' WHERE ID=3 | |
8 | +UPDATE ResourceModule SET SLUG= 'clinical-illustrations' WHERE ID=4 | |
9 | +UPDATE ResourceModule SET SLUG= 'clinical-animations' WHERE ID=5 | |
10 | +UPDATE ResourceModule SET SLUG= 'Link/encyclopedia' WHERE ID=6 | |
11 | +UPDATE ResourceModule SET SLUG= 'curriculum-builder' WHERE ID=7 | |
12 | +UPDATE ResourceModule SET SLUG= 'anatomy-test' WHERE ID=8 | |
13 | +UPDATE ResourceModule SET SLUG= 'Link/IP-10' WHERE ID=9 | |
14 | +UPDATE ResourceModule SET SLUG= 'lab-exercises' WHERE ID=10 | |
15 | +UPDATE ResourceModule SET SLUG= 'Link/indepth-reports' WHERE ID=11 | |
16 | +UPDATE ResourceModule SET SLUG= 'Link/complementary-and-alternate-medicine' WHERE ID=12 | |
17 | +UPDATE ResourceModule SET SLUG= 'ADAM-images' WHERE ID=13 | |
18 | +UPDATE ResourceModule SET SLUG= 'Link/bodyguide' WHERE ID=14 | |
19 | +UPDATE ResourceModule SET SLUG= 'Link/health-navigator' WHERE ID=15 | |
20 | +UPDATE ResourceModule SET SLUG= 'Link/wellness-tools' WHERE ID=16 | |
21 | +UPDATE ResourceModule SET SLUG= 'Link/aod' WHERE ID=1017 | ... | ... |
150-DOCUMENTATION/002-DBScripts/GetAllAvailableModules.sql
0 โ 100644
1 | +-- ================================================ | |
2 | +-- Template generated from Template Explorer using: | |
3 | +-- Create Procedure (New Menu).SQL | |
4 | +-- | |
5 | +-- Use the Specify Values for Template Parameters | |
6 | +-- command (Ctrl-Shift-M) to fill in the parameter | |
7 | +-- values below. | |
8 | +-- | |
9 | +-- This block of comments will not be included in | |
10 | +-- the definition of the procedure. | |
11 | +-- ================================================ | |
12 | +SET ANSI_NULLS ON | |
13 | +GO | |
14 | +SET QUOTED_IDENTIFIER ON | |
15 | +GO | |
16 | +-- ============================================= | |
17 | +-- Author: <Utkarsh Singh> | |
18 | +-- Create date: <07/18/2017> | |
19 | +-- Description: <Get all available modules for user> | |
20 | +-- ============================================= | |
21 | +CREATE PROCEDURE GetAllAvailableModules | |
22 | + -- Add the parameters for the stored procedure here | |
23 | +AS | |
24 | +BEGIN | |
25 | + -- SET NOCOUNT ON added to prevent extra result sets from | |
26 | + -- interfering with SELECT statements. | |
27 | + SET NOCOUNT ON; | |
28 | + | |
29 | + -- Insert statements for procedure here | |
30 | + SELECT Title AS Name, Slug FROM ResourceModule | |
31 | +END | |
32 | +GO | |
0 | 33 | \ No newline at end of file | ... | ... |
150-DOCUMENTATION/002-DBScripts/GetUserDetailsByLoginIdandPassword.sql
0 โ 100644
1 | +-- ================================================ | |
2 | +-- Template generated from Template Explorer using: | |
3 | +-- Create Procedure (New Menu).SQL | |
4 | +-- | |
5 | +-- Use the Specify Values for Template Parameters | |
6 | +-- command (Ctrl-Shift-M) to fill in the parameter | |
7 | +-- values below. | |
8 | +-- | |
9 | +-- This block of comments will not be included in | |
10 | +-- the definition of the procedure. | |
11 | +-- ================================================ | |
12 | +SET ANSI_NULLS ON | |
13 | +GO | |
14 | +SET QUOTED_IDENTIFIER ON | |
15 | +GO | |
16 | +-- ============================================= | |
17 | +-- Author: <Utkarsh Singh> | |
18 | +-- Create date: <07/18/2017> | |
19 | +-- Description: <Gets user details based on loginId and password> | |
20 | +-- ============================================= | |
21 | +CREATE PROCEDURE GetUserDetailsByLoginIdAndPassword | |
22 | + -- Add the parameters for the stored procedure here | |
23 | + @sLoginId VARCHAR(50), | |
24 | + @sPassword VARCHAR(50) | |
25 | +AS | |
26 | +BEGIN | |
27 | + -- SET NOCOUNT ON added to prevent extra result sets from | |
28 | + -- interfering with SELECT statements. | |
29 | + SET NOCOUNT OFF; | |
30 | + | |
31 | + -- Insert statements for procedure here | |
32 | + SELECT CreationDate, CreatorId, DeactivationDate, EmailId, FirstName, Id, IsActive, LastName, LoginId, ModifiedDate, ModifierId, Password, SecurityAnswer, SecurityQuestionId, UserTypeId FROM AIAUser WHERE (LoginId = @sLoginId) AND (Password = @sPassword) | |
33 | +END | |
34 | +GO | |
0 | 35 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/AIAHTML5.API.csproj
... | ... | @@ -113,6 +113,8 @@ |
113 | 113 | <Compile Include="Global.asax.cs"> |
114 | 114 | <DependentUpon>Global.asax</DependentUpon> |
115 | 115 | </Compile> |
116 | + <Compile Include="Models\DBModel.cs" /> | |
117 | + <Compile Include="Models\User.cs" /> | |
116 | 118 | <Compile Include="Models\UserUtility.cs" /> |
117 | 119 | <Compile Include="Models\Users.cs" /> |
118 | 120 | <Compile Include="Properties\AssemblyInfo.cs" /> | ... | ... |
400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... | ... | @@ -7,11 +7,14 @@ namespace AIAHTML5.API.Constants |
7 | 7 | { |
8 | 8 | public class AIAConstants |
9 | 9 | { |
10 | - public const string ERROR_IN_FECTHING_DETAILS = "Error in fecthing details."; | |
11 | - public const string USER_NOT_FOUND = "User not found."; | |
12 | - public const string MAIL_NOT_SENT = "Mail not sent."; | |
13 | - public const string MAIL_SENT = "Mail sent."; | |
10 | + public const string ERROR_IN_FECTHING_DETAILS = "Error in fecthing details."; | |
11 | + public const string USER_NOT_FOUND = "User not found."; | |
12 | + public const string MAIL_NOT_SENT = "Mail not sent."; | |
13 | + public const string MAIL_SENT = "Mail sent."; | |
14 | 14 | |
15 | - | |
15 | + public const string KEY_ID = "id"; | |
16 | + public const string KEY_TITLE = "title"; | |
17 | + public const string KEY_NAME = "name"; | |
18 | + public const string KEY_SLUG = "slug"; | |
16 | 19 | } |
17 | 20 | } |
18 | 21 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... | ... | @@ -27,15 +27,15 @@ namespace AIAHTML5.API.Controllers |
27 | 27 | |
28 | 28 | // POST api/authenticate |
29 | 29 | public HttpResponseMessage Post([FromBody]JObject credentials) |
30 | - | |
31 | 30 | { |
32 | 31 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
33 | 32 | logger.Debug("inside POST"); |
34 | 33 | |
35 | 34 | bool isUserAuthenticatedByDefault = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["isUserAuthenticated"]); |
36 | - if (isUserAuthenticatedByDefault) { | |
35 | + if (isUserAuthenticatedByDefault) | |
36 | + { | |
37 | 37 | return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("true") }; |
38 | - | |
38 | + | |
39 | 39 | } |
40 | 40 | else |
41 | 41 | { |
... | ... | @@ -43,8 +43,8 @@ namespace AIAHTML5.API.Controllers |
43 | 43 | dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.AuthenticateUser(credentials); |
44 | 44 | if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS) |
45 | 45 | { |
46 | - string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse); | |
47 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) }; | |
46 | + //string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse); | |
47 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; | |
48 | 48 | } |
49 | 49 | else |
50 | 50 | { |
... | ... | @@ -64,4 +64,4 @@ namespace AIAHTML5.API.Controllers |
64 | 64 | { |
65 | 65 | } |
66 | 66 | } |
67 | -} | |
67 | +} | |
68 | 68 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
0 โ 100644
1 | +๏ปฟusing System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Web; | |
5 | +using AIAHTML5.API.Properties; | |
6 | +using AIAHTML5.API.Constants; | |
7 | +using log4net; | |
8 | +using System.Data; | |
9 | +using System.Data.SqlClient; | |
10 | +using Newtonsoft.Json; | |
11 | +using System.Collections; | |
12 | + | |
13 | +namespace AIAHTML5.API.Models | |
14 | +{ | |
15 | + public class DBModel | |
16 | + { | |
17 | + static string dbConnectionString = System.Configuration.ConfigurationManager.AppSettings["AIADatabaseV5Context"]; | |
18 | + | |
19 | + static SqlConnection conn; | |
20 | + static SqlCommand cmd; | |
21 | + | |
22 | + | |
23 | + public DBModel() { } | |
24 | + | |
25 | + public static void OpenConnection() | |
26 | + { | |
27 | + SqlConnection conn = new SqlConnection(dbConnectionString); | |
28 | + | |
29 | + if (conn.State == ConnectionState.Closed) | |
30 | + conn.Open(); | |
31 | + } | |
32 | + | |
33 | + protected static DataSet GetSQLData(string commandText, bool isSp) | |
34 | + { | |
35 | + conn = new SqlConnection(dbConnectionString); | |
36 | + if (isSp) | |
37 | + { | |
38 | + cmd = new SqlCommand(commandText, conn); | |
39 | + cmd.CommandType = CommandType.StoredProcedure; | |
40 | + } | |
41 | + else | |
42 | + { | |
43 | + cmd = new SqlCommand(commandText, conn); | |
44 | + } | |
45 | + SqlDataAdapter da = new SqlDataAdapter(); | |
46 | + da.SelectCommand = cmd; | |
47 | + DataSet ds = new DataSet(); | |
48 | + da.Fill(ds); | |
49 | + return ds; | |
50 | + } | |
51 | + | |
52 | + protected ArrayList GetUserModules() | |
53 | + { | |
54 | + ArrayList arrUserModules = new ArrayList(); | |
55 | + Hashtable userModuleHash = null; | |
56 | + userModuleHash = new Hashtable(); | |
57 | + | |
58 | + string sp = "GetAllAvailableModules"; | |
59 | + | |
60 | + DataSet ds = DBModel.GetSQLData(sp, true); | |
61 | + DataTable dt = ds.Tables[0]; | |
62 | + | |
63 | + foreach (DataRow drActType in dt.Rows) | |
64 | + { | |
65 | + userModuleHash = new Hashtable(); | |
66 | + userModuleHash.Add(AIAConstants.KEY_NAME, drActType["Name"]); | |
67 | + userModuleHash.Add(AIAConstants.KEY_SLUG, drActType["Slug"]); | |
68 | + arrUserModules.Add(userModuleHash); | |
69 | + } | |
70 | + return arrUserModules; | |
71 | + } | |
72 | + | |
73 | + public static dynamic GetUserDetailsByLoginIdAndPassword(string sLoginId, string sPassword) | |
74 | + { | |
75 | + User objUser = new User(); | |
76 | + DBModel objModel = new DBModel(); | |
77 | + | |
78 | + conn = new SqlConnection(dbConnectionString); | |
79 | + cmd = new SqlCommand(); | |
80 | + SqlDataAdapter da = new SqlDataAdapter(); | |
81 | + SqlParameter param; | |
82 | + DataSet ds = new DataSet(); | |
83 | + | |
84 | + cmd.Connection = conn; | |
85 | + cmd.CommandText = "GetUserDetailsByLoginIdAndPassword"; | |
86 | + cmd.CommandType = CommandType.StoredProcedure; | |
87 | + | |
88 | + param = new SqlParameter("@sLoginId", sLoginId); | |
89 | + param.Direction = ParameterDirection.Input; | |
90 | + param.DbType = DbType.String; | |
91 | + cmd.Parameters.Add(param); | |
92 | + | |
93 | + param = new SqlParameter("@sPassword", sPassword); | |
94 | + param.Direction = ParameterDirection.Input; | |
95 | + param.DbType = DbType.String; | |
96 | + cmd.Parameters.Add(param); | |
97 | + | |
98 | + da.SelectCommand = cmd; | |
99 | + DataTable dt = new DataTable(); | |
100 | + da.Fill(dt); | |
101 | + | |
102 | + if (dt.Rows.Count > 0) | |
103 | + { | |
104 | + foreach (DataRow dr in dt.Rows) | |
105 | + { | |
106 | + foreach (DataColumn dc in dt.Columns) | |
107 | + { | |
108 | + if (dc.ColumnName == "Id") | |
109 | + objUser.Id = Convert.ToInt32(dr[dc]); | |
110 | + if (dc.ColumnName == "FirstName") | |
111 | + objUser.FirstName = dr[dc].ToString(); | |
112 | + if (dc.ColumnName == "LastName") | |
113 | + objUser.LastName = dr[dc].ToString(); | |
114 | + if (dc.ColumnName == "EmailId") | |
115 | + objUser.EmailId = dr[dc].ToString(); | |
116 | + if (dc.ColumnName == "LoginId") | |
117 | + objUser.LoginId = dr[dc].ToString(); | |
118 | + if (dc.ColumnName == "Password") | |
119 | + objUser.Password = dr[dc].ToString(); | |
120 | + if (dc.ColumnName == "SecurityQuestionId") | |
121 | + { | |
122 | + int tempVal; | |
123 | + objUser.SecurityQuestionId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null; | |
124 | + } | |
125 | + if (dc.ColumnName == "SecurityAnswer") | |
126 | + objUser.SecurityAnswer = dr[dc].ToString(); | |
127 | + if (dc.ColumnName == "CreatorId") | |
128 | + { | |
129 | + int tempVal; | |
130 | + objUser.CreatorId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null; | |
131 | + } | |
132 | + if (dc.ColumnName == "CreationDate") | |
133 | + objUser.CreationDate = Convert.ToDateTime(dr[dc]); | |
134 | + if (dc.ColumnName == "DeactivationDate") | |
135 | + { | |
136 | + DateTime ddDate; | |
137 | + objUser.DeactivationDate = DateTime.TryParse(dr[dc].ToString(), out ddDate) ? ddDate : (DateTime?)null; | |
138 | + } | |
139 | + if (dc.ColumnName == "ModifierId") | |
140 | + { | |
141 | + int tempVal; | |
142 | + objUser.ModifierId = Int32.TryParse(dr[dc].ToString(), out tempVal) ? tempVal : (int?)null; | |
143 | + } | |
144 | + if (dc.ColumnName == "ModifiedDate") | |
145 | + { | |
146 | + DateTime mdDate; | |
147 | + objUser.ModifiedDate = DateTime.TryParse(dr[dc].ToString(), out mdDate) ? mdDate : (DateTime?)null; | |
148 | + } | |
149 | + if (dc.ColumnName == "UserTypeId") | |
150 | + objUser.UserType = objModel.GetUserTypeStringById(Convert.ToInt32(dr[dc])); | |
151 | + if (dc.ColumnName == "IsActive") | |
152 | + objUser.IsActive = Convert.ToBoolean(dr[dc]); | |
153 | + | |
154 | + } | |
155 | + } | |
156 | + } | |
157 | + | |
158 | + if (objUser.IsActive) | |
159 | + { | |
160 | + | |
161 | + if (objUser != null) | |
162 | + { | |
163 | + if (objUser.UserType == User.SUPER_ADMIN) | |
164 | + { | |
165 | + objUser.Modules = objModel.GetUserModules(); | |
166 | + } | |
167 | + else | |
168 | + { | |
169 | + int licenseId = objModel.GetUserLicenseIdByUserId(objUser.Id); | |
170 | + | |
171 | + if (licenseId != 0) | |
172 | + { | |
173 | + ArrayList allModulesList = objModel.GetUserModules(); | |
174 | + ArrayList licensedModulesList = objModel.GetModuleStatusByLicenseId(licenseId); | |
175 | + | |
176 | + ArrayList userModuleList = objModel.GetUserModulesList(allModulesList, licensedModulesList); | |
177 | + | |
178 | + objUser.Modules = userModuleList; | |
179 | + } | |
180 | + | |
181 | + else | |
182 | + { | |
183 | + objUser.Modules = null; | |
184 | + objUser = null; | |
185 | + } | |
186 | + | |
187 | + } | |
188 | + } | |
189 | + } | |
190 | + else | |
191 | + { | |
192 | + objUser = null; | |
193 | + } | |
194 | + | |
195 | + return objUser; | |
196 | + } | |
197 | + | |
198 | + protected int GetUserLicenseIdByUserId(int iUserId) | |
199 | + { | |
200 | + int _licenseId = 0; | |
201 | + conn = new SqlConnection(dbConnectionString); | |
202 | + cmd = new SqlCommand(); | |
203 | + SqlDataAdapter adapter; | |
204 | + SqlParameter param; | |
205 | + DataSet ds = new DataSet(); | |
206 | + | |
207 | + cmd.Connection = conn; | |
208 | + cmd.CommandText = "GetLicenseIdByUserId"; | |
209 | + cmd.CommandType = CommandType.StoredProcedure; | |
210 | + | |
211 | + param = new SqlParameter("@iUserId", iUserId); | |
212 | + param.Direction = ParameterDirection.Input; | |
213 | + param.DbType = DbType.Int32; | |
214 | + cmd.Parameters.Add(param); | |
215 | + | |
216 | + adapter = new SqlDataAdapter(cmd); | |
217 | + adapter.Fill(ds); | |
218 | + if (ds.Tables[0].Rows.Count > 0) | |
219 | + _licenseId = Convert.ToInt32(ds.Tables[0].Rows[0][0]); | |
220 | + return _licenseId; | |
221 | + } | |
222 | + | |
223 | + protected ArrayList GetModuleStatusByLicenseId(int iLicenseId) | |
224 | + { | |
225 | + ArrayList userModulelist = new ArrayList(); | |
226 | + Hashtable modulesHash; | |
227 | + DataSet ds = new DataSet(); | |
228 | + | |
229 | + conn = new SqlConnection(dbConnectionString); | |
230 | + cmd = new SqlCommand(); | |
231 | + SqlDataAdapter adapter; | |
232 | + SqlParameter param; | |
233 | + | |
234 | + cmd.Connection = conn; | |
235 | + cmd.CommandText = "GetModuleStatusByLicenseId"; | |
236 | + cmd.CommandType = CommandType.StoredProcedure; | |
237 | + | |
238 | + param = new SqlParameter("@iLicenseId", iLicenseId); | |
239 | + param.Direction = ParameterDirection.Input; | |
240 | + param.DbType = DbType.Int32; | |
241 | + cmd.Parameters.Add(param); | |
242 | + | |
243 | + adapter = new SqlDataAdapter(cmd); | |
244 | + adapter.Fill(ds); | |
245 | + DataTable dt = ds.Tables[0]; | |
246 | + | |
247 | + foreach (DataRow dr in dt.Rows) | |
248 | + { | |
249 | + modulesHash = new Hashtable(); | |
250 | + modulesHash.Add("Id", dr["Id"]); | |
251 | + modulesHash.Add("Title", dr["Title"]); | |
252 | + modulesHash.Add("Status", dr["Status"]); | |
253 | + userModulelist.Add(modulesHash); | |
254 | + } | |
255 | + | |
256 | + return userModulelist; | |
257 | + } | |
258 | + | |
259 | + protected ArrayList GetUserModulesList(ArrayList allModules, ArrayList modulesByLicense) | |
260 | + { | |
261 | + ArrayList userModules = new ArrayList(); | |
262 | + Hashtable moduleHash; | |
263 | + foreach (Hashtable all in allModules) | |
264 | + { | |
265 | + string slg = all["slug"].ToString(); | |
266 | + foreach (Hashtable user in modulesByLicense) | |
267 | + { | |
268 | + bool y = Convert.ToBoolean(user["Status"]); | |
269 | + if ((user["Title"].ToString().Trim() == all["name"].ToString().Trim()) && (Convert.ToBoolean(user["Status"]) == true)) | |
270 | + { | |
271 | + moduleHash = new Hashtable(); | |
272 | + moduleHash.Add("name", user["Title"]); | |
273 | + moduleHash.Add("slug", all["slug"]); | |
274 | + | |
275 | + userModules.Add(moduleHash); | |
276 | + } | |
277 | + } | |
278 | + } | |
279 | + | |
280 | + return userModules; | |
281 | + } | |
282 | + | |
283 | + protected string GetUserTypeStringById(int iUserTypeId) | |
284 | + { | |
285 | + string userType = string.Empty; | |
286 | + | |
287 | + switch (iUserTypeId) | |
288 | + { | |
289 | + case 1: | |
290 | + userType = User.SUPER_ADMIN; | |
291 | + break; | |
292 | + case 2: | |
293 | + userType = User.GENERAL_ADMIN; | |
294 | + break; | |
295 | + case 3: | |
296 | + userType = User.DISTRICT_ADMIN; | |
297 | + break; | |
298 | + case 4: | |
299 | + userType = User.CLIENT_ADMIN; | |
300 | + break; | |
301 | + case 5: | |
302 | + userType = User.SINGLE_USER; | |
303 | + break; | |
304 | + case 6: | |
305 | + userType = User.CONCURRENT_USER; | |
306 | + break; | |
307 | + case 7: | |
308 | + userType = User.RESELLER; | |
309 | + break; | |
310 | + case 8: | |
311 | + userType = User.TEST_ACCOUNT; | |
312 | + break; | |
313 | + case 9: | |
314 | + userType = User.SITE_USER; | |
315 | + break; | |
316 | + } | |
317 | + return userType; | |
318 | + } | |
319 | + } | |
320 | +} | |
0 | 321 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/User.cs
0 โ 100644
1 | +๏ปฟusing System; | |
2 | +using System.Collections; | |
3 | +using System.Collections.Generic; | |
4 | +using System.Linq; | |
5 | +using System.Web; | |
6 | + | |
7 | +namespace AIAHTML5.API.Models | |
8 | +{ | |
9 | + public class User | |
10 | + { | |
11 | + public int Id { get; set; } | |
12 | + public string FirstName { get; set; } | |
13 | + public string LastName { get; set; } | |
14 | + public string EmailId { get; set; } | |
15 | + public string LoginId { get; set; } | |
16 | + public string Password { get; set; } | |
17 | + public int? SecurityQuestionId { get; set; } | |
18 | + public string SecurityAnswer { get; set; } | |
19 | + public int? CreatorId { get; set; } | |
20 | + public DateTime CreationDate { get; set; } | |
21 | + public DateTime? DeactivationDate { get; set; } | |
22 | + public int? ModifierId { get; set; } | |
23 | + public DateTime? ModifiedDate { get; set; } | |
24 | + public string UserType { get; set; } | |
25 | + public bool IsActive { get; set; } | |
26 | + | |
27 | + public ArrayList Modules { get; set; } | |
28 | + | |
29 | + public const string SUPER_ADMIN = "Super Admin"; | |
30 | + public const string GENERAL_ADMIN = "General Admin"; | |
31 | + public const string DISTRICT_ADMIN = "District Admin"; | |
32 | + public const string CLIENT_ADMIN = "Client Admin"; | |
33 | + public const string SINGLE_USER = "Single User"; | |
34 | + public const string CONCURRENT_USER = "Concurrent User"; | |
35 | + public const string RESELLER = "Reseller"; | |
36 | + public const string TEST_ACCOUNT = "Test Account"; | |
37 | + public const string SITE_USER = "Site User"; | |
38 | + } | |
39 | +} | |
0 | 40 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
1 | -๏ปฟusing System; | |
1 | +๏ปฟ๏ปฟusing System; | |
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Linq; |
4 | 4 | using System.Web; |
... | ... | @@ -7,39 +7,54 @@ using MongoDB.Bson; |
7 | 7 | using AIAHTML5.API.Properties; |
8 | 8 | using AIAHTML5.API.Constants; |
9 | 9 | using log4net; |
10 | +using AIAHTML5.API.Models; | |
11 | +using Newtonsoft.Json; | |
10 | 12 | |
11 | 13 | namespace AIAHTML5.API.Models |
12 | 14 | { |
13 | 15 | public class Users |
14 | 16 | { |
15 | - | |
16 | - | |
17 | 17 | internal static dynamic AuthenticateUser(Newtonsoft.Json.Linq.JObject credentials) |
18 | 18 | { |
19 | 19 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
20 | 20 | logger.Debug("inside AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString()); |
21 | 21 | try |
22 | 22 | { |
23 | - var client = new MongoClient(); | |
24 | - var db = client.GetDatabase(Settings.Default.database); | |
23 | + //var client = new MongoClient(); | |
24 | + //var db = client.GetDatabase(Settings.Default.database); | |
25 | 25 | |
26 | - var collection = db.GetCollection<dynamic>("Users"); | |
26 | + //var collection = db.GetCollection<dynamic>("Users"); | |
27 | 27 | |
28 | - FilterDefinition<dynamic>[] filterCondition = { Builders<dynamic>.Filter.Eq("loginId", credentials["username"].ToString()), | |
29 | - Builders<dynamic>.Filter.Eq("password", credentials["password"].ToString())}; | |
28 | + //FilterDefinition<dynamic>[] filterCondition = { Builders<dynamic>.Filter.Eq("loginId", credentials["username"].ToString()), | |
29 | + // Builders<dynamic>.Filter.Eq("password", credentials["password"].ToString())}; | |
30 | 30 | |
31 | - dynamic userDetails = collection.Find(Builders<dynamic>.Filter.And(filterCondition)).SingleOrDefault(); | |
31 | + //dynamic userDetails = collection.Find(Builders<dynamic>.Filter.And(filterCondition)).SingleOrDefault(); | |
32 | 32 | |
33 | 33 | |
34 | - if (userDetails != null) | |
34 | + //if (userDetails != null) | |
35 | + //{ | |
36 | + // logger.Debug("userDetails.loginId= " + userDetails.loginId); | |
37 | + // return userDetails; | |
38 | + //} | |
39 | + //else | |
40 | + //{ | |
41 | + // return AIAConstants.USER_NOT_FOUND; | |
42 | + //} | |
43 | + User oUser = DBModel.GetUserDetailsByLoginIdAndPassword(credentials["username"].ToString(), credentials["password"].ToString()); | |
44 | + //string userDetails = DBModel.GetUserDetailsByLoginId2(credentials["username"].ToString()); | |
45 | + | |
46 | + dynamic userDetails; | |
47 | + | |
48 | + if (oUser != null) | |
35 | 49 | { |
36 | - logger.Debug("userDetails.loginId= " + userDetails.loginId); | |
37 | - return userDetails; | |
50 | + logger.Debug("userDetails.loginId= " + oUser.LoginId); // .loginId); | |
51 | + return userDetails = JsonConvert.SerializeObject(oUser); | |
38 | 52 | } |
39 | 53 | else |
40 | 54 | { |
41 | 55 | return AIAConstants.USER_NOT_FOUND; |
42 | 56 | } |
57 | + | |
43 | 58 | } |
44 | 59 | catch (Exception e) |
45 | 60 | { |
... | ... | @@ -55,7 +70,7 @@ namespace AIAHTML5.API.Models |
55 | 70 | internal static dynamic GetUserByEmail(Newtonsoft.Json.Linq.JObject userInfo) |
56 | 71 | { |
57 | 72 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
58 | - logger.Debug(" inside GetUserByEmail for emailId = " + userInfo["emailId"] ); | |
73 | + logger.Debug(" inside GetUserByEmail for emailId = " + userInfo["emailId"]); | |
59 | 74 | var client = new MongoClient(); |
60 | 75 | |
61 | 76 | try |
... | ... | @@ -82,7 +97,7 @@ namespace AIAHTML5.API.Models |
82 | 97 | } |
83 | 98 | catch (Exception e) |
84 | 99 | { |
85 | - logger.Fatal("Exception= " + e.Message+", stacktrace = "+e.StackTrace); | |
100 | + logger.Fatal("Exception= " + e.Message + ", stacktrace = " + e.StackTrace); | |
86 | 101 | return AIAConstants.ERROR_IN_FECTHING_DETAILS; |
87 | 102 | } |
88 | 103 | } |
... | ... | @@ -97,7 +112,7 @@ namespace AIAHTML5.API.Models |
97 | 112 | var collection = db.GetCollection<BsonDocument>("Users"); |
98 | 113 | var filter = Builders<BsonDocument>.Filter.Eq("emailId", userInfo["emailId"].ToString()); |
99 | 114 | var update = Builders<BsonDocument>.Update.Set("password", userInfo["newPassword"].ToString()).CurrentDate("modifiedDate"); |
100 | - | |
115 | + | |
101 | 116 | var result = collection.UpdateOne(filter, update); |
102 | 117 | |
103 | 118 | if (result != null) | ... | ... |
400-SOURCECODE/AIAHTML5.API/Web.config
... | ... | @@ -10,26 +10,26 @@ |
10 | 10 | <section name="AIAHTML5.API.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
11 | 11 | </sectionGroup> |
12 | 12 | </configSections> |
13 | - | |
14 | - <log4net debug="true"> | |
15 | -<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> | |
16 | - <file value="Logs\AIALogs.log" /> | |
17 | - <appendToFile value="true" /> | |
18 | - <rollingStyle value="Size" /> | |
19 | - <maxSizeRollBackups value="10" /> | |
20 | - <maximumFileSize value="10MB" /> | |
21 | - <staticLogFileName value="true" /> | |
22 | - <layout type="log4net.Layout.PatternLayout"> | |
23 | - <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" /> | |
24 | - </layout> | |
25 | -</appender> | |
26 | 13 | |
27 | -<root> | |
28 | - <level value="DEBUG" /> | |
29 | - <appender-ref ref="RollingLogFileAppender" /> | |
30 | -</root> | |
31 | -</log4net> | |
32 | - | |
14 | + <log4net debug="true"> | |
15 | + <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> | |
16 | + <file value="Logs\AIALogs.log" /> | |
17 | + <appendToFile value="true" /> | |
18 | + <rollingStyle value="Size" /> | |
19 | + <maxSizeRollBackups value="10" /> | |
20 | + <maximumFileSize value="10MB" /> | |
21 | + <staticLogFileName value="true" /> | |
22 | + <layout type="log4net.Layout.PatternLayout"> | |
23 | + <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" /> | |
24 | + </layout> | |
25 | + </appender> | |
26 | + | |
27 | + <root> | |
28 | + <level value="DEBUG" /> | |
29 | + <appender-ref ref="RollingLogFileAppender" /> | |
30 | + </root> | |
31 | + </log4net> | |
32 | + | |
33 | 33 | <appSettings> |
34 | 34 | <add key="SenderEmailAddress" value="support@interactiveanatomy.com" /> |
35 | 35 | <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" /> |
... | ... | @@ -39,14 +39,15 @@ |
39 | 39 | <add key="EnableSSL" value="false" /> |
40 | 40 | <add key="Site_Url" value ="http://qa.beta.interactiveanatomy.com/"/> |
41 | 41 | <add key ="HostAddress" value="10.100.12.13" /> |
42 | - <add key="isUserAuthenticated" value="true"/> | |
42 | + <add key="isUserAuthenticated" value="false"/> | |
43 | 43 | <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/> |
44 | - </appSettings> | |
44 | + <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> | |
45 | + </appSettings> | |
45 | 46 | <system.web> |
46 | 47 | <compilation debug="true" targetFramework="4.5" /> |
47 | 48 | <httpRuntime targetFramework="4.5" /> |
48 | 49 | </system.web> |
49 | - | |
50 | + | |
50 | 51 | <applicationSettings> |
51 | 52 | <AIAHTML5.API.Properties.Settings> |
52 | 53 | <setting name="AIAConnectionString" serializeAs="String"> |
... | ... | @@ -77,11 +78,12 @@ |
77 | 78 | </dependentAssembly> |
78 | 79 | </assemblyBinding> |
79 | 80 | </runtime> |
80 | -<system.webServer> | |
81 | + <system.webServer> | |
81 | 82 | <handlers> |
82 | 83 | <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> |
83 | 84 | <remove name="OPTIONSVerbHandler" /> |
84 | 85 | <remove name="TRACEVerbHandler" /> |
85 | 86 | <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> |
86 | 87 | </handlers> |
87 | - </system.webServer></configuration> | |
88 | + </system.webServer> | |
89 | +</configuration> | |
88 | 90 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
... | ... | @@ -10,26 +10,26 @@ |
10 | 10 | <section name="AIAHTML5.API.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
11 | 11 | </sectionGroup> |
12 | 12 | </configSections> |
13 | - | |
14 | - <log4net debug="true"> | |
15 | -<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> | |
16 | - <file value="Logs\AIALogs.log" /> | |
17 | - <appendToFile value="true" /> | |
18 | - <rollingStyle value="Size" /> | |
19 | - <maxSizeRollBackups value="10" /> | |
20 | - <maximumFileSize value="10MB" /> | |
21 | - <staticLogFileName value="true" /> | |
22 | - <layout type="log4net.Layout.PatternLayout"> | |
23 | - <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" /> | |
24 | - </layout> | |
25 | -</appender> | |
26 | 13 | |
27 | -<root> | |
28 | - <level value="DEBUG" /> | |
29 | - <appender-ref ref="RollingLogFileAppender" /> | |
30 | -</root> | |
31 | -</log4net> | |
32 | - | |
14 | + <log4net debug="true"> | |
15 | + <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> | |
16 | + <file value="Logs\AIALogs.log" /> | |
17 | + <appendToFile value="true" /> | |
18 | + <rollingStyle value="Size" /> | |
19 | + <maxSizeRollBackups value="10" /> | |
20 | + <maximumFileSize value="10MB" /> | |
21 | + <staticLogFileName value="true" /> | |
22 | + <layout type="log4net.Layout.PatternLayout"> | |
23 | + <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" /> | |
24 | + </layout> | |
25 | + </appender> | |
26 | + | |
27 | + <root> | |
28 | + <level value="DEBUG" /> | |
29 | + <appender-ref ref="RollingLogFileAppender" /> | |
30 | + </root> | |
31 | + </log4net> | |
32 | + | |
33 | 33 | <appSettings> |
34 | 34 | <add key="SenderEmailAddress" value="support@interactiveanatomy.com" /> |
35 | 35 | <add key="ErrorNotificationEmailAddress" value="support@interactiveanatomy.com" /> |
... | ... | @@ -39,14 +39,15 @@ |
39 | 39 | <add key="EnableSSL" value="false" /> |
40 | 40 | <add key="Site_Url" value ="http://qa.beta.interactiveanatomy.com/"/> |
41 | 41 | <add key ="HostAddress" value="10.100.12.13" /> |
42 | - <add key="isUserAuthenticated" value="true"/> | |
42 | + <add key="isUserAuthenticated" value="false"/> | |
43 | 43 | <add key="AdminSupport" value="amrita.vishnoi@ebix.com,nikita.kulshreshtha@ebix.com"/> |
44 | - </appSettings> | |
44 | + <add key ="AIADatabaseV5Context" value="Data Source=192.168.90.53;Initial Catalog=AIADatabaseV5;User ID=AIA_Dev;Password=india123;"/> | |
45 | + </appSettings> | |
45 | 46 | <system.web> |
46 | 47 | <compilation debug="true" targetFramework="4.5" /> |
47 | 48 | <httpRuntime targetFramework="4.5" /> |
48 | 49 | </system.web> |
49 | - | |
50 | + | |
50 | 51 | <applicationSettings> |
51 | 52 | <AIAHTML5.API.Properties.Settings> |
52 | 53 | <setting name="AIAConnectionString" serializeAs="String"> |
... | ... | @@ -77,11 +78,12 @@ |
77 | 78 | </dependentAssembly> |
78 | 79 | </assemblyBinding> |
79 | 80 | </runtime> |
80 | -<system.webServer> | |
81 | + <system.webServer> | |
81 | 82 | <handlers> |
82 | 83 | <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> |
83 | 84 | <remove name="OPTIONSVerbHandler" /> |
84 | 85 | <remove name="TRACEVerbHandler" /> |
85 | 86 | <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> |
86 | 87 | </handlers> |
87 | - </system.webServer></configuration> | |
88 | + </system.webServer> | |
89 | +</configuration> | |
88 | 90 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -139,20 +139,20 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic |
139 | 139 | $("#messageModal").modal('show'); |
140 | 140 | } |
141 | 141 | else { |
142 | - if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { | |
142 | + if (result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { | |
143 | 143 | |
144 | 144 | if ($("#messageModal").length > 0){ |
145 | 145 | |
146 | 146 | $("#messageModal").modal('hide'); |
147 | 147 | } |
148 | 148 | $rootScope.userData = result; |
149 | - $rootScope.userModules = result.modules; | |
149 | + $rootScope.userModules = result.Modules; | |
150 | 150 | $rootScope.isVisibleLogin = false; |
151 | 151 | |
152 | 152 | localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); |
153 | 153 | $('#dvUserModulesInfo').modal('show'); |
154 | 154 | |
155 | - var userType = result.userType + ''; | |
155 | + var userType = result.UserType + ''; | |
156 | 156 | |
157 | 157 | if (userType === UserTypeConstants.SUPER_ADMIN) |
158 | 158 | $rootScope.haveRoleAdmin = false; | ... | ... |