public static PlanCase CreateCase(SqlDataReader dr, int planId, int defendantId) { PlanCase tmpcase = null; if (!dr.IsClosed && dr.HasRows) { // getting id that uniquely identifies the object string casename = dr["casename"].ToString(); string updatedby = dr["updatedby"].ToString(); DateTime updateddate = (DateTime)dr["updateddate"]; tmpcase = new PlanCase(planId, defendantId, casename, updatedby, updateddate); tmpcase.RaiseChangedEvents = false; tmpcase.CountyId = (!dr.IsDBNull(dr.GetOrdinal("countyid"))) ? Convert.ToInt32(dr["countyid"]) : -1; tmpcase.Committed = Convert.ToBoolean(dr["committed"].ToString()); if (!dr.IsDBNull(dr.GetOrdinal("commitdate"))) { tmpcase.CommitDate = dr["commitdate"].ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("commitbasedate"))) { tmpcase.CommitBaseDate = dr["commitbasedate"].ToString(); } tmpcase.CommitDaysTill = (!dr.IsDBNull(dr.GetOrdinal("commitdaystill"))) ? Convert.ToDouble(dr["commitdaystill"]) : 0; tmpcase.CAPP = Convert.ToBoolean(dr["capp"].ToString()); tmpcase.Save(); tmpcase.RaiseChangedEvents = true; } return(tmpcase); }
public PlanCase Clone() { PlanCase tmpcase = new PlanCase(this.ID, this.DefendantId, this.CaseName, this.UpdatedBy, this.UpdatedDate); tmpcase.RaiseChangedEvents = false; tmpcase.CountyId = this.CountyId; tmpcase.Committed = this.Committed; tmpcase.CommitDate = this.CommitDate; tmpcase.CommitBaseDate = this.CommitBaseDate; tmpcase.CommitDaysTill = this.CommitDaysTill; tmpcase.CAPP = this.CAPP; tmpcase.Save(); tmpcase.RaiseChangedEvents = true; return(tmpcase); }
public static PlanCase UpdateCaseIds(PlanCase planCase, int planId, int defendantId) { PlanCase tmpcase = null; // getting id that uniquely identifies the object tmpcase = new PlanCase(planId, defendantId, planCase.CaseName, planCase.UpdatedBy, planCase.UpdatedDate); tmpcase.RaiseChangedEvents = false; tmpcase.CountyId = planCase.CountyId; tmpcase.Committed = planCase.Committed; tmpcase.CommitDate = planCase.CommitDate; tmpcase.CommitBaseDate = planCase.CommitBaseDate; tmpcase.CommitDaysTill = planCase.CommitDaysTill; tmpcase.CAPP = planCase.CAPP; tmpcase.Save(); tmpcase.MyState = planCase.MyState; tmpcase.RaiseChangedEvents = true; return(tmpcase); }