public Guid InsertCase(CaseEntity caseEntity) { Guid result; Database db = DatabaseFactory.CreateDatabase(Constant.DiaryDBConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("usp_CaseInsert"); db.AddInParameter(dbCommand, "@Case", DbType.String, caseEntity.Case); db.AddInParameter(dbCommand, "@Code", DbType.String, caseEntity.Code); db.AddInParameter(dbCommand, "@ClientID", DbType.Guid, caseEntity.ClientId); db.AddInParameter(dbCommand, "@OffenceTypeId", DbType.Guid, caseEntity.OffenceTypeId); db.AddInParameter(dbCommand, "@CourtId", DbType.Guid, caseEntity.CourtId); db.AddInParameter(dbCommand, "@CaseTypeId", DbType.Guid, caseEntity.CaseTypeId); db.AddInParameter(dbCommand, "@Email", DbType.String, caseEntity.Email); db.AddInParameter(dbCommand, "@Contact", DbType.String, caseEntity.Contact); db.AddInParameter(dbCommand, "@CreatedBy", DbType.Guid, caseEntity.CreatedBy); db.AddOutParameter(dbCommand, "@CaseId", DbType.Guid, 30); db.ExecuteNonQuery(dbCommand); result = new Guid(db.GetParameterValue(dbCommand, "@CaseId").ToString()); caseEntity.CaseId = result; this.InsertUpdateDelete(caseEntity); return result; }
public bool UpdateCase(CaseEntity caseEntity) { return caseDao.UpdateCase(caseEntity); }
public Guid InsertCase(CaseEntity caseEntity) { return caseDao.InsertCase(caseEntity); }
private bool InsertUpdateDelete(CaseEntity caseEntity) { Database db = DatabaseFactory.CreateDatabase(Constant.DiaryDBConnectionString); DbCommand commandInsert = db.GetStoredProcCommand("usp_CaseDescriptionInsert"); db.AddInParameter(commandInsert, "@CaseId", DbType.Guid, caseEntity.CaseId); db.AddInParameter(commandInsert, "@ClientId", DbType.Guid, "ClientId", DataRowVersion.Current); db.AddInParameter(commandInsert, "@CreatedBy", DbType.Guid, "CreatedBy", DataRowVersion.Current); DbCommand commandUpdate = db.GetStoredProcCommand("usp_CaseDescriptionUpdate"); db.AddInParameter(commandUpdate, "@CaseDescriptionId", DbType.Int32, "CaseDescriptionId", DataRowVersion.Current); db.AddInParameter(commandUpdate, "@CaseId", DbType.Guid, "CaseId", DataRowVersion.Current); db.AddInParameter(commandUpdate, "@ClientId", DbType.Guid, "ClientId", DataRowVersion.Current); db.AddInParameter(commandUpdate, "@UpdatedBy", DbType.Guid, "UpdatedBy", DataRowVersion.Current); DbCommand commandDelete = db.GetStoredProcCommand("usp_CaseDescriptionDelete"); db.AddInParameter(commandDelete, "@CaseDescriptionId", DbType.Int64, "CaseDescriptionId", DataRowVersion.Current); db.UpdateDataSet(caseEntity.Clients, caseEntity.Clients.Tables[0].TableName, commandInsert, commandUpdate, commandDelete, UpdateBehavior.Transactional); return true; }
public bool UpdateCase(CaseEntity caseEntity) { bool result = false; Database db = DatabaseFactory.CreateDatabase(Constant.DiaryDBConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("usp_CaseUpdate"); db.AddInParameter(dbCommand, "@CaseId", DbType.Guid, caseEntity.CaseId); db.AddInParameter(dbCommand, "@Code", DbType.String, caseEntity.Code); db.AddInParameter(dbCommand, "@Case", DbType.String, caseEntity.Case); db.AddInParameter(dbCommand, "@ClientID", DbType.Guid, caseEntity.ClientId); db.AddInParameter(dbCommand, "@OffenceTypeId", DbType.Guid, caseEntity.OffenceTypeId); db.AddInParameter(dbCommand, "@CourtId", DbType.Guid, caseEntity.CourtId); db.AddInParameter(dbCommand, "@CaseTypeId", DbType.Guid, caseEntity.CaseTypeId); db.AddInParameter(dbCommand, "@Email", DbType.String, caseEntity.Email); db.AddInParameter(dbCommand, "@Contact", DbType.String, caseEntity.Contact); db.AddInParameter(dbCommand, "@UpdatedBy", DbType.Guid, caseEntity.UpdatedBy); db.ExecuteNonQuery(dbCommand); this.InsertUpdateDelete(caseEntity); result = true; return result; }