// ///////////////////////////////////////////////////////////////////////////////////////////////////// // STEP3 - JLINER // // //////////////////////////////////////////////////////////////////////// // STEP3 - JLINER - EVENTS // protected void grdJliner2_RowDeleting(object sender, GridViewDeleteEventArgs e) { // grdJliner2 Gridview, if the gridview is edition mode if (grdJliner2.EditIndex >= 0) { grdJliner2.UpdateRow(grdJliner2.EditIndex, true); } // Delete jliner Guid id = new Guid(((Label)grdJliner2.Rows[e.RowIndex].Cells[0].FindControl("lblId")).Text); int refId = Int32.Parse(((Label)grdJliner2.Rows[e.RowIndex].Cells[1].FindControl("lblRefId")).Text); int companyId = Int32.Parse(((Label)grdJliner2.Rows[e.RowIndex].Cells[2].FindControl("lblCOMPANY_ID")).Text); JlinerAddJunctionLiner2 model = new JlinerAddJunctionLiner2(jlinerAddTDS); model.Delete(id, refId, companyId); // ... delete comments JlinerAddJunctionLiner2CommentGateway jlinerAddJunctionLiner2CommentGateway = new JlinerAddJunctionLiner2CommentGateway(jlinerAddTDS); jlinerAddJunctionLiner2CommentGateway.LoadAllByIdRefId(id, refId, companyId); JlinerAddJunctionLiner2Comment jlinerAddJunctionLiner2Comment = new JlinerAddJunctionLiner2Comment(jlinerAddJunctionLiner2CommentGateway.Data); jlinerAddJunctionLiner2Comment.DeleteAllCommentsForAJliner(id, refId, companyId); // Save dataset Session["jlinerAddTDS"] = jlinerAddTDS; }
/// <summary> /// Save all sections & works to database (direct) /// </summary> /// <param name="id">id</param> /// <param name="companyId">companyId</param> public void Save(Guid id, int companyId) { JlinerAddTDS jlinerAddChanges = (JlinerAddTDS)Data.GetChanges(); if (jlinerAddChanges != null) { if (jlinerAddChanges.JunctionLiner2Comment.Rows.Count > 0) { JlinerAddJunctionLiner2CommentGateway jlinerAddJunctionLiner2CommentGateway = new JlinerAddJunctionLiner2CommentGateway(jlinerAddChanges); foreach (JlinerAddTDS.JunctionLiner2CommentRow row in (JlinerAddTDS.JunctionLiner2CommentDataTable)jlinerAddChanges.JunctionLiner2Comment) { // Deleted lateral comments if (row.Deleted) { JlinerComments jlinerComments = new JlinerComments(null); jlinerComments.DeleteAllDirect(row.ID, row.RefID, companyId); } } } } }