public ActionResult SaveMentalHealthClient(MentalHealthCaseNote MentalHealthCaseNote) { bool res = false; try { mHealth = new MentalHealthData(); MentalHealthDashboard dash = new MentalHealthDashboard(); dash.ClientList = new List <MentalHealthClientList>(); // for casenote string name = ""; string casenoteid = ""; RosterNew.CaseNote _caseNote = new RosterNew.CaseNote(); _caseNote.CaseNoteAttachmentList = Fingerprints.Common.FactoryInstance.Instance.CreateInstance <List <RosterNew.Attachment> >(); var ate = Request.Files; var ate2 = ate.AllKeys; for (int i = 0; i < ate2.Length; i++) { RosterNew.Attachment aatt = new RosterNew.Attachment(); aatt.file = ate[i]; if (aatt.file.ContentLength > 0) { _caseNote.CaseNoteAttachmentList.Add(aatt); } } _caseNote.CenterId = EncryptDecrypt.Decrypt64(MentalHealthCaseNote.CenterId); // _caseNote.Classroomid = MentalHealthCaseNote.CaseClassroomId.ToString(); _caseNote.ClientId = EncryptDecrypt.Decrypt64(MentalHealthCaseNote.ClientId.ToString()); _caseNote.CaseNotetags = MentalHealthCaseNote.Tags.Trim(','); _caseNote.CaseNoteTitle = MentalHealthCaseNote.Title; _caseNote.CaseNoteDate = MentalHealthCaseNote.Date; _caseNote.Note = MentalHealthCaseNote.MHcasenote; _caseNote.ClientIds = string.Join(",", MentalHealthCaseNote.ClientIds.ToArray()); // _caseNote.ProgramId = EncryptDecrypt.Decrypt64(MentalHealthCaseNote.CaseProgramId); casenoteid = new RosterData(staff).SaveCaseNotes(ref name, _caseNote, 2); res = mHealth.SaveMentalHealthClient(MentalHealthCaseNote, name); } catch (Exception ex) { clsError.WriteException(ex); } return(RedirectToAction("MentalHealthDashboard")); }
public JsonResult GetCaseNoteDetailsByYakkr(string clientId, string yakkrId) { RosterNew.CaseNote caseNote = new RosterNew.CaseNote(); try { caseNote = new YakkrData().GetCaseNoteByYakkr(clientId, yakkrId); } catch (Exception ex) { clsError.WriteException(ex); } return(Json(caseNote, JsonRequestBehavior.AllowGet)); }
public RosterNew.CaseNote GetCaseNoteByYakkr(string clientId, string yakkrId) { RosterNew.CaseNote casenote = new RosterNew.CaseNote(); StaffDetails staffDetails = StaffDetails.GetInstance(); try { if (Connection.State == ConnectionState.Open) { Connection.Close(); } command.Connection = Connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "USP_GetCaseNoteInfoByYakkrId"; command.Parameters.Clear(); command.Parameters.Add(new SqlParameter("@AgencyId", staffDetails.AgencyId)); command.Parameters.Add(new SqlParameter("@UserId", staffDetails.UserId)); command.Parameters.Add(new SqlParameter("@YakkrId", yakkrId)); command.Parameters.Add(new SqlParameter("@RoleId", staffDetails.RoleId)); command.Parameters.Add(new SqlParameter("@ClientId", clientId)); Connection.Open(); DataAdapter = new SqlDataAdapter(command); _dataset = new DataSet(); DataAdapter.Fill(_dataset); Connection.Close(); if (_dataset != null) { if (_dataset.Tables[0].Rows.Count > 0) { casenote = new RosterNew.CaseNote(); casenote.ClientId = _dataset.Tables[0].Rows[0]["ClientId"].ToString(); casenote.ClientName = _dataset.Tables[0].Rows[0]["ClientName"].ToString(); casenote.CaseNoteDate = _dataset.Tables[0].Rows[0]["CaseNoteDate"].ToString(); casenote.CaseNoteid = _dataset.Tables[0].Rows[0]["CaseNoteId"].ToString(); casenote.Note = _dataset.Tables[0].Rows[0]["Notes"].ToString(); casenote.CaseNotetitle = _dataset.Tables[0].Rows[0]["Title"].ToString(); casenote.AttachmentIdArray = (from DataRow dr1 in _dataset.Tables[0].Rows where Convert.ToInt32(dr1["AttachmentId"].ToString()) > 0 select dr1["AttachmentId"].ToString() ).ToArray(); } } } catch (Exception ex) { clsError.WriteException(ex); } return(casenote); }
// [ValidateInput(false)] //public ActionResult InsertOrganizationalissue(int ProblemOn, int? CRColorCode, int QuestionaireID, int CommunityId, int Yakkrid, // string MgNotes, RosterNew.CaseNote CaseNote, List<RosterNew.Attachment> Attachments, RosterNew.ClientUsers TeamIds) public ActionResult InsertOrganizationalIssue(ReferalDetails referralDetails, RosterNew.CaseNote caseNote, int yakkrId) { bool caseNoteResult = true; bool questionnaireResult = false; int caseNoteId = 0; if (referralDetails.ProblemOn == 1) { string message = ""; string Name = ""; //insert casenote if (caseNote != null) { if (caseNote.CaseNoteAttachmentList != null) { caseNote.CaseNoteAttachmentList.ForEach(x => { x.AttachmentFileName = string.IsNullOrEmpty(x.AttachmentFileName) ? "OrganizationalIssue_CaseNoteAttachment" : x.AttachmentFileName; if (!string.IsNullOrEmpty(x.AttachmentJson)) { x.AttachmentFileByte = Convert.FromBase64String(x.AttachmentJson); } }); } message = new RosterData(staff).SaveCaseNotes(ref Name, caseNote, 2); } if (message != "1") { caseNoteResult = false; } if (!string.IsNullOrEmpty(Name)) { caseNoteId = Convert.ToInt32(Name); } } if (caseNoteResult) { questionnaireResult = new YakkrData().SubmitFeedBack453(4, referralDetails, staff, yakkrId, caseNoteId); if (!questionnaireResult) { new RosterData(staff).DeleteCaseNote(casenoteid: caseNoteId, appendcid: new int[] { }, deletemain: true, mode: 1); } } //if (ProblemOn == 1) //{ // StringBuilder _Ids = new StringBuilder(); // if (TeamIds.IDS != null) // { // foreach (string str in TeamIds.IDS) // { // _Ids.Append(str + ","); // } // CaseNote.StaffIds = _Ids.ToString().Substring(0, _Ids.Length - 1); // } // CaseNote.CaseNotetags = (CaseNote != null && !string.IsNullOrEmpty(CaseNote.CaseNotetags)) ? CaseNote.CaseNotetags.Substring(0, CaseNote.CaseNotetags.Length - 1) : ""; //} //CaseNote.CaseNoteAttachmentList = Attachments; //var result = new YakkrData().SubmitFeedBack453(4, ProblemOn, CRColorCode, CommunityId, QuestionaireID, Yakkrid, MgNotes, CaseNote); return(Json(new { result = questionnaireResult }, JsonRequestBehavior.AllowGet)); }
//[ValidateInput(false)] public ActionResult InsertQuestionnaireForm(Questionaire qsform, RosterNew.CaseNote CaseNote) { bool caseNoteResult = true; bool questionnaireResult = false; if (qsform.AppointmentMaked == 0) { string message = ""; string Name = ""; //insert casenote CaseNote.CaseNoteAttachmentList.ForEach(x => { x.AttachmentFileName = string.IsNullOrEmpty(x.AttachmentFileName) ? "CaseNoteAttachment" : x.AttachmentFileName; if (!string.IsNullOrEmpty(x.AttachmentJson)) { x.AttachmentFileByte = Convert.FromBase64String(x.AttachmentJson); } }); message = new RosterData(staff).SaveCaseNotes(ref Name, CaseNote, 2); if (message != "1") { caseNoteResult = false; } if (!string.IsNullOrEmpty(Name)) { qsform.CaseNoteId = Convert.ToInt32(Name); } } if (caseNoteResult) { questionnaireResult = new YakkrData().InsertQuestionaireForm(qsform, staff); if (!questionnaireResult) { new RosterData(staff).DeleteCaseNote(casenoteid: Convert.ToInt32(CaseNote.CaseNoteid), appendcid: new int[] { }, deletemain: true, mode: 1); } } ////return View(); //if (qsform.AppointmentMaked == 0 && qsform.ReceiveAnotherReferral) //{ // string ID = EncryptDecrypt.Encrypt64(CaseNote.ClientId); // return new RedirectResult("~/Roster/ReferralService?id=" + ID + "&ClientName=" + CaseNote.ClientName + ""); //} //else //{ // return new RedirectResult("~/Yakkr/YakkrList?YakkrCode=450"); //} return(Json(new { result = questionnaireResult, encClientId = EncryptDecrypt.Encrypt64(CaseNote.ClientId) }, JsonRequestBehavior.AllowGet)); }