protected void lnkbtnAddLine_Click(object sender, EventArgs e) { objProcedureNotes_Bal = new clsProcedureNotes_BAL(); objProcedureNotesLinesEntity = new ProcNotes_Lines_Entity(); if (Convert.ToInt32(hfProcNotes_ID.Value.ToString()) > 0) { if (rbtnlstNotesType.SelectedItem.Text.ToString() == "Text") { if (CKEditorControl1.Text == "") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage2", "Showalert_Notes();", true); return; } } int _LineNumber = 0; ProcNotes_Line_ID = 0; objProcedureNotesLinesEntity = new ProcNotes_Lines_Entity(); objProcedureNotesLinesEntity.ProcNotes_Line_ID = ProcNotes_Line_ID; if (Convert.ToInt32(hfParentID.Value.ToString()) == 0) { objProcedureNotesLinesEntity.ProcNotes_ID = ProcNotes_ID; } else { objProcedureNotesLinesEntity.ProcNotes_ID = Convert.ToInt32(hfProcNotes_ID.Value.ToString()); } _LineNumber = objProcedureNotes_Bal.GetMaxLineNumber(Convert.ToInt32(hfProcNotes_ID.Value.ToString())); objProcedureNotesLinesEntity.LineNumber = _LineNumber + 1; objProcedureNotesLinesEntity.Notes_Type = rbtnlstNotesType.SelectedItem.Text.ToString(); string _htmltext = ""; _htmltext = CKEditorControl1.Text.ToString(); objProcedureNotesLinesEntity.Notes = _htmltext; //objProcedureNotesLinesEntity.Notes = Addnewline(_htmltext); //objProcedureNotesLinesEntity.Notes = Addnewline(_htmltext,125); objProcedureNotesLinesEntity.Notes_Binary = new byte[0]; if (rbtnlstActiveInActive.SelectedItem.Text == "Active") { objProcedureNotesLinesEntity.IsActive = true; } else if (rbtnlstActiveInActive.SelectedItem.Text == "InActive") { objProcedureNotesLinesEntity.IsActive = false; } objProcedureNotesLinesEntity.CreatedBy = Convert.ToInt32(Session["UserID"]);; objProcedureNotesLinesEntity.LastUpdatedBy = Convert.ToInt32(Session["UserID"]);; ProcNotes_Line_ID = objProcedureNotes_Bal.InsertUpdateProcedureNotesLines(objProcedureNotesLinesEntity); hfProcNotes_Line_ID.Value = ProcNotes_Line_ID.ToString(); if (ProcNotes_Line_ID > 0) { CKEditorControl1.Text = ""; rbtnlstNotesType.Text = "Text"; rbtnlstNotesType.Items.FindByText("Text").Selected = true; rbtnlstActiveInActive.Text = "Active"; rbtnlstActiveInActive.Items.FindByText("Active").Selected = true; GetProcNoteLine(Convert.ToInt32(hfProcNotes_ID.Value.ToString())); } } }
protected void lnkbtnAddNode_Click(object sender, EventArgs e) { objProcedureNotes_Bal = new clsProcedureNotes_BAL(); int _ProcID = 0; int _CountOfProcID = 0; int _SequenceNumber = 0; int _SNO = 0; int _ChildNotesCount = 0; int _SeqNum = 0; int _ParentID = 0; if (ddlProcedureList.SelectedItem.Value == "-1") { ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage1", "Showalert_ProcedureList();", true); return; } else { objProcedureNotesEntity = new ProcedureNotes_Entity(); _ProcID = Convert.ToInt32(ddlProcedureList.SelectedItem.Value.ToString()); _CountOfProcID = objProcedureNotes_Bal.GetCountOfProc_ID(_ProcID); if (_CountOfProcID > 0) { if (Convert.ToInt32(hfParentID.Value.ToString()) == 0) { _ParentID = Convert.ToInt32(hfParentID.Value.ToString()); objProcedureNotesEntity.SequenceNumber = 1; objProcedureNotesEntity.SeqNum = 1; _SNO = objProcedureNotes_Bal.GetCountOfChildNodes(Convert.ToInt32(hfProcNotes_ID.Value.ToString())); objProcedureNotesEntity.SNO = _SNO + 1; objProcedureNotesEntity.SerialNumber = objProcedureNotesEntity.SNO.ToString(); objProcedureNotesEntity.Notes = (objProcedureNotesEntity.SNO) + " - Blank"; } else { _ParentID = Convert.ToInt32(hfParentID.Value.ToString()); _SequenceNumber = objProcedureNotes_Bal.GetMaxSequenceNumber(Convert.ToInt32(hfProcNotes_ID.Value.ToString())); _SeqNum = objProcedureNotes_Bal.GetMaxSeqNum(Convert.ToInt32(hfProcNotes_ID.Value.ToString())); _ChildNotesCount = objProcedureNotes_Bal.GetCountOfChildNodes(Convert.ToInt32(hfProcNotes_ID.Value.ToString())); if (_ChildNotesCount > 0) { objProcedureNotesEntity.SeqNum = _SeqNum + 1; objProcedureNotesEntity.SerialNumber = hfSerialNumber.Value.ToString() + "." + objProcedureNotesEntity.SeqNum.ToString(); } else { objProcedureNotesEntity.SeqNum = 1; objProcedureNotesEntity.SerialNumber = hfSerialNumber.Value.ToString() + "." + objProcedureNotesEntity.SeqNum.ToString(); } objProcedureNotesEntity.SNO = 0; objProcedureNotesEntity.SequenceNumber = _SequenceNumber + 1; objProcedureNotesEntity.Notes = objProcedureNotesEntity.SerialNumber.ToString() + " - Blank"; } ProcNotes_ID = 0; objProcedureNotesEntity.ProcNotes_ID = ProcNotes_ID; objProcedureNotesEntity.Proc_ID = _ProcID; objProcedureNotesEntity.ParentID = Convert.ToInt32(hfProcNotes_ID.Value.ToString()); lblParentID.Text = objProcedureNotesEntity.ParentID.ToString(); objProcedureNotesEntity.CreatedBy = Convert.ToInt32(Session["UserID"]); objProcedureNotesEntity.LastUpdatedBy = Convert.ToInt32(Session["UserID"]);; } else { ProcNotes_ID = 0; objProcedureNotesEntity = new ProcedureNotes_Entity(); objProcedureNotesEntity.ProcNotes_ID = ProcNotes_ID; objProcedureNotesEntity.Proc_ID = _ProcID; objProcedureNotesEntity.ParentID = 0; objProcedureNotesEntity.SerialNumber = "0"; objProcedureNotesEntity.Notes = ddlProcedureList.SelectedItem.Text.ToString(); objProcedureNotesEntity.CreatedBy = Convert.ToInt32(Session["UserID"]);; objProcedureNotesEntity.LastUpdatedBy = Convert.ToInt32(Session["UserID"]);; objProcedureNotesEntity.SequenceNumber = 0; objProcedureNotesEntity.SNO = 0; objProcedureNotesEntity.SeqNum = 0; _ParentID = 0; } ProcNotes_ID = objProcedureNotes_Bal.InsertUpdateProcedureNotes(objProcedureNotesEntity); if (ProcNotes_ID > 0) { if (objProcedureNotesEntity.ParentID > 0) { int _LineNumber = 0; ProcNotes_Line_ID = 0; objProcedureNotesLinesEntity = new ProcNotes_Lines_Entity(); objProcedureNotesLinesEntity.ProcNotes_Line_ID = ProcNotes_Line_ID; objProcedureNotesLinesEntity.ProcNotes_ID = ProcNotes_ID; _LineNumber = objProcedureNotes_Bal.GetMaxLineNumber(ProcNotes_ID); objProcedureNotesLinesEntity.LineNumber = _LineNumber + 1; objProcedureNotesLinesEntity.Notes_Type = "Text"; objProcedureNotesLinesEntity.Notes = objProcedureNotesEntity.Notes.ToString(); objProcedureNotesLinesEntity.Notes_Binary = new byte[0]; objProcedureNotesLinesEntity.IsActive = true; objProcedureNotesEntity.CreatedBy = Convert.ToInt32(Session["UserID"]);; objProcedureNotesEntity.LastUpdatedBy = Convert.ToInt32(Session["UserID"]); ProcNotes_Line_ID = objProcedureNotes_Bal.InsertUpdateProcedureNotesLines(objProcedureNotesLinesEntity); hfProcNotes_Line_ID.Value = ProcNotes_Line_ID.ToString(); } else { } } if (ProcNotes_ID > 0) { GetProcNotesByProcID(); } } }