/// <summary> /// Transfer to Comments /// </summary> /// <param name="loginId">loginId</param> /// <param name="adminPermission">admin Permission</param> /// <param name="jlinerComments">jlinerComments</param> public void TransferToComments(int loginId, bool adminPermission, FlatSectionJlCommentDetails flatSectionJlCommentDetails) { int? libraryFilesId = null; foreach (FlatSectionJlTDS.FlatSectionJlHistoryDetailsRow historyRow in (FlatSectionJlTDS.FlatSectionJlHistoryDetailsDataTable)Table) { if (adminPermission) { if (!historyRow.IsToCommentsNull()) { if ((historyRow.ToComments) && (!historyRow.Deleted)) { if (!historyRow.IsLIBRARY_FILES_IDNull()) { libraryFilesId = historyRow.LIBRARY_FILES_ID; } else { libraryFilesId = null; } string workType = ""; if (!historyRow.IsWorkTypeNull()) workType = historyRow.WorkType; // Insert to comments flatSectionJlCommentDetails.Insert(historyRow.WorkID, historyRow.Type, historyRow.Subject, historyRow.UserID, historyRow.DateTime_, historyRow.History, libraryFilesId, historyRow.Deleted, historyRow.COMPANY_ID, false, historyRow.UserFullName, false, workType); // Delete from History historyRow.Deleted = true; } } } else { if (historyRow.UserID == loginId) { if (!historyRow.IsToCommentsNull()) { if ((historyRow.ToComments) && (!historyRow.Deleted)) { if (!historyRow.IsLIBRARY_FILES_IDNull()) { libraryFilesId = historyRow.LIBRARY_FILES_ID; } else { libraryFilesId = null; } string workType = ""; if (!historyRow.IsWorkTypeNull()) workType = historyRow.WorkType; // Insert to comments flatSectionJlCommentDetails.Insert(historyRow.WorkID, historyRow.Type, historyRow.Subject, historyRow.UserID, historyRow.DateTime_, historyRow.History, libraryFilesId, historyRow.Deleted, historyRow.COMPANY_ID, false, historyRow.UserFullName, false, workType); // Delete from History historyRow.Deleted = true; } } } } } }
private void GrdCommentsAdd() { if (ValidateCommentsFooter()) { Page.Validate("commentsDataAdd"); if (Page.IsValid) { int workId = Int32.Parse(hdfWorkId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); int loginId = Convert.ToInt32(Session["loginID"]); DateTime dateTime_ = DateTime.Now; bool inDatabase = false; bool deleted = false; string workType = hdfWorkType.Value; string newSubject = ((TextBox)grdComments.FooterRow.FindControl("tbxSubjectNew")).Text.Trim(); string newType = "Junction Lining Lateral"; string newComment = ((TextBox)grdComments.FooterRow.FindControl("tbxCommentsNew")).Text.Trim(); int? libraryFilesId = null; if (((Label)grdComments.FooterRow.FindControl("lblLIBRARY_FILES_IDNew")).Text != "") libraryFilesId = Int32.Parse(((Label)grdComments.FooterRow.FindControl("lblLIBRARY_FILES_IDNew")).Text.Trim()); bool toHistory = ((CheckBox)grdComments.FooterRow.FindControl("ckbxToHistoryNew")).Checked; LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string userFullName = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); FlatSectionJlCommentDetails model = new FlatSectionJlCommentDetails(flatSectionJlTDS); model.Insert(workId, newType, newSubject, loginId, dateTime_, newComment, libraryFilesId, deleted, companyId, inDatabase, userFullName, toHistory, workType); Session.Remove("flatSectionJlCommentDetailsDummy"); Session["flatSectionJlTDS"] = flatSectionJlTDS; Session["flatSectionJlCommentDetails"] = flatSectionJlTDS.FlatSectionJlCommentDetails; grdComments.DataBind(); grdComments.PageIndex = grdComments.PageCount - 1; } } }