Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 public bool UpdateCase(CaseEntity caseEntity)
 {
     return caseDao.UpdateCase(caseEntity);
 }
Exemplo n.º 3
0
 public Guid InsertCase(CaseEntity caseEntity)
 {
     return caseDao.InsertCase(caseEntity);
 }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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;
        }