コード例 #1
0
        public object UpdateHcAssesmentInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    HcAssesmentEntity hcAssesmentEntity = (HcAssesmentEntity)param;
                    HcAssesmentDAL    hcAssesmentDAL    = new HcAssesmentDAL();
                    retObj = (object)hcAssesmentDAL.UpdateHcAssesmentInfo(hcAssesmentEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
コード例 #2
0
ファイル: HcAssesmentDAL.cs プロジェクト: arafat08007/mcare
        public HcAssesmentEntity GetSingleHcAssesmentRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, Type, Description FROM HC_Assesment WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            HcAssesmentEntity hcAssesmentEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    hcAssesmentEntity = new HcAssesmentEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        hcAssesmentEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["Type"] != DBNull.Value)
                    {
                        hcAssesmentEntity.Type = dataReader["Type"].ToString();
                    }
                    if (dataReader["Description"] != DBNull.Value)
                    {
                        hcAssesmentEntity.Description = dataReader["Description"].ToString();
                    }
                }
            }
            return(hcAssesmentEntity);
        }
コード例 #3
0
ファイル: HcAssesmentDAL.cs プロジェクト: arafat08007/mcare
        public bool SaveHcAssesmentInfo(HcAssesmentEntity hcAssesmentEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "INSERT INTO HC_Assesment ( Type, Description) VALUES (  @Type,  @Description )";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Type", DbType.String, hcAssesmentEntity.Type);
            db.AddInParameter(dbCommand, "Description", DbType.String, hcAssesmentEntity.Description);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
コード例 #4
0
ファイル: HcAssesmentDAL.cs プロジェクト: arafat08007/mcare
        public bool UpdateHcAssesmentInfo(HcAssesmentEntity hcAssesmentEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE HC_Assesment SET Type= @Type, Description= @Description WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcAssesmentEntity.Id);
            db.AddInParameter(dbCommand, "Type", DbType.String, hcAssesmentEntity.Type);
            db.AddInParameter(dbCommand, "Description", DbType.String, hcAssesmentEntity.Description);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }