public JsonResult DeleteNote(int ID) { System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { int checkSession = UserLogin.AuthenticateRequest(); if (checkSession == 0) { return Json(checkSession); } else { var data = new Note { ID = ID, CreatedBy = checkSession }; int output = data.DeleteNote(); return Json(output); } } catch (Exception ex) { log.Error("Error: " + ex); return Json(""); } finally { log.Debug("End: " + methodBase.Name); } }
/// <summary> /// Description : To Get Note Details for ReferId and Type /// Created By : Pavan /// Created Date : 4 June 2014 /// Modified By : /// Modified Date : /// <returns></returns> /// </summary> public static NoteInfo GetNoteData(int ReferId, string Type, int UserID, int startpage, int rowsperpage) { var data = new NoteInfo(); System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { SqlParameter[] sqlParams = new SqlParameter[5]; sqlParams[0] = new SqlParameter("@startPage", startpage); sqlParams[1] = new SqlParameter("@resultPerPage", rowsperpage); sqlParams[2] = new SqlParameter("@RefID", ReferId); sqlParams[3] = new SqlParameter("@Type", Type); sqlParams[4] = new SqlParameter("@UserID", UserID); var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetNoteByTypeAndRefID]", sqlParams); var safe = new SafeDataReader(reader); while (reader.Read()) { var Notes = new Note(); Notes.FetchNote(Notes, safe); data.NoteList.Add(Notes); data.NoteCount = Convert.ToInt32(reader["NoteCount"]); } return data; } catch (Exception ex) { log.Error("Error: " + ex); return data; } finally { log.Debug("End: " + methodBase.Name); } }
public JsonResult InsertNote(string Type, int ReferId, string Description, int ID, string Action) { System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { int checkSession = UserLogin.AuthenticateRequest(); if (checkSession == 0) { return Json(checkSession); } else { var data = new Note { Type = Type, ReferId = ReferId, Description = HttpUtility.UrlDecode(Description), ID = ID, Action = Action, CreatedBy = checkSession }; int output = data.InsertNote(); return Json(output); } } catch (Exception ex) { log.Error("Error: " + ex); return Json(""); } finally { log.Debug("End: " + methodBase.Name); } }
private Note FetchNote(Note Note, SafeDataReader dr) { Note.ID = dr.GetInt32("ID"); Note.Type = dr.GetString("Type"); Note.ReferId = dr.GetInt32("ReferID"); Note.Description = dr.GetString("Description"); Note.Name = dr.GetString("Name"); Note.IsLoggedUserForAction = dr.GetInt32("IsLoggedUserForAction"); Note.CreatedDate = dr.GetString("CreatedDate"); Note.UpdatedDate = dr.GetString("UpdatedDate"); return Note; }