public LeadFollowup UpdateLeadFollowup(LeadFollowup objLeadFollowup) { try { objLeadFollowup.updateDate = DateTime.Now; using (var context = new FitnessCenterEntities()) { context.LeadFollowups.Attach(context.LeadFollowups.Single(varL => varL.ID == objLeadFollowup.ID)); context.LeadFollowups.ApplyCurrentValues(objLeadFollowup); context.SaveChanges(); return(objLeadFollowup); } } catch (Exception ex) { throw ex; } }
public LeadFollowup InsertLeadFollowup(LeadFollowup objLeadFollowup) { try { objLeadFollowup.insertDate = DateTime.Now; objLeadFollowup.isActive = true; objLeadFollowup.isDeleted = false; using (var context = new FitnessCenterEntities()) { context.LeadFollowups.AddObject(objLeadFollowup); context.SaveChanges(); return(objLeadFollowup); } } catch (Exception ex) { throw ex; } }
protected void grdLeadFollowup_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = grdLeadFollowup.Rows[e.RowIndex]; int FollowupId = Convert.ToInt32(grdLeadFollowup.DataKeys[e.RowIndex].Values[0]); string remarks = (row.FindControl("txtFolowupRemarks") as TextBox).Text; string followupDate = (row.FindControl("followupDate") as TextBox).Text; using (FitnessCenterEntities entities = new FitnessCenterEntities()) { LeadFollowup leadfollowup = (from c in entities.LeadFollowups where c.ID == FollowupId select c).FirstOrDefault(); leadfollowup.Remarks = remarks; leadfollowup.followupDateTime = UtillController.ConvertDateTime(followupDate); leadfollowup.updateDate = DateTime.Now; entities.SaveChanges(); } grdLeadFollowup.EditIndex = -1; this.BindFollowup(); grdLeadFollowup.Focus(); }